Merge pull request #578 from Citadel-Station-13/upstream-merge-25981
[MIRROR] Initialize Refactor
This commit is contained in:
@@ -166,8 +166,10 @@ GLOBAL_LIST_INIT(admin_verbs_debug, AVerbsDebug())
|
||||
//citadel code
|
||||
/client/proc/give_humans_genitals,
|
||||
/client/proc/test_mammal_overlays,
|
||||
/client/proc/pump_random_event
|
||||
/client/proc/pump_random_event,
|
||||
/client/proc/cmd_display_init_log
|
||||
)
|
||||
|
||||
GLOBAL_PROTECT(admin_verbs_possess)
|
||||
GLOBAL_LIST_INIT(admin_verbs_possess, list(/proc/possess,/proc/release))
|
||||
GLOBAL_PROTECT(admin_verbs_permissions)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
diff a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm (rejected hunks)
|
||||
@@ -153,7 +153,8 @@ var/list/admin_verbs_debug = list(
|
||||
/client/proc/clear_dynamic_transit,
|
||||
/client/proc/toggle_medal_disable,
|
||||
/client/proc/view_runtimes,
|
||||
- /client/proc/pump_random_event
|
||||
+ /client/proc/pump_random_event,
|
||||
+ /client/proc/cmd_display_init_log
|
||||
)
|
||||
var/list/admin_verbs_possess = list(
|
||||
/proc/possess,
|
||||
@@ -721,6 +721,13 @@ GLOBAL_PROTECT(AdminProcCall)
|
||||
|
||||
usr << browse(dat, "window=dellog")
|
||||
|
||||
/client/proc/cmd_display_init_log()
|
||||
set category = "Debug"
|
||||
set name = "Display Initialzie() Log"
|
||||
set desc = "Displays a list of things that didn't handle Initialize() properly"
|
||||
|
||||
usr << browse(replacetext(SSatoms.InitLog(), "\n", "<br>"), "window=initlog")
|
||||
|
||||
/client/proc/debug_huds(i as num)
|
||||
set category = "Debug"
|
||||
set name = "Debug HUDs"
|
||||
|
||||
@@ -45,52 +45,52 @@
|
||||
var/list/effects = list()
|
||||
var/last_change = 0
|
||||
|
||||
|
||||
|
||||
|
||||
/obj/machinery/computer/holodeck/Initialize(mapload)
|
||||
. = mapload //late-initialize, area_copy need turfs to have air
|
||||
if(!mapload)
|
||||
..()
|
||||
..()
|
||||
return INITIALIZE_HINT_LATELOAD
|
||||
|
||||
if(ispath(holodeck_type,/area))
|
||||
var/list/possible = get_areas(holodeck_type,subtypes = FALSE)
|
||||
linked = pop(possible)
|
||||
if(ispath(offline_program,/area))
|
||||
var/list/possible = get_areas(offline_program,subtypes = FALSE)
|
||||
offline_program = pop(possible)
|
||||
// the following is necessary for power reasons
|
||||
if(!linked || !offline_program)
|
||||
log_world("No matching holodeck area found")
|
||||
qdel(src)
|
||||
return
|
||||
var/area/AS = get_area(src)
|
||||
if(istype(AS,/area/holodeck))
|
||||
log_world("### MAPPING ERROR")
|
||||
log_world("Holodeck computer cannot be in a holodeck.")
|
||||
log_world("This would cause circular power dependency.")
|
||||
qdel(src) // todo handle constructed computers
|
||||
return //l-lewd...
|
||||
else
|
||||
linked.linked = src // todo detect multiple/constructed computers
|
||||
/obj/machinery/computer/holodeck/LateInitialize()
|
||||
if(ispath(holodeck_type,/area))
|
||||
var/list/possible = get_areas(holodeck_type,subtypes = FALSE)
|
||||
linked = pop(possible)
|
||||
if(ispath(offline_program,/area))
|
||||
var/list/possible = get_areas(offline_program,subtypes = FALSE)
|
||||
offline_program = pop(possible)
|
||||
// the following is necessary for power reasons
|
||||
if(!linked || !offline_program)
|
||||
log_world("No matching holodeck area found")
|
||||
qdel(src)
|
||||
return
|
||||
var/area/AS = get_area(src)
|
||||
if(istype(AS,/area/holodeck))
|
||||
log_world("### MAPPING ERROR")
|
||||
log_world("Holodeck computer cannot be in a holodeck.")
|
||||
log_world("This would cause circular power dependency.")
|
||||
qdel(src) // todo handle constructed computers
|
||||
return //l-lewd...
|
||||
else
|
||||
linked.linked = src // todo detect multiple/constructed computers
|
||||
|
||||
program_cache = list()
|
||||
emag_programs = list()
|
||||
for(var/typekey in subtypesof(program_type))
|
||||
var/area/holodeck/A = locate(typekey)
|
||||
if(!A || A == offline_program)
|
||||
continue
|
||||
if(A.contents.len == 0)
|
||||
continue // not loaded
|
||||
if(A.restricted)
|
||||
emag_programs += A
|
||||
else
|
||||
program_cache += A
|
||||
if(typekey == init_program)
|
||||
load_program(A,force=1)
|
||||
if(random_program && program_cache.len && init_program == null)
|
||||
load_program(pick(program_cache),force=1)
|
||||
else if(!program)
|
||||
load_program(offline_program)
|
||||
program_cache = list()
|
||||
emag_programs = list()
|
||||
for(var/typekey in subtypesof(program_type))
|
||||
var/area/holodeck/A = locate(typekey)
|
||||
if(!A || A == offline_program)
|
||||
continue
|
||||
if(A.contents.len == 0)
|
||||
continue // not loaded
|
||||
if(A.restricted)
|
||||
emag_programs += A
|
||||
else
|
||||
program_cache += A
|
||||
if(typekey == init_program)
|
||||
load_program(A,force=1)
|
||||
if(random_program && program_cache.len && init_program == null)
|
||||
load_program(pick(program_cache),force=1)
|
||||
else if(!program)
|
||||
load_program(offline_program)
|
||||
|
||||
/obj/machinery/computer/holodeck/power_change()
|
||||
..()
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
diff a/code/modules/holodeck/computer.dm b/code/modules/holodeck/computer.dm (rejected hunks)
|
||||
@@ -64,25 +64,26 @@
|
||||
..()
|
||||
|
||||
/obj/machinery/computer/holodeck/Initialize(mapload)
|
||||
- . = mapload //late-initialize, area_copy need turfs to have air
|
||||
- if(!mapload)
|
||||
- ..()
|
||||
- program_cache = list()
|
||||
- emag_programs = list()
|
||||
- for(var/typekey in subtypesof(program_type))
|
||||
- var/area/holodeck/A = locate(typekey)
|
||||
- if(!A || A == offline_program) continue
|
||||
- if(A.contents.len == 0) continue // not loaded
|
||||
- if(A.restricted)
|
||||
- emag_programs += A
|
||||
- else
|
||||
- program_cache += A
|
||||
- if(typekey == init_program)
|
||||
- load_program(A,force=1)
|
||||
- if(random_program && program_cache.len && init_program == null)
|
||||
- load_program(pick(program_cache),force=1)
|
||||
- else if(!program)
|
||||
- load_program(offline_program)
|
||||
+ ..()
|
||||
+ return INITIALIZE_HINT_LATELOAD
|
||||
+
|
||||
+/obj/machinery/computer/holodeck/LateInitialize()
|
||||
+ program_cache = list()
|
||||
+ emag_programs = list()
|
||||
+ for(var/typekey in subtypesof(program_type))
|
||||
+ var/area/holodeck/A = locate(typekey)
|
||||
+ if(!A || A == offline_program) continue
|
||||
+ if(A.contents.len == 0) continue // not loaded
|
||||
+ if(A.restricted)
|
||||
+ emag_programs += A
|
||||
+ else
|
||||
+ program_cache += A
|
||||
+ if(typekey == init_program)
|
||||
+ load_program(A,force=1)
|
||||
+ if(random_program && program_cache.len && init_program == null)
|
||||
+ load_program(pick(program_cache),force=1)
|
||||
+ else if(!program)
|
||||
+ load_program(offline_program)
|
||||
|
||||
/obj/machinery/computer/holodeck/power_change()
|
||||
..()
|
||||
@@ -1,9 +1,6 @@
|
||||
//Dead mobs can exist whenever. This is needful
|
||||
/mob/dead/New(loc)
|
||||
..()
|
||||
if(!initialized)
|
||||
args[1] = FALSE
|
||||
Initialize(arglist(args)) //EXIST DAMN YOU!!!
|
||||
|
||||
INITIALIZE_IMMEDIATE(/mob/dead)
|
||||
|
||||
/mob/dead/dust() //ghosts can't be vaporised.
|
||||
return
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
loc = pick(GLOB.newplayer_start)
|
||||
else
|
||||
loc = locate(1,1,1)
|
||||
return INITIALIZE_HINT_NORMAL
|
||||
|
||||
/mob/dead/new_player/proc/new_player_panel()
|
||||
|
||||
@@ -48,11 +49,11 @@
|
||||
output += "<p><a href='byond://?src=\ref[src];observe=1'>Observe</A></p>"
|
||||
|
||||
if(!IsGuestKey(src.key))
|
||||
if (SSdbcore.Connect())
|
||||
if (SSdbcore.Connect())
|
||||
var/isadmin = 0
|
||||
if(src.client && src.client.holder)
|
||||
isadmin = 1
|
||||
var/datum/DBQuery/query_get_new_polls = SSdbcore.NewQuery("SELECT id FROM [format_table_name("poll_question")] WHERE [(isadmin ? "" : "adminonly = false AND")] Now() BETWEEN starttime AND endtime AND id NOT IN (SELECT pollid FROM [format_table_name("poll_vote")] WHERE ckey = \"[ckey]\") AND id NOT IN (SELECT pollid FROM [format_table_name("poll_textreply")] WHERE ckey = \"[ckey]\")")
|
||||
var/datum/DBQuery/query_get_new_polls = SSdbcore.NewQuery("SELECT id FROM [format_table_name("poll_question")] WHERE [(isadmin ? "" : "adminonly = false AND")] Now() BETWEEN starttime AND endtime AND id NOT IN (SELECT pollid FROM [format_table_name("poll_vote")] WHERE ckey = \"[ckey]\") AND id NOT IN (SELECT pollid FROM [format_table_name("poll_textreply")] WHERE ckey = \"[ckey]\")")
|
||||
if(!query_get_new_polls.Execute())
|
||||
return
|
||||
var/newpoll = 0
|
||||
@@ -302,7 +303,7 @@
|
||||
if(!IsJobAvailable(rank))
|
||||
alert(src, "[rank] is not available. Please try another.")
|
||||
return 0
|
||||
|
||||
|
||||
if(SSticker.late_join_disabled)
|
||||
alert(src, "An administrator has disabled late join spawning.")
|
||||
return FALSE
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
diff a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm (rejected hunks)
|
||||
@@ -30,6 +30,7 @@
|
||||
loc = pick(newplayer_start)
|
||||
else
|
||||
loc = locate(1,1,1)
|
||||
+ return INITIALIZE_HINT_NORMAL
|
||||
|
||||
/mob/dead/new_player/proc/new_player_panel()
|
||||
|
||||
@@ -212,13 +212,14 @@
|
||||
|
||||
|
||||
/obj/machinery/conveyor_switch/Initialize(mapload, newid)
|
||||
if(mapload)
|
||||
return TRUE //need machines list
|
||||
. = ..()
|
||||
..()
|
||||
if(!id)
|
||||
id = newid
|
||||
update()
|
||||
|
||||
return INITIALIZE_HINT_LATELOAD //for machines list
|
||||
|
||||
/obj/machinery/conveyor_switch/LateInitialize()
|
||||
conveyors = list()
|
||||
for(var/obj/machinery/conveyor/C in GLOB.machines)
|
||||
if(C.id == id)
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
diff a/code/modules/recycling/conveyor2.dm b/code/modules/recycling/conveyor2.dm (rejected hunks)
|
||||
@@ -220,7 +220,7 @@
|
||||
id = newid
|
||||
update()
|
||||
|
||||
- return INITIALIZE_HINT_LATELOAD
|
||||
+ return INITIALIZE_HINT_LATELOAD //for machines list
|
||||
|
||||
/obj/machinery/conveyor_switch/LateInitialize()
|
||||
conveyors = list()
|
||||
@@ -64,17 +64,17 @@
|
||||
deconstruct()
|
||||
|
||||
/obj/machinery/disposal/Initialize(mapload)
|
||||
. = mapload //late-initialize, we need turfs to have air
|
||||
if(initialized) //will only be run on late mapload initialization
|
||||
//this will get a copy of the air turf and take a SEND PRESSURE amount of air from it
|
||||
var/atom/L = loc
|
||||
var/datum/gas_mixture/env = new
|
||||
env.copy_from(L.return_air())
|
||||
var/datum/gas_mixture/removed = env.remove(SEND_PRESSURE + 1)
|
||||
air_contents.merge(removed)
|
||||
trunk_check()
|
||||
else
|
||||
..()
|
||||
..()
|
||||
return INITIALIZE_HINT_LATELOAD //we need turfs to have air
|
||||
|
||||
/obj/machinery/disposal/LateInitialize()
|
||||
//this will get a copy of the air turf and take a SEND PRESSURE amount of air from it
|
||||
var/atom/L = loc
|
||||
var/datum/gas_mixture/env = new
|
||||
env.copy_from(L.return_air())
|
||||
var/datum/gas_mixture/removed = env.remove(SEND_PRESSURE + 1)
|
||||
air_contents.merge(removed)
|
||||
trunk_check()
|
||||
|
||||
/obj/machinery/disposal/attackby(obj/item/I, mob/user, params)
|
||||
add_fingerprint(user)
|
||||
|
||||
@@ -22,20 +22,22 @@
|
||||
var/perma_docked = FALSE //highlander with RESPAWN??? OH GOD!!!
|
||||
|
||||
/obj/docking_port/mobile/arrivals/Initialize(mapload)
|
||||
if(mapload)
|
||||
return TRUE //late initialize to make sure the latejoin list is populated
|
||||
|
||||
preferred_direction = dir
|
||||
|
||||
if(SSshuttle.arrivals)
|
||||
WARNING("More than one arrivals docking_port placed on map!")
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
return INITIALIZE_HINT_QDEL
|
||||
|
||||
SSshuttle.arrivals = src
|
||||
|
||||
. = ..()
|
||||
. = ..()
|
||||
|
||||
preferred_direction = dir
|
||||
return INITIALIZE_HINT_LATELOAD //for latejoin list
|
||||
|
||||
|
||||
/obj/docking_port/mobile/arrivals/LateInitialize()
|
||||
areas = list()
|
||||
|
||||
var/list/new_latejoin = list()
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
diff a/code/modules/shuttle/arrivals.dm b/code/modules/shuttle/arrivals.dm (rejected hunks)
|
||||
@@ -30,6 +30,9 @@
|
||||
..()
|
||||
|
||||
preferred_direction = dir
|
||||
+ return INITIALIZE_HINT_LATELOAD //for latejoin list
|
||||
+
|
||||
+/obj/docking_port/mobile/arrivals/LateInitialize()
|
||||
areas = list()
|
||||
|
||||
var/list/new_latejoin = list()
|
||||
@@ -0,0 +1,10 @@
|
||||
diff a/code/modules/surgery/surgery.dm b/code/modules/surgery/surgery.dm (rejected hunks)
|
||||
@@ -54,7 +54,7 @@
|
||||
return new step_type
|
||||
|
||||
/datum/surgery/proc/complete()
|
||||
- feedback_add_details("surgeries_completed", type)
|
||||
+ feedback_add_details("surgeries_completed", "[type]")
|
||||
qdel(src)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user