Skip to content

Commit

Permalink
Fix bug where changing maps would crash the game.
Browse files Browse the repository at this point in the history
  • Loading branch information
tunbridgep committed Nov 24, 2022
1 parent fcf8b6f commit b54c4a5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/zsc/Menus/ProfileSelect.zsc
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class OptionMenuItemFlashlightApplyProfile : OptionMenuItemStaticText
SetNight();
EnableStealthMode();
SetStartingItems(false,5);
SetFlareProperties(12,3,3,32);
SetFlareProperties(12,3,3,24);
SetStealthDetection(true,true);
EnableDropFlashlight(0,10);
EnableSpawnFlashlight(10,5);
Expand Down
9 changes: 5 additions & 4 deletions src/zsc/Misc.zsc
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ class FlareRecharger : PermanentItem
int flares_current;
int flares_prev;

override void postBeginPlay()
override void AttachToOwner(Actor other)
{
super.postbeginplay();
charges = owner.CountInv("Flare");
super.AttachToOwner(other);
int max_charges = Math.ClampMax(flashlight_flare_recharge_max_amount,flashlight_flare_max_amount);
charges = max_charges;
}

void PlayRechargeSound()
Expand Down Expand Up @@ -83,7 +84,7 @@ class FlareRecharger : PermanentItem
int max_charges = Math.ClampMax(flashlight_flare_recharge_max_amount,flashlight_flare_max_amount);

bool enabled = flashlight_flare_recharge_enabled;

if (tics == 0 || !enabled)
return;

Expand Down

0 comments on commit b54c4a5

Please sign in to comment.