mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 22:50:26 +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:
@@ -118,6 +118,10 @@ var/global/pipe_processing_killed = 0
|
||||
if(!Failsafe) new /datum/controller/failsafe()
|
||||
|
||||
var/currenttime = world.timeofday
|
||||
|
||||
if((last_tick_timeofday - currenttime) > 1e5) //midnight rollover protection
|
||||
last_tick_timeofday -= MIDNIGHT_ROLLOVER
|
||||
|
||||
last_tick_duration = (currenttime - last_tick_timeofday) / 10
|
||||
last_tick_timeofday = currenttime
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
pre_setup_before_jobs = 1
|
||||
|
||||
|
||||
var/AI_win_timeleft = 1800 //started at 1800, in case I change this for testing round end.
|
||||
var/AI_win_timeleft = 5400 //started at 5400, in case I change this for testing round end.
|
||||
var/malf_mode_declared = 0
|
||||
var/station_captured = 0
|
||||
var/to_nuke_or_not_to_nuke = 0
|
||||
@@ -98,8 +98,8 @@
|
||||
return
|
||||
|
||||
/datum/game_mode/malfunction/process()
|
||||
if (apcs >= 3 && malf_mode_declared)
|
||||
AI_win_timeleft -= ((apcs/6)*last_tick_duration) //Victory timer now de-increments based on how many APCs are hacked. --NeoFite
|
||||
if ((apcs > 0) && malf_mode_declared)
|
||||
AI_win_timeleft -= apcs * last_tick_duration //Victory timer de-increments based on how many APCs are hacked
|
||||
..()
|
||||
if (AI_win_timeleft<=0)
|
||||
check_win()
|
||||
|
||||
@@ -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