Removes SHUTTLE_* defines being numeric

Wew, there was a lot to change. Fixes #17950. There is a lot of gamemode
code here, so I'm not entirely sure if this is ultimately worth it.
This commit is contained in:
Jack Edge
2016-05-26 17:55:16 +01:00
parent 0925d1bb29
commit 78384666b1
13 changed files with 31 additions and 28 deletions

View File

@@ -7,6 +7,10 @@
#define SHUTTLE_ESCAPE 5
#define SHUTTLE_ENDGAME 6
#define EMERGENCY_IDLE_OR_RECALLED (SSshuttle.emergency && ((SSshuttle.emergency.mode == SHUTTLE_IDLE) || (SSshuttle.emergency.mode == SHUTTLE_RECALL)))
#define EMERGENCY_ESCAPED_OR_ENDGAMED (SSshuttle.emergency && ((SSshuttle.emergency.mode == SHUTTLE_ESCAPE) || (SSshuttle.emergency.mode == SHUTTLE_ENDGAME)))
#define EMERGENCY_AT_LEAST_DOCKED (SSshuttle.emergency && SSshuttle.emergency.mode != SHUTTLE_IDLE && SSshuttle.emergency.mode != SHUTTLE_RECALL && SSshuttle.emergency.mode != SHUTTLE_CALL)
// Shuttle return values
#define SHUTTLE_NOT_A_DOCKING_PORT "not_a_docking_port"
#define SHUTTLE_DWIDTH_TOO_LARGE "docking_width_too_large"

View File

@@ -177,7 +177,7 @@ var/datum/subsystem/shuttle/SSshuttle
break
if(callShuttle)
if(emergency.mode < SHUTTLE_CALL)
if(!EMERGENCY_IDLE_OR_RECALLED)
emergency.request(null, 2.5)
log_game("There is no means of calling the shuttle anymore. Shuttle automatically called.")
message_admins("All the communications consoles were destroyed and all AIs are inactive. Shuttle called.")

View File

@@ -351,9 +351,7 @@ var/datum/subsystem/ticker/ticker
/datum/subsystem/ticker/proc/declare_completion()
var/station_evacuated
if(SSshuttle.emergency.mode >= SHUTTLE_ESCAPE)
station_evacuated = 1
var/station_evacuated = EMERGENCY_ESCAPED_OR_ENDGAMED
var/num_survivors = 0
var/num_escapees = 0

View File

@@ -172,9 +172,10 @@
/datum/game_mode/proc/check_finished() //to be called by ticker
if(replacementmode && round_converted == 2)
return replacementmode.check_finished()
if((SSshuttle.emergency && SSshuttle.emergency.mode >= SHUTTLE_ENDGAME) \
|| station_was_nuked)
return 1
if(SSshuttle.emergency && (SSshuttle.emergency.mode == SHUTTLE_ENDGAME))
return TRUE
if(station_was_nuked)
return TRUE
if(!round_converted && (!config.continuous[config_tag] || (config.continuous[config_tag] && config.midround_antag[config_tag]))) //Non-continuous or continous with replacement antags
if(!continuous_sanity_checked) //make sure we have antags to be checking in the first place
for(var/mob/Player in mob_list)

View File

@@ -66,7 +66,7 @@
..()
/datum/game_mode/monkey/check_finished()
if(SSshuttle.emergency.mode >= SHUTTLE_ENDGAME || station_was_nuked)
if((SSshuttle.emergency.mode == SHUTTLE_ENDGAME) || station_was_nuked)
return 1
if(!round_converted)

View File

