sound(this, CH_TRIGGER, this.itemdef.m_respawnsound, VOL_BASE, ATTEN_NORM); // play respawn sound
setorigin(this, this.origin);
sound(this, CH_TRIGGER, this.itemdef.m_respawnsound, VOL_BASE, ATTEN_NORM); // play respawn sound
setorigin(this, this.origin);
{
float t = Item_ItemsTime_UpdateTime(this, 0);
Item_ItemsTime_SetTime(this, t);
{
float t = Item_ItemsTime_UpdateTime(this, 0);
Item_ItemsTime_SetTime(this, t);
void Item_ScheduleRespawnIn(entity e, float t)
{
// if the respawn time is longer than 10 seconds, show a waypoint, otherwise, just respawn normally
void Item_ScheduleRespawnIn(entity e, float t)
{
// if the respawn time is longer than 10 seconds, show a waypoint, otherwise, just respawn normally
{
setthink(e, Item_RespawnCountdown);
e.nextthink = time + max(0, t - ITEM_RESPAWN_TICKS);
{
setthink(e, Item_RespawnCountdown);
e.nextthink = time + max(0, t - ITEM_RESPAWN_TICKS);
+
+ if(Item_ItemsTime_Allow(e.itemdef) || (e.weapons & WEPSET_SUPERWEAPONS))
+ {
+ t = Item_ItemsTime_UpdateTime(e, e.scheduledrespawntime);
+ Item_ItemsTime_SetTime(e, t);
+ Item_ItemsTime_SetTimesForAllPlayers();
+ }
}
float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax, float mode)
}
float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax, float mode)
StartItem(this, ITEM_Shells);
}
spawnfunc(item_armor_small)
{
StartItem(this, ITEM_Shells);
}
spawnfunc(item_armor_small)
{
StartItem(this, ITEM_ArmorSmall);
}
spawnfunc(item_armor_medium)
{
StartItem(this, ITEM_ArmorSmall);
}
spawnfunc(item_armor_medium)
{
StartItem(this, ITEM_ArmorMedium);
}
spawnfunc(item_armor_big)
{
StartItem(this, ITEM_ArmorMedium);
}
spawnfunc(item_armor_big)
{
StartItem(this, ITEM_ArmorBig);
}
spawnfunc(item_armor_mega)
{
StartItem(this, ITEM_ArmorBig);
}
spawnfunc(item_armor_mega)
{
StartItem(this, ITEM_ArmorMega);
}
spawnfunc(item_health_small)
{
StartItem(this, ITEM_ArmorMega);
}
spawnfunc(item_health_small)
{
StartItem(this, ITEM_HealthSmall);
}
spawnfunc(item_health_medium)
{
StartItem(this, ITEM_HealthSmall);
}
spawnfunc(item_health_medium)
{
StartItem(this, ITEM_HealthMedium);
}
spawnfunc(item_health_big)
{
StartItem(this, ITEM_HealthMedium);
}
spawnfunc(item_health_big)
{
StartItem(this, ITEM_HealthBig);
}
spawnfunc(item_health_mega)
{
StartItem(this, ITEM_HealthBig);
}
spawnfunc(item_health_mega)
{
- if(!this.strength_finished)
- this.strength_finished = autocvar_g_balance_powerup_strength_time;
- StartItem(this, ITEM_Strength);
+ StartItem(this, ITEM_Strength);
- if(!this.invincible_finished)
- this.invincible_finished = autocvar_g_balance_powerup_invincible_time;
- StartItem(this, ITEM_Shield);
+ StartItem(this, ITEM_Shield);
FOREACH(Weapons, it != WEP_Null, {
s = W_UndeprecateName(argv(j));
if(s == it.netname)
FOREACH(Weapons, it != WEP_Null, {
s = W_UndeprecateName(argv(j));
if(s == it.netname)
if(this.ammo_fuel != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, this.ammo_fuel), "fuel");
if(this.health != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, this.health), "health");
if(this.armorvalue != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, this.armorvalue), "armor");
if(this.ammo_fuel != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, this.ammo_fuel), "fuel");
if(this.health != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, this.health), "health");
if(this.armorvalue != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, this.armorvalue), "armor");
FOREACH(Weapons, it != WEP_Null, this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, !!(this.weapons & (it.m_wepset)), it.netname));
}
this.netname = strzone(this.netname);
FOREACH(Weapons, it != WEP_Null, this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, !!(this.weapons & (it.m_wepset)), it.netname));
}
this.netname = strzone(this.netname);
+bool GiveBuff(entity e, Buff thebuff, int op, int val)
+{
+ bool had_buff = (e.buffs & thebuff.m_itemid);
+ switch(op)
+ {
+ case OP_SET:
+ if(val > 0)
+ e.buffs |= thebuff.m_itemid;
+ else
+ e.buffs &= ~thebuff.m_itemid;
+ break;
+ case OP_MIN:
+ case OP_PLUS:
+ if(val > 0)
+ e.buffs |= thebuff.m_itemid;
+ break;
+ case OP_MAX:
+ if(val <= 0)
+ e.buffs &= ~thebuff.m_itemid;
+ break;
+ case OP_MINUS:
+ if(val > 0)
+ e.buffs &= ~thebuff.m_itemid;
+ break;
+ }
+ bool have_buff = (e.buffs & thebuff.m_itemid);
+ return (had_buff != have_buff);
+}
+
void GiveSound(entity e, float v0, float v1, float t, Sound snd_incr, Sound snd_decr)
{
if(v1 == v0)
void GiveSound(entity e, float v0, float v1, float t, Sound snd_incr, Sound snd_decr)
{
if(v1 == v0)
got += GiveValue(e, armorvalue, op, val);
case "allweapons":
FOREACH(Weapons, it != WEP_Null && !(it.spawnflags & WEP_FLAG_MUTATORBLOCKED), got += GiveWeapon(e, it.m_id, op, val));
got += GiveValue(e, armorvalue, op, val);
case "allweapons":
FOREACH(Weapons, it != WEP_Null && !(it.spawnflags & WEP_FLAG_MUTATORBLOCKED), got += GiveWeapon(e, it.m_id, op, val));
+ //case "allbuffs": // all buffs makes a player god, do not want!
+ //FOREACH(Buffs, it != BUFF_Null, got += GiveBuff(e, it.m_itemid, 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(Buffs, it != BUFF_Null && Buff_UndeprecateName(cmd) == it.m_name,
+ {
+ got += GiveBuff(e, it, op, val);
+ break;
+ });
FOREACH(Weapons, it != WEP_Null && W_UndeprecateName(cmd) == it.netname, {
got += GiveWeapon(e, it.m_id, op, val);
break;
FOREACH(Weapons, it != WEP_Null && W_UndeprecateName(cmd) == it.netname, {
got += GiveWeapon(e, it.m_id, op, val);
break;
- W_SwitchWeapon_Force(e, w_getbestweapon(e, weaponentity), weaponentity);
+ {
+ Weapon wep = w_getbestweapon(e, weaponentity);
+ if(wep != e.(weaponentity).m_switchweapon)
+ W_SwitchWeapon_Force(e, wep, weaponentity);
+ }