From 6354c6eec5181f6c7ea796ac21c2bf7155c2ed51 Mon Sep 17 00:00:00 2001 From: AnturK Date: Fri, 19 Jan 2018 15:40:40 +0100 Subject: [PATCH 1/2] Moves creating tag before intialization (#34512) * Moves creating tag before intialization * Two nukes for price of one. * coord --- code/game/atoms.dm | 6 ++++++ code/game/gamemodes/nuclear/nuclearbomb.dm | 16 ++++++++-------- code/modules/mob/mob.dm | 4 +++- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index eb63ca147f..6645ffe37a 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -32,6 +32,9 @@ if(GLOB.use_preloader && (src.type == GLOB._preloader.target_path))//in case the instanciated atom is creating other atoms in New() GLOB._preloader.load(src) + if(use_tag) + GenerateTag() + var/do_initialize = SSatoms.initialized if(do_initialize != INITIALIZATION_INSSATOMS) args[1] = do_initialize == INITIALIZATION_INNEW_MAPLOAD @@ -539,3 +542,6 @@ /atom/proc/wirecutter_act(mob/user, obj/item/tool) return + +/atom/proc/GenerateTag() + return \ No newline at end of file diff --git a/code/game/gamemodes/nuclear/nuclearbomb.dm b/code/game/gamemodes/nuclear/nuclearbomb.dm index 68340a1da3..aa7e7d0178 100644 --- a/code/game/gamemodes/nuclear/nuclearbomb.dm +++ b/code/game/gamemodes/nuclear/nuclearbomb.dm @@ -82,6 +82,14 @@ use_tag = TRUE //ui_style = "syndicate" // actually the nuke op bomb is a stole nt bomb +/obj/machinery/nuclearbomb/syndicate/GenerateTag() + var/obj/machinery/nuclearbomb/existing = locate("syndienuke") in GLOB.nuke_list + if(existing) + stack_trace("Attempted to spawn a syndicate nuke while one already exists at [COORD(existing.loc)]") + use_tag = FALSE + return + tag = "syndienuke" + /obj/machinery/nuclearbomb/syndicate/get_cinematic_type(off_station) var/datum/game_mode/nuclear/NM = SSticker.mode switch(off_station) @@ -96,14 +104,6 @@ return CINEMATIC_NUKE_FAR return CINEMATIC_NUKE_FAR -/obj/machinery/nuclearbomb/syndicate/Initialize() - . = ..() - var/obj/machinery/nuclearbomb/existing = locate("syndienuke") in GLOB.nuke_list - if(existing) - stack_trace("Attempted to spawn a syndicate nuke while one already exists at [existing.loc.x],[existing.loc.y],[existing.loc.z]") - return INITIALIZE_HINT_QDEL - tag = "syndienuke" - /obj/machinery/nuclearbomb/attackby(obj/item/I, mob/user, params) if (istype(I, /obj/item/disk/nuclear)) if(!user.transferItemToLoc(I, src)) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 26d49ab04c..e9e573da63 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -20,7 +20,6 @@ return QDEL_HINT_HARDDEL /mob/Initialize() - tag = "mob_[next_mob_id++]" GLOB.mob_list += src GLOB.mob_directory[tag] = src if(stat == DEAD) @@ -37,6 +36,9 @@ hook_vr("mob_new",list(src)) . = ..() +/mob/GenerateTag() + tag = "mob_[next_mob_id++]" + /atom/proc/prepare_huds() hud_list = list() for(var/hud in hud_possible)