diff --git a/code/game/gamemodes/gang/dominator.dm b/code/game/gamemodes/gang/dominator.dm index 535bb46b2dc..a2051d1f4b9 100644 --- a/code/game/gamemodes/gang/dominator.dm +++ b/code/game/gamemodes/gang/dominator.dm @@ -32,8 +32,8 @@ return var/time - if(gang && isnum(gang.dom_timer)) - time = max(gang.dom_timer, 0) + if(gang && gang.is_dominating) + time = gang.domination_time_remaining() if(time > 0) user << "Hostile Takeover in progress. Estimated [time] seconds remain." else @@ -44,18 +44,21 @@ /obj/machinery/dominator/process() ..() - if(gang && isnum(gang.dom_timer)) - if(gang.dom_timer > 0) + if(gang && gang.is_dominating) + var/time_remaining = gang.domination_time_remaining() + if(time_remaining > 0) + . = TRUE playsound(loc, 'sound/items/timer.ogg', 10, 0) - if(!warned && (gang.dom_timer < 180)) + if(!warned && (time_remaining < 180)) warned = 1 var/area/domloc = get_area(loc) gang.message_gangtools("Less than 3 minutes remain in hostile takeover. Defend your dominator at [domloc.map_name]!") for(var/datum/gang/G in ticker.mode.gangs) if(G != gang) G.message_gangtools("WARNING: [gang.name] Gang takeover imminent. Their dominator at [domloc.map_name] must be destroyed!",1,1) - else - STOP_PROCESSING(SSmachine, src) + + if(!.) + STOP_PROCESSING(SSmachine, src) /obj/machinery/dominator/take_damage(damage, damage_type = BRUTE, sound_effect = 1) switch(damage_type) @@ -89,11 +92,11 @@ /obj/machinery/dominator/proc/set_broken() if(gang) - gang.dom_timer = "OFFLINE" + gang.is_dominating = FALSE var/takeover_in_progress = 0 for(var/datum/gang/G in ticker.mode.gangs) - if(isnum(G.dom_timer)) + if(G.is_dominating) takeover_in_progress = 1 break if(!takeover_in_progress) @@ -171,7 +174,7 @@ examine(user) return - if(isnum(tempgang.dom_timer)) + if(tempgang.is_dominating) user << "Error: Hostile Takeover is already in progress." return @@ -179,9 +182,9 @@ user << "Error: Unable to breach station network. Firewall has logged our signature and is blocking all further attempts." return - var/time = round(get_domination_time(tempgang)/60,0.1) + var/time = round(determine_domination_time(tempgang)/60,0.1) if(alert(user,"With [round((tempgang.territory.len/start_state.num_territories)*100, 1)]% station control, a takeover will require [time] minutes.\nYour gang will be unable to gain influence while it is active.\nThe entire station will likely be alerted to it once it starts.\nYou have [tempgang.dom_attempts] attempt(s) remaining. Are you ready?","Confirm","Ready","Later") == "Ready") - if (isnum(tempgang.dom_timer) || !tempgang.dom_attempts || !in_range(src, user) || !istype(src.loc, /turf)) + if((tempgang.is_dominating) || !tempgang.dom_attempts || !in_range(src, user) || !istype(src.loc, /turf)) return 0 var/area/A = get_area(loc) diff --git a/code/game/gamemodes/gang/gang.dm b/code/game/gamemodes/gang/gang.dm index 67af9e6e696..75459b7269b 100644 --- a/code/game/gamemodes/gang/gang.dm +++ b/code/game/gamemodes/gang/gang.dm @@ -252,7 +252,7 @@ var/list/gang_colors_pool = list("red","orange","yellow","green","blue","purple" gang_bosses += G.bosses return gang_bosses -/proc/get_domination_time(var/datum/gang/G) +/proc/determine_domination_time(var/datum/gang/G) return max(180,900 - (round((G.territory.len/start_state.num_territories)*100, 1) * 12)) ////////////////////////////////////////////////////////////////////// @@ -298,9 +298,8 @@ var/list/gang_colors_pool = list("red","orange","yellow","green","blue","purple" if(world.time > next_point_time) G.income() - if(isnum(G.dom_timer)) - G.dom_timer -= seconds/10 - if(G.dom_timer < 0) + if(G.is_dominating) + if(G.domination_time_remaining() < 0) winners += G if(world.time > next_point_time) @@ -315,4 +314,4 @@ var/list/gang_colors_pool = list("red","orange","yellow","green","blue","purple" ticker.mode.explosion_in_progress = 1 ticker.station_explosion_cinematic(1) ticker.mode.explosion_in_progress = 0 - ticker.force_ending = pick(winners) \ No newline at end of file + ticker.force_ending = pick(winners) diff --git a/code/game/gamemodes/gang/gang_datum.dm b/code/game/gamemodes/gang/gang_datum.dm index df8d646f440..16010b04605 100644 --- a/code/game/gamemodes/gang/gang_datum.dm +++ b/code/game/gamemodes/gang/gang_datum.dm @@ -13,11 +13,13 @@ var/list/territory = list() var/list/territory_new = list() var/list/territory_lost = list() - var/dom_timer = "OFFLINE" var/dom_attempts = 2 var/points = 15 var/datum/atom_hud/antag/ganghud + var/domination_timer + var/is_dominating + /datum/gang/New(loc,gangname) if(!gang_colors_pool.len) message_admins("WARNING: Maximum number of gangs have been exceeded!") @@ -55,10 +57,17 @@ ticker.mode.set_antag_hud(defector_mind.current, null) /datum/gang/proc/domination(modifier=1) - dom_timer = get_domination_time(src) * modifier + set_domination_time(determine_domination_time(src) * modifier) + is_dominating = TRUE set_security_level("delta") SSshuttle.emergencyNoEscape = 1 +/datum/gang/proc/set_domination_time(d) + domination_timer = world.time + (10 * d) + +/datum/gang/proc/domination_time_remaining() + var/diff = domination_timer - world.time + return diff / 10 //////////////////////////////////////////// OUTFITS @@ -169,12 +178,13 @@ //Calculate and report influence growth var/message = "[src] Gang Status Report:
*---------*
" - if(isnum(dom_timer)) - var/new_time = max(180,dom_timer - (uniformed * 4) - (territory.len * 2)) - if(new_time < dom_timer) - message += "Takeover shortened by [dom_timer - new_time] seconds for defending [territory.len] territories and [uniformed] uniformed gangsters.
" - dom_timer = new_time - message += "[dom_timer] seconds remain in hostile takeover.
" + if(is_dominating) + var/seconds_remaining = domination_time_remaining() + var/new_time = max(180, seconds_remaining - (uniformed * 4) - (territory.len * 2)) + if(new_time < seconds_remaining) + message += "Takeover shortened by [seconds_remaining - new_time] seconds for defending [territory.len] territories and [uniformed] uniformed gangsters.
" + set_domination_time(new_time) + message += "[seconds_remaining] seconds remain in hostile takeover.
" else var/points_new = min(999,points + 15 + (uniformed * 2) + territory.len) if(points_new != points) @@ -203,4 +213,4 @@ //Increase outfit stock for(var/obj/item/device/gangtool/tool in gangtools) - tool.outfits = min(tool.outfits+1,5) \ No newline at end of file + tool.outfits = min(tool.outfits+1,5) diff --git a/code/game/gamemodes/gang/recaller.dm b/code/game/gamemodes/gang/recaller.dm index 57ba98a1737..3f1a00593d4 100644 --- a/code/game/gamemodes/gang/recaller.dm +++ b/code/game/gamemodes/gang/recaller.dm @@ -41,8 +41,8 @@ else dat += "This device is not authorized to promote.
" else - if(isnum(gang.dom_timer)) - dat += "
Takeover In Progress:
[gang.dom_timer] seconds remain
" + if(gang.is_dominating) + dat += "
Takeover In Progress:
[gang.domination_time_remaining()] seconds remain
" var/isboss = (user.mind == gang.bosses[1]) var/points = gang.points @@ -157,7 +157,7 @@ dat += "Station Dominator
" else dat += "Station Dominator
" - dat += "(Estimated Takeover Time: [round(get_domination_time(gang)/60,0.1)] minutes)
" + dat += "(Estimated Takeover Time: [round(determine_domination_time(gang)/60,0.1)] minutes)
" dat += "
" dat += "Refresh
" diff --git a/code/modules/countdown/countdown.dm b/code/modules/countdown/countdown.dm index c7ad91b2b0f..ef5ab439e1e 100644 --- a/code/modules/countdown/countdown.dm +++ b/code/modules/countdown/countdown.dm @@ -105,9 +105,11 @@ var/obj/machinery/dominator/D = attached_to if(!istype(D)) return - else if(D.gang && D.gang.dom_timer) - var/timer = D.gang.dom_timer + else if(D.gang && D.gang.is_dominating) + var/timer = D.gang.domination_time_remaining() return timer + else + return "OFFLINE" /obj/effect/countdown/clockworkgate name = "gateway countdown" diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 4d9563c1de7..9407c3d5f54 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -302,8 +302,8 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp if(ticker) if(ticker.mode) for(var/datum/gang/G in ticker.mode.gangs) - if(isnum(G.dom_timer)) - stat(null, "[G.name] Gang Takeover: [max(G.dom_timer, 0)]") + if(G.is_dominating) + stat(null, "[G.name] Gang Takeover: [max(G.domination_time_remaining(), 0)]") /mob/dead/observer/verb/reenter_corpse() set category = "Ghost" diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index fa493a7df28..f6a9200c49b 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -922,8 +922,8 @@ Sorry Giacom. Please don't be mad :( if(ticker) if(ticker.mode) for(var/datum/gang/G in ticker.mode.gangs) - if(isnum(G.dom_timer)) - stat(null, "[G.name] Gang Takeover: [max(G.dom_timer, 0)]") + if(G.is_dominating) + stat(null, "[G.name] Gang Takeover: [max(G.domination_time_remaining(), 0)]") /mob/living/cancel_camera() ..() diff --git a/code/modules/shuttle/emergency.dm b/code/modules/shuttle/emergency.dm index 9c93968aced..70788e79755 100644 --- a/code/modules/shuttle/emergency.dm +++ b/code/modules/shuttle/emergency.dm @@ -288,10 +288,11 @@ priority_announce("The Emergency Shuttle has docked with the station. You have [timeLeft(600)] minutes to board the Emergency Shuttle.", null, 'sound/AI/shuttledock.ogg', "Priority") feedback_add_details("emergency_shuttle", src.name) - //Gangs only have one attempt left if the shuttle has docked with the station to prevent suffering from dominator delays + // Gangs only have one attempt left if the shuttle has + // docked with the station to prevent suffering from + // endless dominator delays for(var/datum/gang/G in ticker.mode.gangs) - if(isnum(G.dom_timer)) - + if(G.is_dominating) G.dom_attempts = 0 else G.dom_attempts = min(1,G.dom_attempts)