Files
Aurora.3/code/modules/ghostroles/spawner/simplemob/maintdrone.dm
Geeves 5a1231082e 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.
2020-11-10 08:15:14 +02:00

53 lines
2.1 KiB
Plaintext

/datum/ghostspawner/simplemob/maintdrone
short_name = "maintdrone"
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"
//Vars regarding the mob to use
spawn_mob = /mob/living/silicon/robot/drone //The mob that should be spawned
// 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
/datum/ghostspawner/simplemob/maintdrone/spawn_mob(mob/user)
var/obj/machinery/drone_fabricator/fabricator
var/list/all_fabricators = list()
for(var/obj/machinery/drone_fabricator/DF in SSmachinery.all_machines)
if((DF.stat & NOPOWER) || !DF.produce_drones || DF.drone_progress < 100)
continue
all_fabricators[DF.fabricator_tag] = DF
if(!all_fabricators.len)
to_chat(user, "<span class='danger'>There are no available drone spawn points, sorry.</span>")
return FALSE
var/choice = input(user, "Which fabricator do you wish to use?") as null|anything in all_fabricators
if(!choice || !all_fabricators[choice])
return FALSE
fabricator = all_fabricators[choice]
if(user && fabricator && !((fabricator.stat & NOPOWER) || !fabricator.produce_drones || fabricator.drone_progress < 100))
return fabricator.create_drone(user.client)
return FALSE