mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-01-08 08:23:49 +00:00
Add observer HUD from /tg/, refactor HUDs
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
if(istype(src, /mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/H = src
|
||||
H.hud_used = new /datum/hud(H)
|
||||
H.instantiate_hud(H.hud_used)
|
||||
H.create_mob_hud(H.hud_used)
|
||||
return ..()
|
||||
|
||||
/mob/living/Destroy()
|
||||
|
||||
@@ -129,6 +129,7 @@
|
||||
if(!name) //To prevent nameless ghosts
|
||||
name = capitalize(pick(first_names_male)) + " " + capitalize(pick(last_names))
|
||||
real_name = name
|
||||
animate(src, pixel_y = 2, time = 10, loop = -1)
|
||||
..()
|
||||
|
||||
/mob/observer/dead/Topic(href, href_list)
|
||||
@@ -318,6 +319,11 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
|
||||
to_chat(usr, "Not when you're not dead!")
|
||||
return
|
||||
|
||||
if(!A)
|
||||
A = input(usr, "Select an area:", "Ghost Teleport") as null|anything in return_sorted_areas()
|
||||
if(!A)
|
||||
return
|
||||
|
||||
usr.forceMove(pick(get_area_turfs(A)))
|
||||
usr.on_mob_jump()
|
||||
|
||||
@@ -326,6 +332,11 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
|
||||
set name = "Follow" // "Haunt"
|
||||
set desc = "Follow and haunt a mob."
|
||||
|
||||
if(!input)
|
||||
input = input(usr, "Select a mob:", "Ghost Follow") as null|anything in getmobs()
|
||||
if(!input)
|
||||
return
|
||||
|
||||
var/target = getmobs()[input]
|
||||
if(!target) return
|
||||
ManualFollow(target)
|
||||
@@ -359,6 +370,45 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
|
||||
forceMove(T)
|
||||
sleep(15)
|
||||
|
||||
var/icon/I = icon(target.icon,target.icon_state,target.dir)
|
||||
|
||||
var/orbitsize = (I.Width()+I.Height())*0.5
|
||||
orbitsize -= (orbitsize/world.icon_size)*(world.icon_size*0.25)
|
||||
|
||||
var/rot_seg
|
||||
|
||||
/* We don't have this pref yet
|
||||
switch(ghost_orbit)
|
||||
if(GHOST_ORBIT_TRIANGLE)
|
||||
rot_seg = 3
|
||||
if(GHOST_ORBIT_SQUARE)
|
||||
rot_seg = 4
|
||||
if(GHOST_ORBIT_PENTAGON)
|
||||
rot_seg = 5
|
||||
if(GHOST_ORBIT_HEXAGON)
|
||||
rot_seg = 6
|
||||
else //Circular
|
||||
rot_seg = 36 //360/10 bby, smooth enough aproximation of a circle
|
||||
*/
|
||||
|
||||
orbit(target, orbitsize, FALSE, 20, rot_seg)
|
||||
|
||||
/mob/observer/dead/orbit()
|
||||
set_dir(2) //reset dir so the right directional sprites show up
|
||||
return ..()
|
||||
|
||||
/mob/observer/dead/stop_orbit(datum/component/orbiter/orbits)
|
||||
. = ..()
|
||||
//restart our floating animation after orbit is done.
|
||||
pixel_y = 0
|
||||
pixel_x = 0
|
||||
transform = null
|
||||
animate(src, pixel_y = 2, time = 10, loop = -1)
|
||||
|
||||
/mob/observer/dead/proc/stop_following()
|
||||
following = null
|
||||
stop_orbit()
|
||||
|
||||
/mob/proc/update_following()
|
||||
. = get_turf(src)
|
||||
for(var/mob/observer/dead/M in following_mobs)
|
||||
@@ -373,7 +423,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
|
||||
|
||||
/mob/Destroy()
|
||||
for(var/mob/observer/dead/M in following_mobs)
|
||||
M.following = null
|
||||
M.stop_following()
|
||||
following_mobs = null
|
||||
return ..()
|
||||
|
||||
@@ -381,7 +431,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
|
||||
if(ismob(following))
|
||||
var/mob/M = following
|
||||
M.following_mobs -= src
|
||||
following = null
|
||||
stop_following()
|
||||
return ..()
|
||||
|
||||
/mob/Moved(atom/old_loc, direction, forced = FALSE)
|
||||
@@ -406,35 +456,28 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
|
||||
set category = "Ghost"
|
||||
set name = "Jump to Mob"
|
||||
set desc = "Teleport to a mob"
|
||||
set popup_menu = FALSE //VOREStation Edit - Declutter.
|
||||
if(istype(usr, /mob/observer/dead)) //Make sure they're an observer!
|
||||
var/target = getmobs()[input]
|
||||
if (!target)//Make sure we actually have a target
|
||||
return
|
||||
else
|
||||
var/mob/M = target //Destination mob
|
||||
var/turf/T = get_turf(M) //Turf of the destination mob
|
||||
set popup_menu = FALSE
|
||||
|
||||
if(T && isturf(T)) //Make sure the turf exists, then move the source to that destination.
|
||||
forceMove(T)
|
||||
following = null
|
||||
else
|
||||
to_chat(src, "This mob is not located in the game world.")
|
||||
/*
|
||||
/mob/observer/dead/verb/boo()
|
||||
set category = "Ghost"
|
||||
set name = "Boo!"
|
||||
set desc= "Scare your crew members because of boredom!"
|
||||
|
||||
if(bootime > world.time) return
|
||||
var/obj/machinery/light/L = locate(/obj/machinery/light) in view(1, src)
|
||||
if(L)
|
||||
L.flicker()
|
||||
bootime = world.time + 600
|
||||
if(!istype(usr, /mob/observer/dead)) //Make sure they're an observer!
|
||||
return
|
||||
//Maybe in the future we can add more <i>spooky</i> code here!
|
||||
return
|
||||
*/
|
||||
|
||||
if(!input)
|
||||
input = input(usr, "Select a mob:", "Ghost Jump") as null|anything in getmobs()
|
||||
if(!input)
|
||||
return
|
||||
|
||||
var/target = getmobs()[input]
|
||||
if (!target)//Make sure we actually have a target
|
||||
return
|
||||
else
|
||||
var/mob/M = target //Destination mob
|
||||
var/turf/T = get_turf(M) //Turf of the destination mob
|
||||
|
||||
if(T && isturf(T)) //Make sure the turf exists, then move the source to that destination.
|
||||
forceMove(T)
|
||||
stop_following()
|
||||
else
|
||||
to_chat(src, "This mob is not located in the game world.")
|
||||
|
||||
/mob/observer/dead/memory()
|
||||
set hidden = 1
|
||||
@@ -445,7 +488,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
|
||||
to_chat(src, "<font color='red'>You are dead! You have no mind to store memory!</font>")
|
||||
|
||||
/mob/observer/dead/Post_Incorpmove()
|
||||
following = null
|
||||
stop_following()
|
||||
|
||||
/mob/observer/dead/verb/analyze_air()
|
||||
set name = "Analyze Air"
|
||||
@@ -813,14 +856,20 @@ mob/observer/dead/MayRespawn(var/feedback = 0)
|
||||
set category = "Ghost"
|
||||
set name = "Blank pAI alert"
|
||||
set desc = "Flash an indicator light on available blank pAI devices for a smidgen of hope."
|
||||
if(usr.client.prefs.be_special & BE_PAI)
|
||||
|
||||
if(usr.client.prefs?.be_special & BE_PAI)
|
||||
var/count = 0
|
||||
for(var/obj/item/device/paicard/p in all_pai_cards)
|
||||
var/obj/item/device/paicard/PP = p
|
||||
if(PP.pai == null)
|
||||
count++
|
||||
PP.icon = 'icons/obj/pda_vr.dmi' // VOREStation Edit
|
||||
PP.overlays += "pai-ghostalert"
|
||||
spawn(54)
|
||||
PP.overlays.Cut()
|
||||
to_chat(usr,"<span class='notice'>Flashing the displays of [count] unoccupied PAIs.</span>")
|
||||
else
|
||||
to_chat(usr,"<span class='warning'>You have 'Be pAI' disabled in your character prefs, so we can't help you.</span>")
|
||||
|
||||
/mob/observer/dead/speech_bubble_appearance()
|
||||
return "ghost"
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/mob/living/simple_mob/instantiate_hud(var/datum/hud/hud)
|
||||
if(!client)
|
||||
return //Why bother.
|
||||
/mob/living/simple_mob/create_mob_hud(datum/hud/HUD)
|
||||
..()
|
||||
|
||||
var/ui_style = 'icons/mob/screen1_animal.dmi'
|
||||
if(ui_icons)
|
||||
@@ -14,9 +13,9 @@
|
||||
var/list/hotkeybuttons = list()
|
||||
var/list/slot_info = list()
|
||||
|
||||
hud.adding = adding
|
||||
hud.other = other
|
||||
hud.hotkeybuttons = hotkeybuttons
|
||||
HUD.adding = adding
|
||||
HUD.other = other
|
||||
HUD.hotkeybuttons = hotkeybuttons
|
||||
|
||||
var/list/hud_elements = list()
|
||||
var/obj/screen/using
|
||||
@@ -65,8 +64,8 @@
|
||||
using.screen_loc = ui_acti
|
||||
using.color = ui_color
|
||||
using.alpha = ui_alpha
|
||||
hud.adding += using
|
||||
hud.action_intent = using
|
||||
HUD.adding += using
|
||||
HUD.action_intent = using
|
||||
|
||||
hud_elements |= using
|
||||
|
||||
@@ -82,8 +81,8 @@
|
||||
using.screen_loc = ui_acti
|
||||
using.alpha = ui_alpha
|
||||
using.layer = LAYER_HUD_ITEM //These sit on the intent box
|
||||
hud.adding += using
|
||||
hud.help_intent = using
|
||||
HUD.adding += using
|
||||
HUD.help_intent = using
|
||||
|
||||
ico = new(ui_style, "black")
|
||||
ico.MapColors(0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, -1,-1,-1,-1)
|
||||
@@ -94,8 +93,8 @@
|
||||
using.screen_loc = ui_acti
|
||||
using.alpha = ui_alpha
|
||||
using.layer = LAYER_HUD_ITEM
|
||||
hud.adding += using
|
||||
hud.disarm_intent = using
|
||||
HUD.adding += using
|
||||
HUD.disarm_intent = using
|
||||
|
||||
ico = new(ui_style, "black")
|
||||
ico.MapColors(0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, -1,-1,-1,-1)
|
||||
@@ -106,8 +105,8 @@
|
||||
using.screen_loc = ui_acti
|
||||
using.alpha = ui_alpha
|
||||
using.layer = LAYER_HUD_ITEM
|
||||
hud.adding += using
|
||||
hud.grab_intent = using
|
||||
HUD.adding += using
|
||||
HUD.grab_intent = using
|
||||
|
||||
ico = new(ui_style, "black")
|
||||
ico.MapColors(0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, -1,-1,-1,-1)
|
||||
@@ -118,8 +117,8 @@
|
||||
using.screen_loc = ui_acti
|
||||
using.alpha = ui_alpha
|
||||
using.layer = LAYER_HUD_ITEM
|
||||
hud.adding += using
|
||||
hud.hurt_intent = using
|
||||
HUD.adding += using
|
||||
HUD.hurt_intent = using
|
||||
|
||||
//Move intent (walk/run)
|
||||
using = new /obj/screen()
|
||||
@@ -129,8 +128,8 @@
|
||||
using.screen_loc = ui_movi
|
||||
using.color = ui_color
|
||||
using.alpha = ui_alpha
|
||||
hud.adding += using
|
||||
hud.move_intent = using
|
||||
HUD.adding += using
|
||||
HUD.move_intent = using
|
||||
|
||||
//Resist button
|
||||
using = new /obj/screen()
|
||||
@@ -140,7 +139,7 @@
|
||||
using.screen_loc = ui_pull_resist
|
||||
using.color = ui_color
|
||||
using.alpha = ui_alpha
|
||||
hud.hotkeybuttons += using
|
||||
HUD.hotkeybuttons += using
|
||||
|
||||
//Pull button
|
||||
pullin = new /obj/screen()
|
||||
@@ -148,7 +147,7 @@
|
||||
pullin.icon_state = "pull0"
|
||||
pullin.name = "pull"
|
||||
pullin.screen_loc = ui_pull_resist
|
||||
hud.hotkeybuttons += pullin
|
||||
HUD.hotkeybuttons += pullin
|
||||
hud_elements |= pullin
|
||||
|
||||
//Health status
|
||||
@@ -159,8 +158,6 @@
|
||||
healths.screen_loc = ui_health
|
||||
hud_elements |= healths
|
||||
|
||||
|
||||
|
||||
pain = new /obj/screen( null )
|
||||
|
||||
zone_sel = new /obj/screen/zone_sel( null )
|
||||
@@ -181,7 +178,7 @@
|
||||
using.screen_loc = ui_drop_throw
|
||||
using.color = ui_color
|
||||
using.alpha = ui_alpha
|
||||
hud.hotkeybuttons += using
|
||||
HUD.hotkeybuttons += using
|
||||
|
||||
//Equip detail
|
||||
using = new /obj/screen()
|
||||
@@ -191,7 +188,7 @@
|
||||
using.screen_loc = ui_equip
|
||||
using.color = ui_color
|
||||
using.alpha = ui_alpha
|
||||
hud.adding += using
|
||||
HUD.adding += using
|
||||
|
||||
//Hand slots themselves
|
||||
inv_box = new /obj/screen/inventory/hand()
|
||||
@@ -205,8 +202,8 @@
|
||||
inv_box.slot_id = slot_r_hand
|
||||
inv_box.color = ui_color
|
||||
inv_box.alpha = ui_alpha
|
||||
hud.r_hand_hud_object = inv_box
|
||||
hud.adding += inv_box
|
||||
HUD.r_hand_hud_object = inv_box
|
||||
HUD.adding += inv_box
|
||||
slot_info["[slot_r_hand]"] = inv_box.screen_loc
|
||||
|
||||
inv_box = new /obj/screen/inventory/hand()
|
||||
@@ -220,8 +217,8 @@
|
||||
inv_box.slot_id = slot_l_hand
|
||||
inv_box.color = ui_color
|
||||
inv_box.alpha = ui_alpha
|
||||
hud.l_hand_hud_object = inv_box
|
||||
hud.adding += inv_box
|
||||
HUD.l_hand_hud_object = inv_box
|
||||
HUD.adding += inv_box
|
||||
slot_info["[slot_l_hand]"] = inv_box.screen_loc
|
||||
|
||||
//Swaphand titlebar
|
||||
@@ -232,7 +229,7 @@
|
||||
using.screen_loc = ui_swaphand1
|
||||
using.color = ui_color
|
||||
using.alpha = ui_alpha
|
||||
hud.adding += using
|
||||
HUD.adding += using
|
||||
|
||||
using = new /obj/screen/inventory()
|
||||
using.name = "hand"
|
||||
@@ -241,7 +238,7 @@
|
||||
using.screen_loc = ui_swaphand2
|
||||
using.color = ui_color
|
||||
using.alpha = ui_alpha
|
||||
hud.adding += using
|
||||
HUD.adding += using
|
||||
|
||||
//Throw button
|
||||
throw_icon = new /obj/screen()
|
||||
@@ -251,15 +248,13 @@
|
||||
throw_icon.screen_loc = ui_drop_throw
|
||||
throw_icon.color = ui_color
|
||||
throw_icon.alpha = ui_alpha
|
||||
hud.hotkeybuttons += throw_icon
|
||||
HUD.hotkeybuttons += throw_icon
|
||||
hud_elements |= throw_icon
|
||||
|
||||
extra_huds(hud,ui_style,hud_elements)
|
||||
extra_huds(HUD, HUD.ui_style, hud_elements)
|
||||
|
||||
client.screen = list()
|
||||
|
||||
client.screen += hud_elements
|
||||
client.screen += adding + hotkeybuttons
|
||||
client.screen += client.void
|
||||
|
||||
return
|
||||
if(client)
|
||||
client.screen = list()
|
||||
client.screen += hud_elements
|
||||
client.screen += adding + hotkeybuttons
|
||||
client.screen += client.void
|
||||
|
||||
Reference in New Issue
Block a user