cleaning up cubescript hooks

- provide a function to easily assemble and execute the command
- context-selective execution of hooks
- restrict potentially exploitable or harmful hooks to singleplayer-modes
This commit is contained in:
ac-stef
2014-11-12 17:06:35 +01:00
parent 41fd31deed
commit 8604c198e9
10 changed files with 48 additions and 109 deletions
+1 -6
View File
@@ -311,7 +311,6 @@ void pickupeffects(int n, playerent *d)
*/
if(identexists("onPickup"))
{
string o;
itemstat *tmp = NULL;
switch(e.type)
{
@@ -324,11 +323,7 @@ void pickupeffects(int n, playerent *d)
case I_ARMOUR: tmp = &powerupstats[e.type-I_HEALTH]; break;
default: break;
}
if(tmp)
{
formatstring(o)("onPickup %d %d", e.type - 3, m_lss && e.type == I_GRENADE ? 2 : tmp->add);
execute(o);
}
if(tmp) exechook(HOOK_SP, "onPickup", "%d %d", e.type - 3, m_lss && e.type == I_GRENADE ? 2 : tmp->add);
}
}
else audiomgr.playsound(is.sound, d);