Clean up think calls and fix various linking issues with upstream Nuclide.

This commit is contained in:
Marco Cawthorne 2022-12-22 16:11:13 -08:00
parent 269d16eac6
commit 131228db92
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
9 changed files with 21 additions and 76 deletions

View File

@ -27,26 +27,6 @@ Game_RunClientCommand(void)
pl.Physics_Run();
}
/* custom chat packet */
void
SV_SendChat(entity sender, string msg, entity eEnt, float fType)
{
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
WriteByte(MSG_MULTICAST, fType == 0 ? EV_CHAT:EV_CHAT_TEAM);
WriteByte(MSG_MULTICAST, num_for_edict(sender) - 1);
WriteByte(MSG_MULTICAST, sender.team);
WriteString(MSG_MULTICAST, msg);
if (eEnt) {
msg_entity = eEnt;
multicast([0,0,0], MULTICAST_ONE);
} else {
multicast([0,0,0], MULTICAST_ALL);
}
localcmd(sprintf("echo [SERVER] %s: %s\n", sender.netname, msg));
}
/* client cmd overrides happen here */
void
Game_ParseClientCommand(string cmd)
@ -64,18 +44,5 @@ Game_ParseClientCommand(string cmd)
return;
}
if (argv(0) == "say") {
SV_SendChat(self, argv(1), world, 0);
return;
} else if (argv(0) == "say_team") {
entity a;
for (a = world; (a = find(a, ::classname, "player"));) {
if (a.team == self.team) {
SV_SendChat(self, argv(1), a, 1);
}
}
return;
}
clientcommand(self, cmd);
}

View File

@ -159,8 +159,7 @@ TFCDispenser::Replenish(void)
m_iCells += 1;
m_iArmor += 1;
ClampValues();
nextthink = time + 1.0f;
ScheduleThink(Replenish, 1.0f);
}
void
@ -229,8 +228,7 @@ TFCDispenser::Place(player pl)
SetOrigin(pl.origin + (v_forward * 48));
DropToFloor();
think = FinishPlacing;
nextthink = time + 5.0f;
ScheduleThink(FinishPlacing, 5.0f);
real_owner = pl;
colormap = pl.colormap;
@ -243,9 +241,7 @@ TFCDispenser::FinishPlacing(void)
{
env_message_single(real_owner, "#Dispenser_finish");
Sound_Play(this, CHAN_BODY, "engineer.turret_set");
think = Replenish;
nextthink = time + 1.0f;
ScheduleThink(Replenish, 1.0f);
}
void

View File

@ -103,8 +103,7 @@ TFCGameRules::PlayerDeath(NSClientPlayer pp)
pl.SetSolid(SOLID_NOT);
pl.SetMovetype(MOVETYPE_NONE);
pl.think = TFCGameRules_PlayerRespawn;
pl.nextthink = time + 4.0f;
pl.ScheduleThink(TFCGameRules_PlayerRespawn, 4.0f);
/* play the iconic death sound */
Sound_Play(pl, CHAN_VOICE, "player_tfc.death");

View File

@ -253,11 +253,8 @@ info_tfgoal::Touch(entity eToucher)
/* remove? */
if (m_tfgResult & TFRESULT_REMOVE) {
Hide();
if (m_dRespawn) {
think = Respawn;
nextthink = time + m_dRespawn;
}
Disappear();
ScheduleThink(Respawn, m_dRespawn);
}
}
@ -418,17 +415,10 @@ class i_t_g:info_tfgoal
void
i_t_g::Respawn(void)
{
solid = SOLID_BSPTRIGGER;
movetype = MOVETYPE_NONE;
SetSolid(SOLID_BSPTRIGGER);
SetMovetype(MOVETYPE_NONE);
SetModel(GetSpawnModel());
SetOrigin(GetSpawnOrigin());
/* TODO: Investigate instead whether or not we use a trigger texture? */
/*if (substring(model, 0, 1) == "*") { */
SetRenderMode(RM_TRIGGER);
/*} else {
SetRenderMode(RM_NORMAL);
}*/
}
void

View File

@ -124,9 +124,8 @@ item_armor::Touch(entity eToucher)
Sound_Play(this, CHAN_ITEM, "item_armor_tfc.pickup");
/* hide and respawn */
Hide();
think = Respawn;
nextthink = time + m_flRespawnDelay;
Disappear();
ScheduleThink(Respawn, m_flRespawnDelay);
}
void

View File

@ -63,9 +63,8 @@ item_healthkit::Touch(entity eToucher)
Sound_Play(this, CHAN_ITEM, "item_healthkit_tfc.pickup");
/* hide and respawn */
Hide();
think = Respawn;
nextthink = time + m_flRespawnDelay;
Disappear();
ScheduleThink(Respawn, m_flRespawnDelay);
}
void

View File

@ -113,8 +113,7 @@ item_tfgoal::DropReturnable(NSClientPlayer pp)
pl.g_items &= ~ITEM_GOALITEM;
/* return after N secs */
think = TeamOwnerReturns;
nextthink = time + m_flPausetime;
ScheduleThink(TeamOwnerReturns, m_flPausetime);
}
void
@ -153,11 +152,10 @@ item_tfgoal::Touch(entity eToucher)
if (m_iTeamUses != pl.team)
return;
Hide();
Disappear();
pl.g_items |= ITEM_GOALITEM;
m_eActivator = pl;
think = __NULL__;
nextthink = 0.0f;
ReleaseThink();
sound(this, CHAN_ITEM, m_strSound, 1.0f, ATTN_NONE);
@ -214,8 +212,7 @@ item_tfgoal::Respawn(void)
SetSolid(SOLID_TRIGGER);
SetOrigin(GetSpawnOrigin());
m_eActivator = __NULL__;
think = __NULL__;
nextthink = 0.0f;
ReleaseThink();
m_status = GISTATUS_HOME;
SetRenderFX(RFX_GLOWSHELL);

View File

@ -17,7 +17,7 @@
void
TFCSentry::Think(void)
{
nextthink = time + 0.1f;
ScheduleThink(Think 0.1f);
/* searching */
entity t = world;
@ -77,8 +77,7 @@ TFCSentry::Place(NSClientPlayer pl)
SetOrigin(pl.origin + (v_forward * 48));
DropToFloor();
think = FinishPlacing;
nextthink = time + 5.0f;
ScheduleThink(FinishPlacing, 5.0f);
real_owner = pl;
colormap = pl.colormap;
@ -97,8 +96,8 @@ TFCSentry::FinishPlacing(void)
m_eHead.SetSize([-16,-16,0], [16,16,32]);
m_eHead.SetOrigin(GetOrigin() + [0,0,20]);
m_eHead.colormap = colormap;
think = Think;
nextthink = time + 0.1f;
ScheduleThink(Think, 0.1f);
m_state = SENTRY_SEARCHING;
m_flNextIdleSound = time + 5.0f;

View File

@ -75,9 +75,8 @@ TFCTeleporter::Place(player pl)
makevectors([0, pl.v_angle[1], 0]);
SetOrigin(pl.origin + (v_forward * 48));
DropToFloor();
ScheduleThink(FinishPlacing, 5.0f);
think = FinishPlacing;
nextthink = time + 5.0f;
real_owner = pl;
colormap = pl.colormap;