Skip to content

Commit

Permalink
refactor: move var
Browse files Browse the repository at this point in the history
  • Loading branch information
rick-yao committed Dec 26, 2024
1 parent a6d0795 commit c333d7d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 25 deletions.
10 changes: 1 addition & 9 deletions l4d2_tank_draw/scripting/lib/freeze_timer_bomb.sp
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
#define DEFAULT_FREEZE_RADIUS 300.0
#define DEFAULT_FREEZE_TIME 10
#define BEEP_SOUND "weapons/hegrenade/beep.wav"

int iColorBlue[4] = { 0, 128, 255, 192 };

Handle g_hFreezeBombTimer[MAXPLAYERS + 1];
Handle g_hUnfreezeTimer[MAXPLAYERS + 1];
int g_iFreezeBombTicks[MAXPLAYERS + 1];

/**
* Sets or removes a freeze bomb on a player
*
Expand All @@ -17,7 +9,7 @@ int g_iFreezeBombTicks[MAXPLAYERS + 1];
* @param freezeTime Time in seconds to freeze players (default: 10)
* @return True if bomb was set, false if removed or not a valid alive client
*/
stock bool SetPlayerFreezeBomb(int target, int ticks = 8, float radius = DEFAULT_FREEZE_RADIUS, int freezeTime = DEFAULT_FREEZE_TIME)
stock bool SetPlayerFreezeBomb(int target, int ticks = 8, float radius = 300.0, int freezeTime = 10)
{
// Validate target
if (!IsValidAliveClient(target))
Expand Down
12 changes: 11 additions & 1 deletion l4d2_tank_draw/scripting/lib/lib.sp
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,20 @@ Handle g_hDrugTimers[MAXPLAYERS + 1];
int g_iDrugTicks[MAXPLAYERS + 1];
float g_fDrugAngles[20] = { 0.0, 5.0, 10.0, 15.0, 20.0, 25.0, 20.0, 15.0, 10.0, 5.0, 0.0, -5.0, -10.0, -15.0, -20.0, -25.0, -20.0, -15.0, -10.0, -5.0 };

int g_GlowDisabled = 0;
Handle g_hTimeBombTimer[MAXPLAYERS + 1];
int g_iTimeBombTicks[MAXPLAYERS + 1];

Handle g_hFreezeBombTimer[MAXPLAYERS + 1];
Handle g_hUnfreezeTimer[MAXPLAYERS + 1];
int g_iFreezeBombTicks[MAXPLAYERS + 1];

int g_GlowDisabled = 0;

#define REPEAT_TIMER TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE
#define NO_REPEAT_TIMER TIMER_FLAG_NO_MAPCHANGE
#define BEEP_SOUND "weapons/hegrenade/beep.wav"
#define EXPLODE_SOUND "weapons/grenade_launcher/grenadefire/grenade_launcher_explode_1.wav"
#define FREEZE_SOUND "physics/glass/glass_impact_bullet4.wav"

stock void ResetAllTimer()
{
Expand Down
20 changes: 5 additions & 15 deletions l4d2_tank_draw/scripting/lib/timer_bomb.sp
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
// In timebomb.sp
#define DAMAGE_BASE 100
#define DEFAULT_RADIUS 300.0
#define BEEP_SOUND "weapons/hegrenade/beep.wav"
#define EXPLODE_SOUND "weapons/grenade_launcher/grenadefire/grenade_launcher_explode_1.wav"
#define FREEZE_SOUND "physics/glass/glass_impact_bullet4.wav"

// Beam related variables
int g_BeamSprite = -1;
int g_HaloSprite = -1;
int g_ExplosionSprite = -1;

int iColorRed[4] = { 255, 75, 75, 255 };
int g_BeamSprite = -1;
int g_HaloSprite = -1;
int g_ExplosionSprite = -1;

Handle g_hTimeBombTimer[MAXPLAYERS + 1];
int g_iTimeBombTicks[MAXPLAYERS + 1];
int iColorRed[4] = { 255, 75, 75, 255 };

public void OnMapStart()
{
Expand All @@ -35,7 +25,7 @@ public void OnMapStart()
* @param damage Max damage that could be applied to survivor (default: 100)
* @return True if bomb was set, false if removed or not a valid alive client
*/
stock bool SetPlayerTimeBomb(int target, int ticks = 5, float radius = DEFAULT_RADIUS, int damage = DAMAGE_BASE)
stock bool SetPlayerTimeBomb(int target, int ticks = 5, float radius = 300.0, int damage = 100)
{
// Validate target
if (!IsValidAliveClient(target))
Expand Down

0 comments on commit c333d7d

Please sign in to comment.