VScripts: Cleaning some more code.
This commit is contained in:
parent
3e0b6eba5b
commit
d4378f6476
@ -589,35 +589,27 @@ public void math_counter_11288_display(const char[] output, int caller, int acti
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void Display(int amount)
|
||||
public void Display(int iTimer)
|
||||
{
|
||||
float fOrigin[3];
|
||||
fOrigin[0] = 0.0;
|
||||
fOrigin[1] = 0.0;
|
||||
fOrigin[2] = 0.0;
|
||||
|
||||
int iRelay = CreateEntityAtOrigin("logic_relay", fOrigin);
|
||||
int iRelay = CreateEntityByName("logic_relay");
|
||||
DispatchKeyFormat(iRelay, "targetname", "vscript_countdown_relay");
|
||||
DispatchKeyFormat(iRelay, "spawnflags", "0");
|
||||
DispatchKeyFormat(iRelay, "OnTrigger", "seconds_left,AddOutput,message seconds left,0,-1");
|
||||
DispatchKeyFormat(iRelay, "OnTrigger", "text_sec,AddOutput,message %d,0,-1", amount - 1);
|
||||
DispatchKeyFormat(iRelay, "OnSpawn", "seconds_left,AddOutput,message seconds left,0,-1");
|
||||
DispatchKeyFormat(iRelay, "OnSpawn", "text_sec,AddOutput,message %d,0,-1", iTimer - 1);
|
||||
|
||||
int iBackup = amount;
|
||||
|
||||
for (int j = 0; j <= amount; j++)
|
||||
int iBackup = iTimer;
|
||||
for (int j = 0; j <= iTimer; j++)
|
||||
{
|
||||
iBackup--;
|
||||
DispatchKeyFormat(iRelay, "OnTrigger", "text_sec,AddOutput,message %d,%d,-1", iBackup, j);
|
||||
DispatchKeyFormat(iRelay, "OnTrigger", "seconds_left,Display,,%d,-1",j);
|
||||
DispatchKeyFormat(iRelay, "OnTrigger", "text_sec,Display,,%d,-1",j);
|
||||
DispatchKeyFormat(iRelay, "OnSpawn", "text_sec,AddOutput,message %d,%d,-1", iBackup, j);
|
||||
DispatchKeyFormat(iRelay, "OnSpawn", "seconds_left,Display,,%d,-1", j);
|
||||
DispatchKeyFormat(iRelay, "OnSpawn", "text_sec,Display,,%d,-1", j);
|
||||
}
|
||||
|
||||
DispatchKeyFormat(iRelay, "OnTrigger", "seconds_left,AddOutput,message ,%d,-1",amount + 1);
|
||||
DispatchKeyFormat(iRelay, "OnTrigger", "text_sec,AddOutput,message ,%d,-1",amount + 1);
|
||||
DispatchKeyFormat(iRelay, "OnTrigger", "!self,Kill,,%d,-1",amount + 2);
|
||||
|
||||
DispatchKeyFormat(iRelay, "OnSpawn", "seconds_left,AddOutput,message ,%d,-1", iTimer + 1);
|
||||
DispatchKeyFormat(iRelay, "OnSpawn", "text_sec,AddOutput,message ,%d,-1", iTimer + 1);
|
||||
DispatchKeyFormat(iRelay, "OnSpawn", "!self,Kill,,%d,-1", iTimer + 2);
|
||||
SpawnAndActivate(iRelay);
|
||||
AcceptEntityInput(iRelay, "Trigger");
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -659,18 +651,6 @@ public int FindEntityByHammerID(int iHammerID)
|
||||
return INVALID_ENT_REFERENCE;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
stock int CreateEntityAtOrigin(const char[] classname, const float origin[3])
|
||||
{
|
||||
int entity = CreateEntityByName(classname);
|
||||
|
||||
TeleportEntity(entity, origin, NULL_VECTOR, NULL_VECTOR);
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user