Merge pull request #2554

This commit is contained in:
kevinz000
2017-08-29 22:38:20 -07:00
8 changed files with 107 additions and 20 deletions
+2
View File
@@ -35,3 +35,5 @@ GLOBAL_LIST_EMPTY(wire_color_directory)
GLOBAL_LIST_EMPTY(wire_name_directory)
GLOBAL_LIST_EMPTY(ai_status_displays)
GLOBAL_LIST_EMPTY(mob_spawners) // All mob_spawn objects
+48
View File
@@ -0,0 +1,48 @@
/datum/spawners_menu
var/mob/dead/observer/owner
/datum/spawners_menu/New(mob/dead/observer/new_owner)
if(!istype(new_owner))
qdel(src)
owner = new_owner
/datum/spawners_menu/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.observer_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "spawners_menu", "Spawners Menu", 700, 600, master_ui, state)
ui.open()
/datum/spawners_menu/ui_data(mob/user)
var/list/data = list()
data["spawners"] = list()
for(var/spawner in GLOB.mob_spawners)
var/list/this = list()
this["name"] = spawner
this["desc"] = ""
this["refs"] = list()
for(var/spawner_obj in GLOB.mob_spawners[spawner])
this["refs"] += "\ref[spawner_obj]"
if(!this["desc"])
var/obj/effect/mob_spawn/MS = spawner_obj
this["desc"] = MS.flavour_text
this["amount_left"] = LAZYLEN(GLOB.mob_spawners[spawner])
data["spawners"] += list(this)
return data
/datum/spawners_menu/ui_act(action, params)
if(..())
return
var/spawner_ref = pick(GLOB.mob_spawners[params["name"]])
var/obj/effect/mob_spawn/MS = locate(spawner_ref) in GLOB.poi_list
switch(action)
if("jump")
if(MS)
owner.forceMove(get_turf(MS))
. = TRUE
if("spawn")
if(MS)
MS.attack_ghost(owner)
. = TRUE
+5 -2
View File
@@ -46,10 +46,13 @@
create()
else
GLOB.poi_list |= src
LAZYADD(GLOB.mob_spawners[name], src)
/obj/effect/mob_spawn/Destroy()
GLOB.poi_list.Remove(src)
. = ..()
GLOB.poi_list -= src
var/list/spawners = GLOB.mob_spawners[name]
LAZYREMOVE(spawners, src)
return ..()
/obj/effect/mob_spawn/proc/special(mob/M)
return
+15 -1
View File
@@ -52,11 +52,14 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
// Used for displaying in ghost chat, without changing the actual name
// of the mob
var/deadchat_name
var/datum/spawners_menu/spawners_menu
/mob/dead/observer/Initialize()
set_invisibility(GLOB.observer_default_invisibility)
verbs += /mob/dead/observer/proc/dead_tele
verbs += list(
/mob/dead/observer/proc/dead_tele,
/mob/dead/observer/proc/open_spawners_menu)
if(icon_state in GLOB.ghost_forms_with_directions_list)
ghostimage_default = image(src.icon,src,src.icon_state + "_nodir")
@@ -149,6 +152,8 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
QDEL_NULL(ghostimage_simple)
updateallghostimages()
QDEL_NULL(spawners_menu)
return ..()
/mob/dead/CanPass(atom/movable/mover, turf/target)
@@ -816,3 +821,12 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
if(message)
to_chat(G, message)
GLOB.observer_default_invisibility = amount
/mob/dead/observer/proc/open_spawners_menu()
set name = "Mob spawners menu"
set desc = "See all currently available ghost spawners"
set category = "Ghost"
if(!spawners_menu)
spawners_menu = new(src)
spawners_menu.ui_interact(src)