mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-19 12:05:59 +01:00
* Polished the malf timer logic
* added a protection to prevent division by 0 when all hacked apcs are destroyed * added a midnight rollover check for the MC (fixes #4905) * toggling breakers won't add/remove a hacked APC from the AI apcs pool anymore
This commit is contained in:
@@ -127,9 +127,10 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
|
||||
if(ticker.mode)
|
||||
//world << "DEBUG: ticker not null"
|
||||
if(ticker.mode.name == "AI malfunction")
|
||||
var/datum/game_mode/malfunction/malf = ticker.mode
|
||||
//world << "DEBUG: malf mode ticker test"
|
||||
if(ticker.mode:malf_mode_declared)
|
||||
stat(null, "Time left: [max(ticker.mode:AI_win_timeleft/(ticker.mode:apcs/3), 0)]")
|
||||
if(malf.malf_mode_declared && (malf.apcs > 0))
|
||||
stat(null, "Time left: [max(malf.AI_win_timeleft/malf.apcs, 0)]")
|
||||
if(emergency_shuttle)
|
||||
if(emergency_shuttle.online && emergency_shuttle.location < 2)
|
||||
var/timeleft = emergency_shuttle.timeleft()
|
||||
|
||||
@@ -121,8 +121,9 @@
|
||||
stat(null, "Intent: [a_intent]")
|
||||
stat(null, "Move Mode: [m_intent]")
|
||||
if(ticker && ticker.mode && ticker.mode.name == "AI malfunction")
|
||||
if(ticker.mode:malf_mode_declared)
|
||||
stat(null, "Time left: [max(ticker.mode:AI_win_timeleft/(ticker.mode:apcs/3), 0)]")
|
||||
var/datum/game_mode/malfunction/malf = ticker.mode
|
||||
if(malf.malf_mode_declared && (malf.apcs > 0))
|
||||
stat(null, "Time left: [max(malf.AI_win_timeleft/malf.apcs, 0)]")
|
||||
if(emergency_shuttle)
|
||||
if(emergency_shuttle.online && emergency_shuttle.location < 2)
|
||||
var/timeleft = emergency_shuttle.timeleft()
|
||||
|
||||
@@ -173,9 +173,8 @@ var/list/ai_list = list()
|
||||
if(ticker.mode.name == "AI malfunction")
|
||||
var/datum/game_mode/malfunction/malf = ticker.mode
|
||||
for (var/datum/mind/malfai in malf.malf_ai)
|
||||
if (mind == malfai)
|
||||
if (malf.apcs >= 3)
|
||||
stat(null, "Time until station control secured: [max(malf.AI_win_timeleft/(malf.apcs/3), 0)] seconds")
|
||||
if ((mind == malfai) && (malf.apcs > 0))
|
||||
stat(null, "Time until station control secured: [max(malf.AI_win_timeleft/malf.apcs, 0)] seconds")
|
||||
|
||||
if(!stat)
|
||||
stat(null, text("System integrity: [(health+100)/2]%"))
|
||||
|
||||
@@ -303,11 +303,10 @@
|
||||
var/datum/game_mode/malfunction/malf = ticker.mode
|
||||
for (var/datum/mind/malfai in malf.malf_ai)
|
||||
if(connected_ai)
|
||||
if(connected_ai.mind == malfai)
|
||||
if(malf.apcs >= 3)
|
||||
stat(null, "Time until station control secured: [max(malf.AI_win_timeleft/(malf.apcs/3), 0)] seconds")
|
||||
else if(ticker.mode:malf_mode_declared)
|
||||
stat(null, "Time left: [max(ticker.mode:AI_win_timeleft/(ticker.mode:apcs/3), 0)]")
|
||||
if((connected_ai.mind == malfai) && (malf.apcs > 0))
|
||||
stat(null, "Time until station control secured: [max(malf.AI_win_timeleft/malf.apcs, 0)] seconds")
|
||||
else if(malf.malf_mode_declared && (malf.apcs > 0))
|
||||
stat(null, "Time left: [max(malf.AI_win_timeleft/malf.apcs, 0)]")
|
||||
|
||||
if(cell)
|
||||
stat(null, text("Charge Left: [cell.charge]/[cell.maxcharge]"))
|
||||
|
||||
@@ -897,11 +897,6 @@
|
||||
/obj/machinery/power/apc/proc/toggle_breaker()
|
||||
operating = !operating
|
||||
|
||||
if(malfai)
|
||||
if (ticker.mode.config_tag == "malfunction")
|
||||
if (src.z == 1) //if (is_type_in_list(get_area(src), the_station_areas))
|
||||
operating ? ticker.mode:apcs++ : ticker.mode:apcs--
|
||||
|
||||
src.update()
|
||||
update_icon()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user