@@ -181,7 +181,7 @@
/datum/game_mode/nuclear/check_finished() //to be called by ticker
if(replacementmode && round_converted == 2)
return replacementmode.check_finished()
if(SSshuttle.emergency.mode >= SHUTTLE_ENDGAME || station_was_nuked)
if((SSshuttle.emergency.mode == SHUTTLE_ENDGAME) || station_was_nuked)
return 1
if(are_operatives_dead())
if(bomb_set) //snaaaaaaaaaake! It's not over yet!
@@ -194,7 +194,7 @@
if(!D.onCentcom())
disk_rescued = 0
break
var/crew_evacuated = (SSshuttle.emergency.mode >= SHUTTLE_ENDGAME)
var/crew_evacuated = (SSshuttle.emergency.mode == SHUTTLE_ENDGAME)
//var/operatives_are_dead = is_operatives_are_dead()
@@ -223,7 +223,7 @@
world << "<FONT size = 3><B>[syndicate_name()] operatives have earned Darwin Award!</B></FONT>"
world << "<B>[syndicate_name()] operatives blew up something that wasn't [station_name()] and got caught in the explosion.</B> Next time, don't lose the disk!"
else if ((disk_rescued || SSshuttle.emergency.mode < SHUTTLE_ENDGAME) && are_operatives_dead())
else if ((disk_rescued || SSshuttle.emergency.mode != SHUTTLE_ENDGAME) && are_operatives_dead())
feedback_set_details("round_end_result","loss - evacuation - disk secured - syndi team dead")
world << "<FONT size = 3><B>Crew Major Victory!</B></FONT>"
world << "<B>The Research Staff has saved the disc and killed the [syndicate_name()] Operatives</B>"

View File

@@ -212,7 +212,7 @@
/datum/objective/hijack/check_completion()
if(!owner.current || owner.current.stat)
return 0
if(SSshuttle.emergency.mode < SHUTTLE_ENDGAME)
if(SSshuttle.emergency.mode != SHUTTLE_ENDGAME)
return 0
if(issilicon(owner.current))
return 0
@@ -243,7 +243,7 @@
/datum/objective/hijackclone/check_completion()
if(!owner.current)
return 0
if(SSshuttle.emergency.mode < SHUTTLE_ENDGAME)
if(SSshuttle.emergency.mode != SHUTTLE_ENDGAME)
return 0
var/area/A = SSshuttle.emergency.areaInstance
@@ -283,7 +283,7 @@
/datum/objective/block/check_completion()
if(!istype(owner.current, /mob/living/silicon))
return 0
if(SSshuttle.emergency.mode < SHUTTLE_ENDGAME)
if(SSshuttle.emergency.mode != SHUTTLE_ENDGAME)
return 1
var/area/A = SSshuttle.emergency.areaInstance
@@ -305,7 +305,7 @@
martyr_compatible = 1
/datum/objective/purge/check_completion()
if(SSshuttle.emergency.mode < SHUTTLE_ENDGAME)
if(SSshuttle.emergency.mode != SHUTTLE_ENDGAME)
return 1
var/area/A = SSshuttle.emergency.areaInstance
@@ -354,7 +354,7 @@
return 1
if(ticker.mode.station_was_nuked) //If they escaped the blast somehow, let them win
return 1
if(SSshuttle.emergency.mode < SHUTTLE_ENDGAME)
if(SSshuttle.emergency.mode != SHUTTLE_ENDGAME)
return 0
var/turf/location = get_turf(owner.current)
if(!location)

View File

@@ -217,11 +217,11 @@ Made by Xhuis
/datum/game_mode/shadowling/declare_completion()
if(check_shadow_victory() && SSshuttle.emergency.mode >= SHUTTLE_ESCAPE) //Doesn't end instantly - this is hacky and I don't know of a better way ~X
if(check_shadow_victory() && EMERGENCY_ESCAPED_OR_ENDGAMED) //Doesn't end instantly - this is hacky and I don't know of a better way ~X
world << "<span class='greentext'>The shadowlings have ascended and taken over the station!</span>"
else if(shadowling_dead && !check_shadow_victory()) //If the shadowlings have ascended, they can not lose the round
world << "<span class='redtext'>The shadowlings have been killed by the crew!</span>"
else if(!check_shadow_victory() && SSshuttle.emergency.mode >= SHUTTLE_ESCAPE)
else if(!check_shadow_victory() && EMERGENCY_ESCAPED_OR_ENDGAMED)
world << "<span class='redtext'>The crew escaped the station before the shadowlings could ascend!</span>"
else
world << "<span class='redtext'>The shadowlings have failed!</span>"

