X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fitem_key.qc;h=bf389377f726e8fdf0b907d71883a7d7fd7b0dc0;hb=c0da80fe6125a43ee99a90808ac6f9d0ddcf88c8;hp=9688d51db107977f3e2fd42c6f8df036a33a6a81;hpb=35528e99ccad9a20fbd6eed640a5bc1bda884acd;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/item_key.qc b/qcsrc/server/item_key.qc index 9688d51db..bf389377f 100644 --- a/qcsrc/server/item_key.qc +++ b/qcsrc/server/item_key.qc @@ -68,8 +68,8 @@ item_key /** * Key touch handler. */ -void item_key_touch() -{SELFPARAM(); +void item_key_touch(entity this) +{ if (!IS_PLAYER(other)) return; @@ -91,38 +91,38 @@ void item_key_touch() /** * Spawn a key with given model, key code and color. */ -void spawn_item_key() -{SELFPARAM(); - precache_model(self.model); +void spawn_item_key(entity this) +{ + precache_model(this.model); - if (self.spawnflags & 1) // FLOATING - self.noalign = 1; + if (this.spawnflags & 1) // FLOATING + this.noalign = 1; - if (self.noalign) - self.movetype = MOVETYPE_NONE; + if (this.noalign) + this.movetype = MOVETYPE_NONE; else - self.movetype = MOVETYPE_TOSS; + this.movetype = MOVETYPE_TOSS; - precache_sound(self.noise); + precache_sound(this.noise); - self.mdl = self.model; - self.effects = EF_LOWPRECISION; - _setmodel(self, self.model); - //setsize(self, '-16 -16 -24', '16 16 32'); - setorigin(self, self.origin + '0 0 32'); - setsize(self, '-16 -16 -56', '16 16 0'); - self.modelflags |= MF_ROTATE; - self.solid = SOLID_TRIGGER; + this.mdl = this.model; + this.effects = EF_LOWPRECISION; + _setmodel(this, this.model); + //setsize(this, '-16 -16 -24', '16 16 32'); + setorigin(this, this.origin + '0 0 32'); + setsize(this, '-16 -16 -56', '16 16 0'); + this.modelflags |= MF_ROTATE; + this.solid = SOLID_TRIGGER; - if (!self.noalign) + if (!this.noalign) { // first nudge it off the floor a little bit to avoid math errors - setorigin(self, self.origin + '0 0 1'); + setorigin(this, this.origin + '0 0 1'); // note droptofloor returns false if stuck/or would fall too far - droptofloor(); + WITHSELF(this, droptofloor()); } - self.touch = item_key_touch; + settouch(this, item_key_touch); }; @@ -158,14 +158,14 @@ spawnfunc(item_key) vector _colormod; // reject this entity if more than one key was set! - if (self.itemkeys>0 && (self.itemkeys & (self.itemkeys-1)) != 0) { + 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(self); + remove(this); return; } // find default netname and colormod - switch(self.itemkeys) { + switch(this.itemkeys) { case BIT(0): _netname = "GOLD key"; _colormod = '1 .9 0'; @@ -200,9 +200,9 @@ spawnfunc(item_key) _netname = "FLUFFY PINK keycard"; _colormod = '1 1 1'; - if (self.netname == "") { + if (this.netname == "") { objerror("item_key doesn't have a default name for this key and a custom one was not specified!"); - remove(self); + remove(this); return; } break; @@ -211,40 +211,40 @@ spawnfunc(item_key) // find default model string _model = string_null; - if (self.itemkeys <= ITEM_KEY_BIT(2)) { + if (this.itemkeys <= ITEM_KEY_BIT(2)) { _model = "models/keys/key.md3"; - } else if (self.itemkeys >= ITEM_KEY_BIT(3) && self.itemkeys <= ITEM_KEY_BIT(5)) { + } 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 (self.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(self); + remove(this); return; } // set defailt netname - if (self.netname == "") - self.netname = _netname; + if (this.netname == "") + this.netname = _netname; // set default colormod - if (!self.colormod) - self.colormod = _colormod; + if (!this.colormod) + this.colormod = _colormod; // set default model - if (self.model == "") - self.model = _model; + if (this.model == "") + this.model = _model; // set default pickup message - if (self.message == "") - self.message = strzone(strcat("You've picked up the ", self.netname, "!")); + if (this.message == "") + this.message = strzone(strcat("You've picked up the ", this.netname, "!")); - if (self.noise == "") - self.noise = strzone(SND(ITEMPICKUP)); + if (this.noise == "") + this.noise = strzone(SND(ITEMPICKUP)); // save the name for later - item_keys_names[lowestbit(self.itemkeys)] = self.netname; + item_keys_names[lowestbit(this.itemkeys)] = this.netname; // put the key on the map - spawn_item_key(); + spawn_item_key(this); } /*QUAKED item_key1 (0 .5 .8) (-16 -16 -24) (16 16 32) FLOATING