X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fitem_key.qc;h=05172241c3e320630e3e4fc02321de3ab370c86f;hb=06ac66a5edaa645e19ed9a6482409e8656a65b1d;hp=cbc6f94f4891dbef599c13d1f5f32054e24abc81;hpb=c606e5f848ffb0a2e92d7fb471a9f8b9e3cbfe97;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/item_key.qc b/qcsrc/server/item_key.qc index cbc6f94f4..05172241c 100644 --- a/qcsrc/server/item_key.qc +++ b/qcsrc/server/item_key.qc @@ -68,24 +68,24 @@ item_key /** * Key touch handler. */ -void item_key_touch(entity this) +void item_key_touch(entity this, entity toucher) { - if (!IS_PLAYER(other)) + if (!IS_PLAYER(toucher)) return; // player already picked up this key - if (other.itemkeys & self.itemkeys) + if (toucher.itemkeys & this.itemkeys) return; - other.itemkeys |= self.itemkeys; - play2(other, self.noise); + toucher.itemkeys |= this.itemkeys; + play2(toucher, this.noise); - centerprint(other, self.message); + centerprint(toucher, this.message); - string oldmsg = self.message; - self.message = ""; - SUB_UseTargets(self, other, other); // TODO: should we be using other for the trigger here? - self.message = oldmsg; + string oldmsg = this.message; + this.message = ""; + SUB_UseTargets(this, toucher, toucher); // TODO: should we be using toucher for the trigger here? + this.message = oldmsg; }; /** @@ -99,9 +99,9 @@ void spawn_item_key(entity this) this.noalign = 1; if (this.noalign) - this.movetype = MOVETYPE_NONE; + set_movetype(this, MOVETYPE_NONE); else - this.movetype = MOVETYPE_TOSS; + set_movetype(this, MOVETYPE_TOSS); precache_sound(this.noise); @@ -159,8 +159,8 @@ spawnfunc(item_key) // reject this entity if more than one key was set! if (this.itemkeys>0 && (this.itemkeys & (this.itemkeys-1)) != 0) { - objerror("item_key.itemkeys must contain only 1 bit set specifying the key it represents!"); - remove(this); + objerror(this, "item_key.itemkeys must contain only 1 bit set specifying the key it represents!"); + delete(this); return; } @@ -201,8 +201,8 @@ spawnfunc(item_key) _colormod = '1 1 1'; if (this.netname == "") { - objerror("item_key doesn't have a default name for this key and a custom one was not specified!"); - remove(this); + objerror(this, "item_key doesn't have a default name for this key and a custom one was not specified!"); + delete(this); return; } break; @@ -216,8 +216,8 @@ spawnfunc(item_key) } else if (this.itemkeys >= ITEM_KEY_BIT(3) && this.itemkeys <= ITEM_KEY_BIT(5)) { _model = "models/keys/key.md3"; // FIXME: replace it by a keycard model! } else if (this.model == "") { - objerror("item_key doesn't have a default model for this key and a custom one was not specified!"); - remove(this); + objerror(this, "item_key doesn't have a default model for this key and a custom one was not specified!"); + delete(this); return; }