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 += "