Author Topic: Why does the damage system use ET_Hook instead of ET_Ignore?  (Read 1084 times)

El Diablo

  • Hero Member
  • *****
  • Posts: 1126
    • View Profile
    • War3Evo
Why does the damage system use ET_Hook instead of ET_Ignore?
« on: April 08, 2015, 09:59:37 AM »
Two links for reference to question:

https://github.com/War3Source/War3Source/blob/master/addons/sourcemod/scripting/War3Source_Engine_DamageSystem.sp#L76

https://github.com/War3Source/War3Source/blob/master/addons/sourcemod/scripting/W3SIncs/War3Source_Events.inc#L32

OnW3TakeDmgAllPre, OnW3TakeDmgBulletPre, OnW3EnemyTakeDmgBulletPre, OnW3TakeDmgAll, and OnW3TakeDmgBullet do not use any Action returns.

Is there a "wait period" between each that needs to be established, and is reason you use ET_Hook or was it old coding that uses this logic?

Since there is no return value for Action, but I do understand there is a return value for War3_DamageModPercent().

Would it be just better to create a Param_FloatByRef and change the value on the function itself instead of using current method?

Please do help me understand your logic behind using ET_Hook.


extra reference:

https://wiki.alliedmods.net/Function_Calling_API_%28SourceMod_Scripting%29
« Last Edit: April 08, 2015, 10:04:32 AM by El Diablo »

Ownz

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2437
  • chmod -R 777 *
    • View Profile
    • OwnageClan
Re: Why does the damage system use ET_Hook instead of ET_Ignore?
« Reply #1 on: April 09, 2015, 05:48:08 PM »
returns are ignored, doesn't matter which hook type you use. there is no particular reason ET_HOOK was used other than copy pasted from other code without too much thought.

Param_FloatByRef could be a viable solution. Players may attempt to set the variable when it is not passed by ref on the post hooks and won't know why its not working. Having a function helps catching that case.

El Diablo

  • Hero Member
  • *****
  • Posts: 1126
    • View Profile
    • War3Evo
Re: Why does the damage system use ET_Hook instead of ET_Ignore?
« Reply #2 on: April 10, 2015, 08:58:44 AM »
I think i might test this one War3Evo, would War3Source accept an update to this system if I change it?  War3Source hasn't been so much going towards "backwards compaitble" when it moved from 1.4 to 2.0.  So, I'm guessing, any major update is not going to be backwards compatible.

Ownz

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2437
  • chmod -R 777 *
    • View Profile
    • OwnageClan
Re: Why does the damage system use ET_Hook instead of ET_Ignore?
« Reply #3 on: April 11, 2015, 02:29:48 PM »
i don't see the major benefit of changing that other than you over-optimizing, and I prefer the error catching functionality of the function call