- self.origin_x = ReadCoord();
- self.origin_y = ReadCoord();
- self.origin_z = ReadCoord();
- setorigin(self, self.origin);
- self.oldorigin = self.origin;
+ this.origin_x = ReadCoord();
+ this.origin_y = ReadCoord();
+ this.origin_z = ReadCoord();
+ setorigin(this, this.origin);
+ this.oldorigin = this.origin;
- self.angles_x = ReadAngle();
- self.angles_y = ReadAngle();
- self.angles_z = ReadAngle();
- self.move_angles = self.angles;
+ this.angles_x = ReadAngle();
+ this.angles_y = ReadAngle();
+ this.angles_z = ReadAngle();
+ this.move_angles = this.angles;
- self.drawmask = MASK_NORMAL;
- self.move_movetype = MOVETYPE_TOSS;
- self.draw = ItemDraw;
- self.solid = SOLID_TRIGGER;
- //self.move_flags |= FL_ITEM;
+ this.drawmask = MASK_NORMAL;
+ this.move_movetype = MOVETYPE_TOSS;
+ this.draw = ItemDraw;
+ this.solid = SOLID_TRIGGER;
+ //this.move_flags |= FL_ITEM;
- self.fade_end = ReadShort();
- self.fade_start = ReadShort();
- if(self.fade_start && !autocvar_cl_items_nofade)
- setpredraw(self, Item_PreDraw);
+ this.fade_end = ReadShort();
+ this.fade_start = ReadShort();
+ if(this.fade_start && !autocvar_cl_items_nofade)
+ setpredraw(this, Item_PreDraw);
- if(self.mdl == "")
- LOG_TRACE("^1WARNING!^7 self.mdl is unset for item ", self.classname, ", tell tZork about this!\n");
+ if(this.mdl == "")
+ LOG_TRACE("^1WARNING!^7 this.mdl is unset for item ", this.classname, ", tell tZork about this!\n");
- precache_model(self.mdl);
- _setmodel(self, self.mdl);
+ precache_model(this.mdl);
+ _setmodel(this, this.mdl);
- self.gravity = 1;
- self.pushable = true;
- //self.move_angles = '0 0 0';
- self.move_movetype = MOVETYPE_TOSS;
- self.move_velocity_x = ReadCoord();
- self.move_velocity_y = ReadCoord();
- self.move_velocity_z = ReadCoord();
- self.velocity = self.move_velocity;
- self.move_origin = self.oldorigin;
-
- if(!self.move_time)
+ this.gravity = 1;
+ this.pushable = true;
+ //this.move_angles = '0 0 0';
+ this.move_movetype = MOVETYPE_TOSS;
+ this.move_velocity_x = ReadCoord();
+ this.move_velocity_y = ReadCoord();
+ this.move_velocity_z = ReadCoord();
+ this.velocity = this.move_velocity;
+ this.move_origin = this.oldorigin;
+
+ if(!this.move_time)
self.nextthink = time;
//Send_Effect(EFFECT_ITEM_RESPAWN, self.origin + self.mins_z * '0 0 1' + '0 0 48', '0 0 0', 1);
Send_Effect(EFFECT_ITEM_RESPAWN, CENTER_OR_VIEWOFS(self), '0 0 0', 1);
}
self.nextthink = time;
//Send_Effect(EFFECT_ITEM_RESPAWN, self.origin + self.mins_z * '0 0 1' + '0 0 48', '0 0 0', 1);
Send_Effect(EFFECT_ITEM_RESPAWN, CENTER_OR_VIEWOFS(self), '0 0 0', 1);
}
- setself(self.waypointsprite_attached);
- FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
- if(self.waypointsprite_visible_for_player(it))
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), {
+ if(self.waypointsprite_attached.waypointsprite_visible_for_player(self.waypointsprite_attached, it, it))
{
msg_entity = it;
soundto(MSG_ONE, this, CH_TRIGGER, SND(ITEMRESPAWNCOUNTDOWN), VOL_BASE, ATTEN_NORM); // play respawn sound
}
{
msg_entity = it;
soundto(MSG_ONE, this, CH_TRIGGER, SND(ITEMRESPAWNCOUNTDOWN), VOL_BASE, ATTEN_NORM); // play respawn sound
}
WaypointSprite_Ping(self.waypointsprite_attached);
//WaypointSprite_UpdateHealth(self.waypointsprite_attached, self.count);
WaypointSprite_Ping(self.waypointsprite_attached);
//WaypointSprite_UpdateHealth(self.waypointsprite_attached, self.count);
- if (Item_ItemsTime_Allow(e.itemdef) || e.weapons & WEPSET_SUPERWEAPONS)
+ // if the respawn time is longer than 10 seconds, show a waypoint, otherwise, just respawn normally
+ if ((Item_ItemsTime_Allow(e.itemdef) || e.weapons & WEPSET_SUPERWEAPONS) && (t - ITEM_RESPAWN_TICKS) > 0)
e.nextthink = time + max(0, t - ITEM_RESPAWN_TICKS);
e.scheduledrespawntime = e.nextthink + ITEM_RESPAWN_TICKS;
e.count = 0;
e.nextthink = time + max(0, t - ITEM_RESPAWN_TICKS);
e.scheduledrespawntime = e.nextthink + ITEM_RESPAWN_TICKS;
e.count = 0;
if(w & (it.m_wepset))
{
W_DropEvent(wr_pickup, player, it.m_id, item);
W_GiveWeapon(player, it.m_id);
}
if(w & (it.m_wepset))
{
W_DropEvent(wr_pickup, player, it.m_id, item);
W_GiveWeapon(player, it.m_id);
}
// remove the item if it's currnetly in a NODROP brush or hits a NOIMPACT surface (such as sky)
if (this.classname == "droppedweapon")
// remove the item if it's currnetly in a NODROP brush or hits a NOIMPACT surface (such as sky)
if (this.classname == "droppedweapon")
other.last_pickup = time;
Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(this), '0 0 0', 1);
other.last_pickup = time;
Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(this), '0 0 0', 1);
- _sound (other, CH_TRIGGER, (this.item_pickupsound ? this.item_pickupsound : Sound_fixpath(this.item_pickupsound_ent)), VOL_BASE, ATTEN_NORM);
+ _sound (other, (this.itemdef.instanceOfPowerup ? CH_TRIGGER_SINGLE : CH_TRIGGER), (this.item_pickupsound ? this.item_pickupsound : Sound_fixpath(this.item_pickupsound_ent)), VOL_BASE, ATTEN_NORM);
if(wasfreed(self) || !self) { return; }
Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(self), '0 0 0', 1);
remove(self);
if(wasfreed(self) || !self) { return; }
Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(self), '0 0 0', 1);
remove(self);
// TODO: figure out if the player even has the weapon this ammo is for?
// may not affect strategy much though...
// TODO: figure out if the player even has the weapon this ammo is for?
// may not affect strategy much though...
void Item_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
{
if(ITEM_DAMAGE_NEEDKILL(deathtype))
void Item_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
{
if(ITEM_DAMAGE_NEEDKILL(deathtype))
}
void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter)
}
void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter)
this.movetype = MOVETYPE_TOSS;
// Savage: remove thrown items after a certain period of time ("garbage collection")
this.movetype = MOVETYPE_TOSS;
// Savage: remove thrown items after a certain period of time ("garbage collection")
- for(entity otheritem = findradius(this.origin, 3); otheritem; otheritem = otheritem.chain)
- {
- // why not flags & fl_item?
- if(otheritem.is_item)
- {
- LOG_TRACE("XXX Found duplicated item: ", itemname, vtos(this.origin));
- LOG_TRACE(" vs ", otheritem.netname, vtos(otheritem.origin), "\n");
- error("Mapper sucks.");
- }
- }
+ // why not flags & fl_item?
+ FOREACH_ENTITY_RADIUS(this.origin, 3, it.is_item, {
+ LOG_TRACE("XXX Found duplicated item: ", itemname, vtos(this.origin));
+ LOG_TRACE(" vs ", it.netname, vtos(it.origin), "\n");
+ error("Mapper sucks.");
+ });
this.bot_pickupbasevalue = pickupbasevalue;
this.mdl = this.model ? this.model : strzone(this.item_model_ent.model_str());
this.netname = itemname;
this.bot_pickupbasevalue = pickupbasevalue;
this.mdl = this.model ? this.model : strzone(this.item_model_ent.model_str());
this.netname = itemname;
setmodel(this, MDL_Null); // precision set below
//this.effects |= EF_LOWPRECISION;
setmodel(this, MDL_Null); // precision set below
//this.effects |= EF_LOWPRECISION;
-void target_items_use()
-{SELFPARAM();
- if(activator.classname == "droppedweapon")
+void target_items_use(entity this, entity actor, entity trigger)
+{
+ other = trigger; // TODO
+
+ if(actor.classname == "droppedweapon")
- if(GiveItems(activator, 0, tokenize_console(self.netname)))
- centerprint(activator, self.message);
+ if(GiveItems(actor, 0, tokenize_console(this.netname)))
+ centerprint(actor, this.message);
if(self.ammo_fuel != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.ammo_fuel), "fuel");
if(self.health != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.health), "health");
if(self.armorvalue != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.armorvalue), "armor");
if(self.ammo_fuel != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.ammo_fuel), "fuel");
if(self.health != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.health), "health");
if(self.armorvalue != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.armorvalue), "armor");
- FOREACH(Weapons, it != WEP_Null, LAMBDA(self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, !!(self.weapons & (it.m_wepset)), it.netname)));
+ FOREACH(Weapons, it != WEP_Null, self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, !!(self.weapons & (it.m_wepset)), it.netname));
}
self.netname = strzone(self.netname);
//print(self.netname, "\n");
}
self.netname = strzone(self.netname);
//print(self.netname, "\n");
- FOREACH(Weapons, it != WEP_Null, LAMBDA(
- if(argv(i) == it.netname)
- {
- it.wr_init(it);
- break;
- }
- ));
+ FOREACH(Weapons, it != WEP_Null && argv(i) == it.netname, {
+ it.wr_init(it);
+ break;
+ });
got += GiveValue(e, health, op, val);
got += GiveValue(e, armorvalue, op, val);
case "allweapons":
got += GiveValue(e, health, op, val);
got += GiveValue(e, armorvalue, op, val);
case "allweapons":
- FOREACH(Weapons, it != WEP_Null, LAMBDA(
- if(!(it.spawnflags & WEP_FLAG_MUTATORBLOCKED))
- got += GiveWeapon(e, it.m_id, op, val);
- ));
+ FOREACH(Weapons, it != WEP_Null && !(it.spawnflags & WEP_FLAG_MUTATORBLOCKED), got += GiveWeapon(e, it.m_id, op, val));
case "allammo":
got += GiveValue(e, ammo_cells, op, val);
got += GiveValue(e, ammo_plasma, op, val);
case "allammo":
got += GiveValue(e, ammo_cells, op, val);
got += GiveValue(e, ammo_plasma, op, val);
got += GiveValue(e, ammo_fuel, op, val);
break;
default:
got += GiveValue(e, ammo_fuel, op, val);
break;
default:
- FOREACH(Weapons, it != WEP_Null, LAMBDA(
- if(cmd == it.netname)
- {
- got += GiveWeapon(e, it.m_id, op, val);
- break;
- }
- ));
+ FOREACH(Weapons, it != WEP_Null && cmd == it.netname, {
+ got += GiveWeapon(e, it.m_id, op, val);
+ break;
+ });
POSTGIVE_BIT(e, items, IT_UNLIMITED_SUPERWEAPONS, SND_POWERUP, SND_POWEROFF);
POSTGIVE_BIT(e, items, IT_UNLIMITED_WEAPON_AMMO, SND_POWERUP, SND_POWEROFF);
POSTGIVE_BIT(e, items, ITEM_Jetpack.m_itemid, SND_ITEMPICKUP, SND_Null);
POSTGIVE_BIT(e, items, IT_UNLIMITED_SUPERWEAPONS, SND_POWERUP, SND_POWEROFF);
POSTGIVE_BIT(e, items, IT_UNLIMITED_WEAPON_AMMO, SND_POWERUP, SND_POWEROFF);
POSTGIVE_BIT(e, items, ITEM_Jetpack.m_itemid, SND_ITEMPICKUP, SND_Null);
POSTGIVE_WEAPON(e, it, SND_WEAPONPICKUP, SND_Null);
if(!(save_weapons & (it.m_wepset)))
if(e.weapons & (it.m_wepset))
it.wr_init(it);
POSTGIVE_WEAPON(e, it, SND_WEAPONPICKUP, SND_Null);
if(!(save_weapons & (it.m_wepset)))
if(e.weapons & (it.m_wepset))
it.wr_init(it);
POSTGIVE_VALUE(e, strength_finished, 1, SND_POWERUP, SND_POWEROFF);
POSTGIVE_VALUE(e, invincible_finished, 1, SND_Shield, SND_POWEROFF);
POSTGIVE_VALUE(e, ammo_nails, 0, SND_ITEMPICKUP, SND_Null);
POSTGIVE_VALUE(e, strength_finished, 1, SND_POWERUP, SND_POWEROFF);
POSTGIVE_VALUE(e, invincible_finished, 1, SND_Shield, SND_POWEROFF);
POSTGIVE_VALUE(e, ammo_nails, 0, SND_ITEMPICKUP, SND_Null);