From b54c4a57bedd0b45f3c62c303ecb165cf5cdd715 Mon Sep 17 00:00:00 2001 From: Paul Tunbridge Date: Wed, 23 Nov 2022 23:55:25 -0800 Subject: [PATCH] Fix bug where changing maps would crash the game. --- src/zsc/Menus/ProfileSelect.zsc | 2 +- src/zsc/Misc.zsc | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/zsc/Menus/ProfileSelect.zsc b/src/zsc/Menus/ProfileSelect.zsc index 2c0930f..9b6bacb 100644 --- a/src/zsc/Menus/ProfileSelect.zsc +++ b/src/zsc/Menus/ProfileSelect.zsc @@ -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); diff --git a/src/zsc/Misc.zsc b/src/zsc/Misc.zsc index e5f50c2..fbaa0f3 100644 --- a/src/zsc/Misc.zsc +++ b/src/zsc/Misc.zsc @@ -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() @@ -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;