Clean up armoury_entity, func_bomb_target, func_buyzone, func_escapezone, func_hostage_rescue, info_buyzone, info_hostage_rescue, info_map_parameter and item_suit.
This commit is contained in:
parent
cd01daac6a
commit
e9e49ab216
9 changed files with 172 additions and 118 deletions
|
@ -104,6 +104,7 @@ class armoury_entity:NSRenderableEntity
|
|||
int m_iID;
|
||||
|
||||
void(void) armoury_entity;
|
||||
virtual void(void) Spawned;
|
||||
virtual void(float) Save;
|
||||
virtual void(string,string) Restore;
|
||||
virtual void(entity) Touch;
|
||||
|
@ -113,18 +114,25 @@ class armoury_entity:NSRenderableEntity
|
|||
|
||||
void
|
||||
armoury_entity::armoury_entity(void)
|
||||
{
|
||||
m_iID = 0;
|
||||
m_iCount = 1;
|
||||
m_iLeft = 0;
|
||||
}
|
||||
|
||||
void
|
||||
armoury_entity::Spawned(void)
|
||||
{
|
||||
if (autocvar_fcs_nopickups == TRUE) {
|
||||
Destroy();
|
||||
return;
|
||||
}
|
||||
|
||||
super::Spawned();
|
||||
|
||||
precache_model(g_cstrike_armourymodels[m_iID]);
|
||||
precache_sound("items/gunpickup2.wav");
|
||||
precache_sound("items/tr_kevlar.wav");
|
||||
|
||||
m_iID = 0;
|
||||
m_iCount = 1;
|
||||
m_iLeft = 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -196,18 +204,20 @@ armoury_entity::Touch(entity eToucher)
|
|||
m_iLeft--;
|
||||
|
||||
if (m_iLeft <= 0) {
|
||||
Hide();
|
||||
Disappear();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
armoury_entity::Respawn(void)
|
||||
{
|
||||
SetOrigin(GetSpawnOrigin());
|
||||
SetSolid(SOLID_TRIGGER);
|
||||
SetModel(g_cstrike_armourymodels[m_iID]);
|
||||
SetSize([-16,-16,0], [16,16,16]);
|
||||
SetSolid(SOLID_TRIGGER);
|
||||
m_iLeft = m_iCount;
|
||||
DropToFloor();
|
||||
|
||||
m_iLeft = m_iCount;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -221,7 +231,7 @@ armoury_entity::SpawnKey(string strKey, string strValue)
|
|||
m_iID = stoi(strValue);
|
||||
|
||||
if (m_iID < 0 || m_iID >= 19) {
|
||||
print(sprintf("^1armoury_entity with invalid item %i. ignoring\n", m_iID));
|
||||
NSLog("^1armoury_entity with invalid item %i. ignoring\n", m_iID);
|
||||
Destroy();
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -27,7 +27,8 @@ Used in the bomb defusal mode (de_* maps).
|
|||
Once the bomb explodes inside this volume, it'll trigger its targets.
|
||||
*/
|
||||
|
||||
class func_bomb_target:NSBrushTrigger
|
||||
class
|
||||
func_bomb_target:NSBrushTrigger
|
||||
{
|
||||
void(void) func_bomb_target;
|
||||
|
||||
|
@ -35,10 +36,23 @@ class func_bomb_target:NSBrushTrigger
|
|||
virtual void(entity) Touch;
|
||||
};
|
||||
|
||||
void
|
||||
func_bomb_target::func_bomb_target(void)
|
||||
{
|
||||
g_cs_bombzones++;
|
||||
}
|
||||
|
||||
void
|
||||
func_bomb_target::Respawn(void)
|
||||
{
|
||||
InitBrushTrigger();
|
||||
}
|
||||
|
||||
void
|
||||
func_bomb_target::Touch(entity eToucher)
|
||||
{
|
||||
player pl = (player)eToucher;
|
||||
|
||||
if (!(eToucher.flags & FL_CLIENT)) {
|
||||
return;
|
||||
}
|
||||
|
@ -49,15 +63,3 @@ func_bomb_target::Touch(entity eToucher)
|
|||
|
||||
pl.gflags |= GF_BOMBZONE;
|
||||
}
|
||||
|
||||
void
|
||||
func_bomb_target::Respawn(void)
|
||||
{
|
||||
InitBrushTrigger();
|
||||
}
|
||||
|
||||
void
|
||||
func_bomb_target::func_bomb_target(void)
|
||||
{
|
||||
g_cs_bombzones++;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,8 @@ Choices for 'team' include:
|
|||
2 = Counter-Terrorist
|
||||
*/
|
||||
|
||||
class func_buyzone:NSBrushTrigger
|
||||
class
|
||||
func_buyzone:NSBrushTrigger
|
||||
{
|
||||
void(void) func_buyzone;
|
||||
|
||||
|
@ -49,14 +50,8 @@ class func_buyzone:NSBrushTrigger
|
|||
};
|
||||
|
||||
void
|
||||
func_buyzone::Touch(entity eToucher)
|
||||
func_buyzone::func_buyzone(void)
|
||||
{
|
||||
player pl = (player)eToucher;
|
||||
if (!(eToucher.flags & FL_CLIENT))
|
||||
return;
|
||||
|
||||
if (team == 0 || team == pl.team)
|
||||
pl.gflags |= GF_BUYZONE;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -66,8 +61,13 @@ func_buyzone::Respawn(void)
|
|||
}
|
||||
|
||||
void
|
||||
func_buyzone::func_buyzone(void)
|
||||
func_buyzone::Touch(entity eToucher)
|
||||
{
|
||||
NSBrushTrigger::NSBrushTrigger();
|
||||
InitBrushTrigger();
|
||||
player pl = (player)eToucher;
|
||||
|
||||
if (!(eToucher.flags & FL_CLIENT))
|
||||
return;
|
||||
|
||||
if (team == 0 || team == pl.team)
|
||||
pl.gflags |= GF_BUYZONE;
|
||||
}
|
||||
|
|
|
@ -26,10 +26,19 @@ Terrorist escape zone.
|
|||
Used in the Escape mode (es_* maps).
|
||||
*/
|
||||
|
||||
class func_escapezone:NSBrushTrigger
|
||||
class
|
||||
func_escapezone:NSBrushTrigger
|
||||
{
|
||||
void(void) func_escapezone;
|
||||
|
||||
virtual void(void) Respawn;
|
||||
};
|
||||
};
|
||||
|
||||
void
|
||||
func_escapezone::func_escapezone(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
func_escapezone::Respawn(void)
|
||||
|
|
|
@ -28,14 +28,26 @@ If neither a func_hostage_rescue or a info_hostage_rescue is placed,
|
|||
zones will be placed in Counter-Terrorist player spawn nodes automatically.
|
||||
*/
|
||||
|
||||
class func_hostage_rescue:NSBrushTrigger
|
||||
class
|
||||
func_hostage_rescue:NSBrushTrigger
|
||||
{
|
||||
void(void) func_hostage_rescue;
|
||||
|
||||
virtual void(entity) Touch;
|
||||
virtual void(void) Respawn;
|
||||
virtual void(entity) Touch;
|
||||
};
|
||||
|
||||
void
|
||||
func_hostage_rescue::func_hostage_rescue(void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
func_hostage_rescue::Respawn(void)
|
||||
{
|
||||
InitBrushTrigger();
|
||||
}
|
||||
|
||||
void
|
||||
func_hostage_rescue::Touch(entity eToucher)
|
||||
{
|
||||
|
@ -51,7 +63,7 @@ func_hostage_rescue::Touch(entity eToucher)
|
|||
|
||||
hostage_entity hosty = (hostage_entity)eToucher;
|
||||
|
||||
if (hosty.solid == SOLID_NOT) {
|
||||
if (hosty.GetSolid() == SOLID_NOT) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -68,18 +80,5 @@ func_hostage_rescue::Touch(entity eToucher)
|
|||
* bonus for every hostage that was rescued, even if they lose the round. */
|
||||
Money_QueTeamReward(TEAM_CT, 850);
|
||||
|
||||
hosty.Hide();
|
||||
}
|
||||
|
||||
void
|
||||
func_hostage_rescue::Respawn(void)
|
||||
{
|
||||
InitBrushTrigger();
|
||||
}
|
||||
|
||||
void
|
||||
func_hostage_rescue::func_hostage_rescue(void)
|
||||
{
|
||||
NSBrushTrigger::NSBrushTrigger();
|
||||
InitBrushTrigger();
|
||||
hosty.Disappear();
|
||||
}
|
||||
|
|
|
@ -25,26 +25,36 @@ Buy zone.
|
|||
See func_buyzone for more information.
|
||||
*/
|
||||
|
||||
class info_buyzone
|
||||
class
|
||||
info_buyzone:NSPointTrigger
|
||||
{
|
||||
void(void) info_buyzone;
|
||||
virtual void(void) touch;
|
||||
|
||||
virtual void(void) Respawn;
|
||||
virtual void(entity) Touch;
|
||||
};
|
||||
|
||||
void
|
||||
info_buyzone::touch(void)
|
||||
info_buyzone::info_buyzone(void)
|
||||
{
|
||||
player pl = (player)other;
|
||||
if (!(other.flags & FL_CLIENT))
|
||||
}
|
||||
|
||||
void
|
||||
info_buyzone::Respawn(void)
|
||||
{
|
||||
SetSolid(SOLID_TRIGGER);
|
||||
SetSize([-128,-128,-128], [128,128,128]);
|
||||
SetOrigin(GetSpawnOrigin());
|
||||
}
|
||||
|
||||
void
|
||||
info_buyzone::Touch(entity eToucher)
|
||||
{
|
||||
player pl = (player)eToucher;
|
||||
|
||||
if (!(eToucher.flags & FL_CLIENT))
|
||||
return;
|
||||
|
||||
if (team == 0 || team == pl.team)
|
||||
pl.gflags |= GF_BUYZONE;
|
||||
}
|
||||
|
||||
void
|
||||
info_buyzone::info_buyzone(void)
|
||||
{
|
||||
solid = SOLID_TRIGGER;
|
||||
setsize(this, [-128,-128,-128], [128,128,128]);
|
||||
}
|
||||
|
|
|
@ -29,28 +29,43 @@ If neither a info_hostage_rescue or a func_hostage_rescue is placed,
|
|||
zones will be placed in Counter-Terrorist player spawn nodes automatically.
|
||||
*/
|
||||
|
||||
class info_hostage_rescue
|
||||
class info_hostage_rescue:NSPointTrigger
|
||||
{
|
||||
void(void) info_hostage_rescue;
|
||||
virtual void(void) touch;
|
||||
|
||||
virtual void(void) Respawn;
|
||||
virtual void(entity) Touch;
|
||||
};
|
||||
|
||||
void
|
||||
info_hostage_rescue::touch(void)
|
||||
info_hostage_rescue::info_hostage_rescue(void)
|
||||
{
|
||||
if (other.flags & FL_CLIENT) {
|
||||
player pl = (player)other;
|
||||
}
|
||||
|
||||
void
|
||||
info_hostage_rescue::Respawn(void)
|
||||
{
|
||||
SetSolid(SOLID_TRIGGER);
|
||||
SetSize([-128,-128,-128], [128,128,128]);
|
||||
SetOrigin(GetSpawnOrigin());
|
||||
}
|
||||
|
||||
void
|
||||
info_hostage_rescue::Touch(entity eToucher)
|
||||
{
|
||||
if (eToucher.flags & FL_CLIENT) {
|
||||
player pl = (player)eToucher;
|
||||
pl.gflags |= GF_RESCUEZONE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (other.classname != "hostage_entity") {
|
||||
if (eToucher.classname != "hostage_entity") {
|
||||
return;
|
||||
}
|
||||
|
||||
NSTalkMonster hosty = (NSTalkMonster)other;
|
||||
|
||||
if (hosty.solid == SOLID_NOT) {
|
||||
if (hosty.GetSolid() == SOLID_NOT) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -67,13 +82,5 @@ info_hostage_rescue::touch(void)
|
|||
/* In Hostage Rescue, all Counter-Terrorists receive an $850
|
||||
* bonus for every hostage they rescue, even if they lose the round. */
|
||||
Money_QueTeamReward(TEAM_CT, 850);
|
||||
|
||||
hosty.Hide();
|
||||
}
|
||||
|
||||
void
|
||||
info_hostage_rescue::info_hostage_rescue(void)
|
||||
{
|
||||
solid = SOLID_TRIGGER;
|
||||
setsize(this, [-128,-128,-128], [128,128,128]);
|
||||
hosty.Disappear();
|
||||
}
|
||||
|
|
|
@ -32,40 +32,52 @@ Choices for 'buying':
|
|||
3 = Neither Counter-Terrorists nor Terrorists can buy items
|
||||
*/
|
||||
|
||||
enum
|
||||
typedef enum
|
||||
{
|
||||
BUY_BOTH,
|
||||
BUY_CT,
|
||||
BUY_T,
|
||||
BUY_NEITHER
|
||||
};
|
||||
} imp_buyrules_t;
|
||||
|
||||
class info_map_parameters:NSEntity
|
||||
class
|
||||
info_map_parameters:NSEntity
|
||||
{
|
||||
float m_flBombRadius;
|
||||
imp_buyrules_t m_buyRules;
|
||||
|
||||
void(void) info_map_parameters;
|
||||
|
||||
virtual void(void) Respawn;
|
||||
virtual void(string, string) SpawnKey;
|
||||
};
|
||||
|
||||
void
|
||||
info_map_parameters::info_map_parameters(void)
|
||||
{
|
||||
m_flBombRadius = 500;
|
||||
m_buyRules = BUY_BOTH;
|
||||
}
|
||||
|
||||
void
|
||||
info_map_parameters::Respawn(void)
|
||||
{
|
||||
g_cstrike_buying = m_buyRules;
|
||||
g_cstrike_bombradius = m_flBombRadius;
|
||||
}
|
||||
|
||||
void
|
||||
info_map_parameters::SpawnKey(string strKey, string strValue)
|
||||
{
|
||||
switch (strKey) {
|
||||
case "buying":
|
||||
g_cstrike_buying = stoi(strValue);
|
||||
breakpoint();
|
||||
m_buyRules = stoi(strValue);
|
||||
break;
|
||||
case "bombradius":
|
||||
g_cstrike_bombradius = stof(strValue);
|
||||
m_flBombRadius = stof(strValue);
|
||||
break;
|
||||
default:
|
||||
super::SpawnKey(strKey, strValue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
info_map_parameters:: info_map_parameters(void)
|
||||
{
|
||||
super::NSEntity();
|
||||
}
|
||||
}
|
|
@ -20,8 +20,36 @@ class item_suit:NSRenderableEntity
|
|||
|
||||
virtual void(entity) Touch;
|
||||
virtual void(void) Respawn;
|
||||
virtual void(void) Spawned;
|
||||
};
|
||||
|
||||
void
|
||||
item_suit::item_suit(void)
|
||||
{
|
||||
/* a custom map may choose to override this */
|
||||
model = "models/w_kevlar.mdl";
|
||||
}
|
||||
|
||||
void
|
||||
item_suit::Spawned(void)
|
||||
{
|
||||
super::Spawned();
|
||||
|
||||
precache_model(model);
|
||||
precache_sound("items/tr_kevlar.wav");
|
||||
}
|
||||
|
||||
void
|
||||
item_suit::Respawn(void)
|
||||
{
|
||||
SetSolid(SOLID_TRIGGER);
|
||||
SetMovetype(MOVETYPE_TOSS);
|
||||
SetModel(GetSpawnModel());
|
||||
SetSize(VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
SetOrigin(GetSpawnOrigin());
|
||||
ReleaseThink();
|
||||
}
|
||||
|
||||
void
|
||||
item_suit::Touch(entity eToucher)
|
||||
{
|
||||
|
@ -41,32 +69,9 @@ item_suit::Touch(entity eToucher)
|
|||
UseTargets(eToucher, TRIG_TOGGLE, m_flDelay);
|
||||
|
||||
if (cvar("sv_playerslots") == 1) {
|
||||
remove(self);
|
||||
Destroy();
|
||||
} else {
|
||||
Hide();
|
||||
think = Respawn;
|
||||
nextthink = time + 30.0f;
|
||||
Disappear();
|
||||
ScheduleThink(Respawn, 30.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
item_suit::Respawn(void)
|
||||
{
|
||||
SetSolid(SOLID_TRIGGER);
|
||||
SetMovetype(MOVETYPE_TOSS);
|
||||
SetSize(VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
SetOrigin(GetSpawnOrigin());
|
||||
SetModel(GetSpawnModel());
|
||||
|
||||
think = __NULL__;
|
||||
nextthink = -1;
|
||||
}
|
||||
|
||||
void
|
||||
item_suit::item_suit(void)
|
||||
{
|
||||
model = "models/w_kevlar.mdl";
|
||||
precache_sound("items/tr_kevlar.wav");
|
||||
NSRenderableEntity::NSRenderableEntity();
|
||||
Respawn();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue