From d72d8943153e96a476772844b941613f9594ef46 Mon Sep 17 00:00:00 2001 From: Ava Date: Sat, 1 Apr 2023 04:04:11 -0400 Subject: [PATCH] Tank gauges initialize correctly --- code/game/objects/items/weapons/tanks/tanks.dm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/code/game/objects/items/weapons/tanks/tanks.dm b/code/game/objects/items/weapons/tanks/tanks.dm index a10c1e26f1..9a1454f9a7 100644 --- a/code/game/objects/items/weapons/tanks/tanks.dm +++ b/code/game/objects/items/weapons/tanks/tanks.dm @@ -58,12 +58,17 @@ var/global/list/tank_gauge_cache = list() /obj/item/tank/Initialize() - . = ..() - + ..() src.init_proxy() src.air_contents = new /datum/gas_mixture() src.air_contents.volume = volume //liters src.air_contents.temperature = T20C + return INITIALIZE_HINT_LATELOAD + +/obj/item/tank/LateInitialize() + // Running this in Initialize() won't work for subtypes, which run their own override of Initialize() (for initial contents etc) *after* the base one + // Since air_contents is created in the base init, we can't just move the order of operations either (i.e. for subtypes, calling update_gauge() before the base proc) + // Thus, we defer it to later so that the gauge only updates after everything else is done update_gauge() /obj/item/tank/Destroy()