Giter Site home page Giter Site logo

drabcofficial / asexthook Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 1.0 3.42 MB

A metamod plugin for Sven co-op, AngelsScript, Hook and SQLite!

License: GNU General Public License v3.0

C++ 71.16% C 17.10% AngelScript 0.76% ActionScript 0.07% CMake 10.91%
co-op sven svencoop metamod angel angelscript plugin script

asexthook's Introduction

ASExtHook: Plugin to extend Sven Co-op script ASExtHook

License: GPL v3 Build Release Download Commit

ASExtHook is a Metamod plugin used to extend the Sven Co-op AngelScripts scripting system.

Using this plugin makes it easy to perform operations that were previously exceptionally difficult, such as hooking whether a monster is dead or not.

Auto-generated HTML documentation for the Sven Co-op AsExtHook Angelscript API is available Here

Used HTML Generator Here



1. Install

  1. Grab metamod-p and asext.dll/asext.so Here

  2. Install them.

  3. Grab asexthook.dll/asexthook.so, put them into svencoop/addons/metamod/dlls

    1. Grab latest version in Action (Unstable, crash risk)

      or

    2. Grab release version in Release (Stable)

  4. edit svencoop/addons/metamod/plugins.ini

  5. add

win32 addons/metamod/dlls/asexthook.dll
linux addons/metamod/dlls/asexthook.so
  1. enjoy your new hook :3

2. Build

If you are using systems that are not covered by automatic builds (yum's and aur's)

or want to add new hooks yourself, you can follow these steps to configure your build environment.

  1. Install everything you need

    1. Git or winget install --id Git.Git -e --source winget
    2. Visual Studio with vc143 toolset And C++ desktop development
    1. sudo apt install git make build-essential gcc gcc-multilib g++-multilib cmake -y
    1. sudo yum install git make gcc gcc-c++ glibc-devel.i686 libstdc++-devel.i686 cmake -y

    Sorry guys who using Arch, I've never used an Arch based distribution, you'll have to find out how to configure the dependencies yourselves!๐Ÿ™‚

  2. Clone metamod modified by hzqst

    git clone https://github.com/DrAbcOfficial/metamod-fallguys.git metamod

    cd metamod

  3. Clone this

    git clone https://github.com/DrAbcOfficial/asexthook.git

    cd asexthook

  4. Build!

    1. Open asexthook.sln with visual studio
    2. Press F7
    3. Wait and done.
    1. mkdir build && cd build && cmake .. && make
  5. Grab

    Now you can grab your new library (asexthook.dll/asexthook.so) in

    metamod/build/addons/metamod/dlls/

3. Document

3.1. Current Expansion Property

Class Namespace Object
CBinaryStringBuilder <Global> g_BinaryStringBuilder

3.2. Current Expansion Objects

class HealthInfo{
	CBaseEntity@ pEntity;
	float flHealth;
	int bitsDamageType;
	int health_cap;
}

3.3. Current Expansion Methods

Class Method Explian
CEngineFuncs uint32 CRC32(const string& in szBuffer) Caculate CRC32 for a string
CEngineFuncs bool ClassMemcpy(?& in src, ?& in dst) copy class, If src and dst are different type, return false. If not class ref, crash game.
--- --- ---
CBinaryStringBuilder More info click url๐Ÿ‘‰ CBinaryStringBuilder
CSQLite More info click url๐Ÿ‘‰ CSQLite

3.4. Expansion Method Examples

Example

3.5. 3.5 Expansion CVar

CVar default explain
sv_fixgmr 1 add gmr found before SV_ModelIndex to fix gmr crash game

3.6. Current Expansion Hooks


3.6.1. EntitySpawn

Hooks::Entity const uint32 EntitySpawn (CBaseEntity@ pEntity)

Call after original CBaseEntity::Spawn called.

StopMode: CALL_ALL

MapScript | Plugin


3.6.2. IRelationship

Hooks::Entity const uint32 IRelationship (CBaseEntity@ pEntity, CBaseEntity@ pOther, bool param, int& out newValue)

Pre call before checking relation.

if newValue changed, will use new relationship.

StopMode: CALL_ALL

MapScript | Plugin


3.6.3. MonsterSpawn

Hooks::Monster const uint32 MonsterSpawn (CBaseMonster@ pMonster)

Call after who having FL_MONSTER entity CBaseEntity::Spawn called.

StopMode: CALL_ALL

MapScript | Plugin


3.6.4. MonsterTakeDamage

Hooks::Monster const uint32 MonsterTakeDamage (DamageInfo@ info)

Call before origin CBaseMonster::TakeDamage called.

StopMode: CALL_ALL

MapScript | Plugin


3.6.5. MonsterKilled

Hooks::Monster const uint32 MonsterKilled (CBaseMonster@ pMonster, entvars_t@ pevAttacker, int iGib)

