Ghost Menu (#12000)

* Ghost Menu

* obvious antags don't need antagHUD to show
This commit is contained in:
Geeves
2021-07-03 18:48:34 -03:00
committed by GitHub
parent a77d03aa16
commit 378ff0d892
13 changed files with 130 additions and 9 deletions
+1
View File
@@ -2423,6 +2423,7 @@
#include "code\modules\nano\modules\alarm_monitor.dm"
#include "code\modules\nano\modules\atmos_control.dm"
#include "code\modules\nano\modules\crew_monitor.dm"
#include "code\modules\nano\modules\ghost_menu.dm"
#include "code\modules\nano\modules\human_appearance.dm"
#include "code\modules\nano\modules\law_manager.dm"
#include "code\modules\nano\modules\lighting_ctrl.dm"
@@ -77,6 +77,12 @@ var/global/list/bantype_to_antag_age = list()
if(player in antag.pending_antagonists)
return antag
/proc/player_is_obvious_antag(var/datum/mind/player, var/only_offstation_roles = FALSE)
var/datum/antagonist/antag = player_is_antag(player, only_offstation_roles)
if(antag)
return antag.is_obvious_antag(player)
return FALSE
/**
* This must be called after map loading is done!
*/
+4 -1
View File
@@ -65,4 +65,7 @@ var/datum/antagonist/xenos/borer/borers
var/obj/item/organ/external/head = borer.host.get_organ(BP_HEAD)
head.implants += borer
else
..()
..()
/datum/antagonist/xenos/borer/is_obvious_antag(datum/mind/player)
return TRUE
@@ -61,6 +61,9 @@
/datum/antagonist/proc/handle_latelogin(var/mob/user)
return
/datum/antagonist/proc/is_obvious_antag(var/datum/mind/player)
return FALSE
/proc/all_random_antag_types()
// No caching as the ANTAG_RANDOM_EXCEPTED flag can be added/removed mid-round.
var/list/antag_candidates = all_antag_types.Copy()
@@ -27,6 +27,9 @@ var/datum/antagonist/revenant/revenants = null
if(revenants.rifts_left <= 0)
command_announcement.Announce("Aurora, we aren't detecting any more rift energy signatures. Mop up the rest of the invaders. Good work.", "Bluespace Breach Alert")
/datum/antagonist/revenant/is_obvious_antag(datum/mind/player)
return TRUE
/proc/message_all_revenants(var/message)
for(var/thing in human_mob_list)
if(isrevenant(thing))
@@ -83,4 +83,7 @@ var/datum/antagonist/technomancer/technomancers
return TRUE
if(raider_techno.is_antagonist(player))
return TRUE
return FALSE
return FALSE
/datum/antagonist/technomancer/is_obvious_antag(datum/mind/player)
return TRUE
@@ -95,4 +95,9 @@
if(.)
player.current.verbs -= /datum/changeling/proc/EvolutionMenu
for(var/datum/power/changeling/P in powerinstances)
player.current.verbs -= P.verbpath
player.current.verbs -= P.verbpath
/datum/antagonist/changeling/is_obvious_antag(datum/mind/player)
if(istype(player.current, /mob/living/simple_animal/hostile/lesser_changeling))
return TRUE
return FALSE
@@ -17,4 +17,7 @@ var/datum/antagonist/morph/morphs = null
/datum/antagonist/morph/greet(datum/mind/player)
. = ..()
to_chat(player.current, SPAN_DANGER("As a morph, you can disguise as objects by alt-clicking on them."))
to_chat(player.current, SPAN_DANGER("You can eat people and items by clicking on them, but only if they're dead."))
to_chat(player.current, SPAN_DANGER("You can eat people and items by clicking on them, but only if they're dead."))
/datum/antagonist/morph/is_obvious_antag(datum/mind/player)
return TRUE
+8 -1
View File
@@ -126,4 +126,11 @@ var/datum/antagonist/cultist/cult
if(!cult.can_become_antag(target.mind) || jobban_isbanned(target, "cultist") || player_is_antag(target.mind))
to_chat(usr, SPAN_CULT("You get the sense that [target] would be an unworthy offering."))
else
to_chat(usr, SPAN_CULT("You get the sense that your master would be pleased to welcome [target] into the cult."))
to_chat(usr, SPAN_CULT("You get the sense that your master would be pleased to welcome [target] into the cult."))
/datum/antagonist/cultist/is_obvious_antag(datum/mind/player)
if(istype(player.current, /mob/living/simple_animal/construct))
return TRUE
else if(istype(player.current, /mob/living/simple_animal/shade))
return TRUE
return FALSE
@@ -394,14 +394,13 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
stop_following()
usr.forceMove(pick(L))
/mob/abstract/observer/verb/follow(input in getmobs())
/mob/abstract/observer/verb/follow()
set category = "Ghost"
set name = "Follow" // "Haunt"
set desc = "Follow and haunt a mob."
var/target = getmobs()[input]
if(!target) return
ManualFollow(target)
var/datum/vueui_module/ghost_menu/GM = new /datum/vueui_module/ghost_menu(usr)
GM.ui_interact(usr)
// This is the ghost's follow verb with an argument
/mob/abstract/observer/proc/ManualFollow(var/atom/movable/target)
+66
View File
@@ -0,0 +1,66 @@
/datum/vueui_module/ghost_menu/ui_interact(var/mob/user)
var/datum/vueui/ui = SSvueui.get_open_ui(user, src)
if(!ui)
ui = new(user, src, "misc-ghostmenu", 800, 450, "Ghost Menu", state = interactive_state)
ui.open()
/datum/vueui_module/ghost_menu/Topic(ref, href_list)
if(..())
return TRUE
var/mob/abstract/observer/ghost = usr
if(!istype(ghost))
return TRUE
if(href_list["follow_target"])
ghost.ManualFollow(locate(href_list["follow_target"]) in mob_list)
return FALSE
/datum/vueui_module/ghost_menu/vueui_data_change(var/list/data, var/mob/user, var/datum/vueui/ui)
if(!data)
data = list()
var/list/menu_info = list()
var/list/names = list()
var/list/namecounts = list()
for(var/mob/M in mob_list)
var/category
var/name = M.name
if(name in names)
namecounts[name]++
name = "[name] ([namecounts[name]])"
else
names.Add(name)
namecounts[name] = 1
if(M.real_name && M.real_name != M.name)
name += " \[[M.real_name]\]"
if(!M.mind)
if(M.stat == DEAD)
category = "Dead NPCs"
else
category = "NPCs"
else if(M.stat == DEAD)
if(isobserver(M))
name += " \[Ghost\]"
category = "Observer"
else
name += " \[Dead\]"
category = "Dead"
else
if(player_is_obvious_antag(M.mind))
category = M.mind.special_role
else if(isobserver(user))
var/mob/abstract/observer/O = user
if(O.antagHUD && player_is_antag(M.mind))
category = M.mind.special_role
if(!category)
category = "Alive"
if(menu_info[category])
menu_info[category] += list(list("name" = name, "ref" = ref(M))) // this is how to add a list to a list without them merging
else
menu_info[category] = list(list("name" = name, "ref" = ref(M)))
data["menuinfo"] = menu_info
return data
+6
View File
@@ -0,0 +1,6 @@
author: Geeves
delete-after: True
changes:
- rscadd: "The standard ghost follow menu has been replaced with an upgraded VueUI version."
@@ -0,0 +1,16 @@
<template>
<div>
<div v-for="(cat, catname) in menuinfo" :key="cat">
<h3>{{ catname }}</h3>
<vui-button v-for="thing in cat" :class="{'button' : 1}" :params="{ follow_target: thing.ref }" :key="thing.ref">{{ thing.name }}</vui-button>
</div>
</div>
</template>
<script>
export default {
data() {
return this.$root.$data.state;
}
}
</script>