X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Ftriggers%2Ftrigger%2Fkeylock.qc;h=67db14421662c2d0c40483b328ee3dd30ee6babe;hb=15560a4a494efe42e0e5fa69a628eebc11d97fc7;hp=133397876857999c1eecad47467b8a09fa86e8e1;hpb=8e0690ba978a6a0c7287bc3cfa2873a05b15fc5f;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/triggers/trigger/keylock.qc b/qcsrc/common/triggers/trigger/keylock.qc index 133397876..67db14421 100644 --- a/qcsrc/common/triggers/trigger/keylock.qc +++ b/qcsrc/common/triggers/trigger/keylock.qc @@ -1,3 +1,4 @@ +#include "keylock.qh" /** * trigger given targets */ @@ -15,21 +16,21 @@ void trigger_keylock_kill(string s) { entity t; for(t = NULL; (t = find(t, targetname, s)); ) - remove(t); + delete(t); } -void trigger_keylock_touch(entity this) +void trigger_keylock_touch(entity this, entity toucher) { bool key_used = false; bool started_delay = false; // only player may trigger the lock - if(!IS_PLAYER(other)) + if(!IS_PLAYER(toucher)) return; // check silver key if(this.itemkeys) - key_used = item_keys_usekey(this, other); + key_used = item_keys_usekey(this, toucher); if(this.itemkeys) { @@ -38,16 +39,16 @@ void trigger_keylock_touch(entity this) if(key_used) { // one or more keys were given, but others are still missing! - play2(other, this.noise1); - Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_LOCKED_ALSONEED, item_keys_keylist(this.itemkeys)); - other.key_door_messagetime = time + 2; + play2(toucher, this.noise1); + Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_DOOR_LOCKED_ALSONEED, item_keys_keylist(this.itemkeys)); + toucher.key_door_messagetime = time + 2; } - else if(other.key_door_messagetime <= time) + else if(toucher.key_door_messagetime <= time) { // no keys were given - play2(other, this.noise2); - Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_LOCKED_NEED, item_keys_keylist(this.itemkeys)); - other.key_door_messagetime = time + 2; + play2(toucher, this.noise2); + Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_DOOR_LOCKED_NEED, item_keys_keylist(this.itemkeys)); + toucher.key_door_messagetime = time + 2; } #endif @@ -55,7 +56,7 @@ void trigger_keylock_touch(entity this) if(this.delay <= time || started_delay == true) if(this.target2) { - trigger_keylock_trigger(this, other, this.target2); + trigger_keylock_trigger(this, toucher, this.target2); started_delay = true; this.delay = time + this.wait; } @@ -64,17 +65,17 @@ void trigger_keylock_touch(entity this) { #ifdef SVQC // all keys were given! - play2(other, this.noise); - centerprint(other, this.message); + play2(toucher, this.noise); + centerprint(toucher, this.message); #endif if(this.target) - trigger_keylock_trigger(this, other, this.target); + trigger_keylock_trigger(this, toucher, this.target); if(this.killtarget) trigger_keylock_kill(this.killtarget); - remove(this); + delete(this); } } @@ -121,7 +122,7 @@ message2 and noise2 will be resent to the player every 2 seconds while he is in */ spawnfunc(trigger_keylock) { - if(!this.itemkeys) { remove(this); return; } + if(!this.itemkeys) { delete(this); return; } // set unlocked message if(this.message == "") @@ -163,23 +164,12 @@ spawnfunc(trigger_keylock) #elif defined(CSQC) void keylock_remove(entity this) { - if(this.target) { strunzone(this.target); } - this.target = string_null; - - if(this.target2) { strunzone(this.target2); } - this.target2 = string_null; - - if(this.target3) { strunzone(this.target3); } - this.target3 = string_null; - - if(this.target4) { strunzone(this.target4); } - this.target4 = string_null; - - if(this.killtarget) { strunzone(this.killtarget); } - this.killtarget = string_null; - - if(this.targetname) { strunzone(this.targetname); } - this.targetname = string_null; + strfree(this.target); + strfree(this.target2); + strfree(this.target3); + strfree(this.target4); + strfree(this.killtarget); + strfree(this.targetname); } NET_HANDLE(ENT_CLIENT_KEYLOCK, bool isnew)