Call before origin CBaseMonster::Killed called.

StopMode: CALL_ALL

MapScript | Plugin


3.6.6. MonsterTraceAttack

Hooks::Monster const uint32 MonsterTraceAttack (CBaseMonster@ pMonster, entvars_t@ pevAttacker, float flDamage, Vector vecDir, const TraceResult& in ptr, int bitDamageType)

Call before origin CBaseMonster::TraceAttack called.

StopMode: CALL_ALL

MapScript | Plugin


3.6.7. BreakableKilled

Hooks::Entity const uint32 BreakableKilled (CBaseEntity@ pBreakable, entvars_t@ pevAttacker, int iGib)

Call before origin CBreakable::Die called.

StopMode: CALL_ALL

MapScript | Plugin


3.6.8. BreakableTakeDamage

Hooks::Entity const uint32 BreakableTakeDamage (DamageInfo@ info)

Call before origin CBreakable::TakeDamage called.

StopMode: CALL_ALL

MapScript | Plugin


3.6.9. BreakableTraceAttack

Hooks::Monster const uint32 MonsterTraceAttack (CBaseEntity@ pBreakable, entvars_t@ pevAttacker, float flDamage, Vector vecDir, const TraceResult& in ptr, int bitDamageType)

Call before origin CBreakable::TraceAttack called.

Notice that player died will call this hook, because player is monster too.

StopMode: CALL_ALL

MapScript | Plugin


3.6.10. PlayerPostTakeDamage

Hooks::Player const uint32 PlayerPostTakeDamage (DamageInfo@ info)

Call after origin CBasePlayer::TakeDamage called.

StopMode: CALL_ALL

MapScript | Plugin


3.6.11. PlayerTakeHealth

Hooks::Player const uint32 PlayerTakeHealth (HealthInfo@ info)

Call after origin CBasePlayer::TakeHealth called.

StopMode: CALL_ALL

MapScript | Plugin


3.6.12. PlayerCallMedic

Hooks::Player const uint32 PlayerCallMedic (CBasePlayer@ pPlayer)

Call before "Medic!!!!"

StopMode: CALL_ALL

MapScript | Plugin


3.6.13. PlayerCallGrenade

Hooks::Player const uint32 PlayerCallGrenade (CBasePlayer@ pPlayer)

Call before "Take Cover!!!!"

StopMode: CALL_ALL

MapScript | Plugin


3.6.14. PlayerUserInfoChanged

Hooks::Player const uint32 PlayerUserInfoChanged (CBasePlayer@ pClient, string szInfoBuffer, uint&out uiFlag)

Call before player userinfo changed (e.g: name change)

will block original call if uiFlag not 0

StopMode: CALL_ALL

MapScript | Plugin


3.6.15. GrappleGetMonsterType

Hooks::Weapon const uint32 GrappleGetMonsterType (CBaseEntity@ pThis, CBaseEntity@ pEntity, uint& out flag)

Pre call before Weapon Grapple checking monster type

No more hardcoded grapple, yay!

out return value:

value result
1 pull monster to player
2 pull player to monster
other use default

StopMode: CALL_ALL

MapScript | Plugin


3.6.16. SendScoreInfo

Hooks::Player const uint32 SendScoreInfo (CBasePlayer@ pPlayer, edict_t@ pTarget, int iTeamID, string szTeamName, uint& out flag)

Pre call before sending hud info to edict

will block original call if out value not 0.

StopMode: CALL_ALL

MapScript | Plugin


asexthook's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

mikk155

asexthook's Issues

MonsterTraceAttack() missing Vector vecDir.

Using this as map script:

class classname : ScriptBaseMonsterEntity
{
	~classname()
	{
		g_Hooks.RegisterHook( Hooks::Monster::MonsterTraceAttack, MonsterTraceAttackHook( this.MonsterTraceAttack ) );
	}

	HookReturnCode MonsterTraceAttack( CBaseMonster@ pMonster, entvars_t@ pevAttacker, float flDamage, Vector vecDir, const TraceResult& in ptr, int bitsDamageType )
	{
		return HOOK_CONTINUE;
	}
}

Result:

No matching signatures to 'HookReturnCode MonsterTraceAttackHook(CBaseMonster@, entvars_t@, float, const TraceResult&in, int)'

Unnecessary linux library dependencies

Why have you made the newer versions depended on libraries that are not even needed? This means it doesn't work with freshly installed Linux out of the box any longer without having to install those libraries needed to run the plugin.
image
vAlpha6:
image

Doc Gen Updated

I've made two changes to the docs generator:

  1. Fixed an issue with Function Defs linking to the Typedefs page instead.
  2. Fixed ScriptBases being defined as Interfaces instead of Classes.
    You might want regenerate the docs with said changes. ๐Ÿ™‚

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.