From 5a1231082e91c7834c9ec563b1a3e5893f1d449f Mon Sep 17 00:00:00 2001 From: Geeves Date: Tue, 10 Nov 2020 08:15:14 +0200 Subject: [PATCH] Maintenance Drone Fix (#10479) Fixed the maintenance drone ghost spawner. Added more info as to why certain ghost spawners are disabled to the ghost spawner menu. --- code/controllers/subsystems/ghostroles.dm | 8 +++++-- .../subsystems/initialization/misc_late.dm | 4 ++++ .../spawner/simplemob/maintdrone.dm | 22 ++++++++++++++----- .../ghostroles/spawner/simplemob/rat.dm | 2 +- .../silicon/robot/drone/drone_manufacturer.dm | 22 +++++++++++++++++-- html/changelogs/geeves-maint_drone.yml | 7 ++++++ 6 files changed, 55 insertions(+), 10 deletions(-) create mode 100644 html/changelogs/geeves-maint_drone.yml diff --git a/code/controllers/subsystems/ghostroles.dm b/code/controllers/subsystems/ghostroles.dm index 97f119a0e91..eec9fee6faf 100644 --- a/code/controllers/subsystems/ghostroles.dm +++ b/code/controllers/subsystems/ghostroles.dm @@ -120,10 +120,14 @@ if(data["spawners"][G.short_name]) data["spawners"] -= G.short_name continue + var/cant_spawn = G.cant_spawn(user) LAZYINITLIST(data["spawners"][G.short_name]) VUEUI_SET_CHECK(data["spawners"][G.short_name]["name"], G.name, ., data) - VUEUI_SET_CHECK(data["spawners"][G.short_name]["desc"], G.desc, ., data) - VUEUI_SET_CHECK(data["spawners"][G.short_name]["cant_spawn"], G.cant_spawn(user), ., data) + if(cant_spawn) + VUEUI_SET_CHECK(data["spawners"][G.short_name]["desc"], "[G.desc] ([cant_spawn])", ., data) + else + VUEUI_SET_CHECK(data["spawners"][G.short_name]["desc"], G.desc, ., data) + VUEUI_SET_CHECK(data["spawners"][G.short_name]["cant_spawn"], cant_spawn, ., data) VUEUI_SET_CHECK(data["spawners"][G.short_name]["can_edit"], G.can_edit(user), ., data) VUEUI_SET_CHECK(data["spawners"][G.short_name]["enabled"], G.enabled, ., data) VUEUI_SET_CHECK(data["spawners"][G.short_name]["count"], G.count, ., data) diff --git a/code/controllers/subsystems/initialization/misc_late.dm b/code/controllers/subsystems/initialization/misc_late.dm index 5260516a55b..7c223bb7b18 100644 --- a/code/controllers/subsystems/initialization/misc_late.dm +++ b/code/controllers/subsystems/initialization/misc_late.dm @@ -36,6 +36,10 @@ populate_code_phrases() + // this covers mapped in drone fabs + for(var/obj/machinery/drone_fabricator/DF in SSmachinery.all_machines) + DF.enable_drone_spawn() + if (config.use_forumuser_api) update_admins_from_api(TRUE) diff --git a/code/modules/ghostroles/spawner/simplemob/maintdrone.dm b/code/modules/ghostroles/spawner/simplemob/maintdrone.dm index 09ef680a766..7cbf47eca1a 100644 --- a/code/modules/ghostroles/spawner/simplemob/maintdrone.dm +++ b/code/modules/ghostroles/spawner/simplemob/maintdrone.dm @@ -1,20 +1,32 @@ /datum/ghostspawner/simplemob/maintdrone short_name = "maintdrone" - name = "Maintenence Drone" - desc = "Maintain and Improve the Systems on the Aurora" + name = "Maintenance Drone" + desc = "Maintain and Improve the Systems on the Aurora." show_on_job_select = FALSE tags = list("Simple Mobs") respawn_flag = MINISYNTH //Flag to check for when trying to spawn someone of that type (CREW, ANIMAL, MINISYNTH) jobban_job = "Cyborg" - loc_type = GS_LOC_ATOM //Vars regarding the mob to use - spawn_mob = /mob/living/simple_animal/rat //The mob that should be spawned + spawn_mob = /mob/living/silicon/robot/drone //The mob that should be spawned -/datum/ghostspawner/simplemob/maintdrone/cant_see() +// we fake it here to ensure it pops up and gets added to SSghostroles.spawners, handling of the fabricators is done below +/datum/ghostspawner/simplemob/maintdrone/select_spawnlocation() + return TRUE + +/datum/ghostspawner/simplemob/maintdrone/cant_spawn() if(!config.allow_drone_spawn) return "Spawning as drone is disabled" + if(count_drones() >= config.max_maint_drones) + return "The maximum number of active drones has been reached" + var/has_active_fabricator = FALSE + for(var/obj/machinery/drone_fabricator/DF in SSmachinery.all_machines) + if((DF.stat & NOPOWER) || !DF.produce_drones || DF.drone_progress < 100) + continue + has_active_fabricator = TRUE + if(!has_active_fabricator) + return "There are no active fabricators to spawn at" return ..() //The proc to actually spawn in the user diff --git a/code/modules/ghostroles/spawner/simplemob/rat.dm b/code/modules/ghostroles/spawner/simplemob/rat.dm index 00ae630f848..a6b21daf3bb 100644 --- a/code/modules/ghostroles/spawner/simplemob/rat.dm +++ b/code/modules/ghostroles/spawner/simplemob/rat.dm @@ -17,7 +17,7 @@ var/obj/machinery/atmospherics/unary/vent_pump/spawnpoint = find_mouse_spawnpoint(pick(current_map.station_levels)) return get_turf(spawnpoint) -/datum/ghostspawner/simplemob/rat/cant_see() +/datum/ghostspawner/simplemob/rat/cant_spawn() if(config.disable_player_rats) return "Spawning as Rat is disabled" return ..() diff --git a/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm b/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm index d58a5fb2bdf..8a70b27baf8 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm @@ -20,9 +20,27 @@ var/fabricator_tag = "Aurora" var/drone_progress = 0 - var/produce_drones = 1 + var/produce_drones = TRUE var/time_last_drone = 500 var/drone_type = /mob/living/silicon/robot/drone + var/drone_ghostrole_name = "maintdrone" + +/obj/machinery/drone_fabricator/disabled + produce_drones = FALSE + +/obj/machinery/drone_fabricator/Initialize() + . = ..() + if(SSticker.current_state == GAME_STATE_PLAYING) + enable_drone_spawn() + +/obj/machinery/drone_fabricator/Destroy() + . = ..() + var/datum/ghostspawner/G = SSghostroles.spawners[drone_ghostrole_name] + LAZYREMOVE(G.spawnpoints, get_turf(src)) + +/obj/machinery/drone_fabricator/proc/enable_drone_spawn() + var/datum/ghostspawner/G = SSghostroles.spawners[drone_ghostrole_name] + LAZYADD(G.spawnpoints, get_turf(src)) /obj/machinery/drone_fabricator/derelict name = "construction drone fabricator" @@ -57,7 +75,7 @@ /obj/machinery/drone_fabricator/examine(mob/user) ..(user) if(produce_drones && drone_progress >= 100 && istype(user,/mob/abstract) && config.allow_drone_spawn && count_drones() < config.max_maint_drones) - to_chat(user, SPAN_NOTICE("A drone is prepared. use 'Ghost Roles' from the Ghost tab to spawn as a maintenance drone.")) + to_chat(user, SPAN_NOTICE("A drone is prepared. use 'Ghost Spawner' from the Ghost tab to spawn as a maintenance drone.")) /obj/machinery/drone_fabricator/proc/create_drone(var/client/player) if(stat & NOPOWER) diff --git a/html/changelogs/geeves-maint_drone.yml b/html/changelogs/geeves-maint_drone.yml new file mode 100644 index 00000000000..465ff5ce8b6 --- /dev/null +++ b/html/changelogs/geeves-maint_drone.yml @@ -0,0 +1,7 @@ +author: Geeves + +delete-after: True + +changes: + - bugfix: "Fixed the maintenance drone ghost spawner." + - rscadd: "Added more info as to why certain ghost spawners are disabled to the ghost spawner menu." \ No newline at end of file