View File

@@ -505,7 +505,7 @@ var/const/CALL_SHUTTLE_REASON_LENGTH = 12
dat += "Current login: None"
dat += "<BR><BR><B>General Functions</B>"
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=ai-messagelist'>Message List</A> \]"
if(SSshuttle.emergency.mode <= SHUTTLE_IDLE)
if(SSshuttle.emergency.mode == SHUTTLE_IDLE)
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=ai-callshuttle'>Call Emergency Shuttle</A> \]"
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=ai-status'>Set Status Display</A> \]"
dat += "<BR><BR><B>Special Functions</B>"
@@ -612,4 +612,4 @@ var/const/CALL_SHUTTLE_REASON_LENGTH = 12
/obj/machinery/computer/communications/proc/overrideCooldown()
var/obj/item/weapon/circuitboard/computer/communications/CM = circuit
CM.lastTimeUsed = 0
CM.lastTimeUsed = 0

View File

@@ -318,11 +318,11 @@
dat += "Current Game Mode: <B>[ticker.mode.name]</B><BR>"
dat += "Round Duration: <B>[round(world.time / 36000)]:[add_zero("[world.time / 600 % 60]", 2)]:[world.time / 100 % 6][world.time / 100 % 10]</B><BR>"
dat += "<B>Emergency shuttle</B><BR>"
if(SSshuttle.emergency.mode < SHUTTLE_CALL)
if(EMERGENCY_IDLE_OR_RECALLED)
dat += "<a href='?_src_=holder;call_shuttle=1'>Call Shuttle</a><br>"
else
var/timeleft = SSshuttle.emergency.timeLeft()
if(SSshuttle.emergency.mode < SHUTTLE_DOCKED)
if(SSshuttle.emergency.mode == SHUTTLE_CALL)
dat += "ETA: <a href='?_src_=holder;edit_shuttle_time=1'>[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]</a><BR>"
dat += "<a href='?_src_=holder;call_shuttle=2'>Send Back</a><br>"
else

View File

@@ -252,14 +252,14 @@
switch(href_list["call_shuttle"])
if("1")
if(SSshuttle.emergency.mode >= SHUTTLE_DOCKED)
if(EMERGENCY_AT_LEAST_DOCKED)
return
SSshuttle.emergency.request()
log_admin("[key_name(usr)] called the Emergency Shuttle")
message_admins("<span class='adminnotice'>[key_name_admin(usr)] called the Emergency Shuttle to the station</span>")
if("2")
if(SSshuttle.emergency.mode >= SHUTTLE_DOCKED)
if(EMERGENCY_AT_LEAST_DOCKED)
return
switch(SSshuttle.emergency.mode)
if(SHUTTLE_CALL)

View File

@@ -642,7 +642,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
set category = "Admin"
set name = "Call Shuttle"
if(SSshuttle.emergency.mode >= SHUTTLE_DOCKED)
if(EMERGENCY_AT_LEAST_DOCKED)
return
if (!holder)
@@ -667,7 +667,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
if(alert(src, "You sure?", "Confirm", "Yes", "No") != "Yes")
return
if(SSshuttle.emergency.mode >= SHUTTLE_DOCKED)
if(EMERGENCY_AT_LEAST_DOCKED)
return
SSshuttle.emergency.cancel()

View File

@@ -313,7 +313,7 @@ var/list/ai_list = list()
SSshuttle.requestEvac(src, reason)
// hack to display shuttle timer
if(SSshuttle.emergency.mode >= SHUTTLE_CALL)
if(!EMERGENCY_IDLE_OR_RECALLED)
var/obj/machinery/computer/communications/C = locate() in machines
if(C)
C.post_status("shuttle")
@@ -895,4 +895,4 @@ var/list/ai_list = list()
/mob/living/silicon/ai/revive(full_heal = 0, admin_revive = 0)
if(..()) //successfully ressuscitated from death
icon_state = "ai"
. = 1
. = 1