mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
* skill issue to do: -chemistry -virology -balance stuff -??? i forgor * this shouldn't be here * more stuff * bit of rebalancing * i hate javascript!!! * more balance * stuff * things * fixed some stuff * hacking * ghost roles * fix * crafting skill requirements * real menu button * cyborg * fixed IPC repair * new skill icons * fix + rebalancing * skill icons 2 * exploit fixed * chem dispenser fix * fix again * clockwork style * genetics * science fix * progress bar indicators * minor refactor + rebalance * dna console fix * exploit fix * progress bar * more like evilscript * remove exploit * fix * why is round ID a string??? * another day, another exploit fixed
936 lines
25 KiB
Plaintext
936 lines
25 KiB
Plaintext
/*
|
|
Screen objects
|
|
Todo: improve/re-implement
|
|
|
|
Screen objects are only used for the hud and should not appear anywhere "in-game".
|
|
They are used with the client/screen list and the screen_loc var.
|
|
For more information, see the byond documentation on the screen_loc and screen vars.
|
|
*/
|
|
/atom/movable/screen
|
|
name = ""
|
|
icon = 'icons/mob/screen_gen.dmi'
|
|
// NOTE: screen objects do NOT change their plane to match the z layer of their owner
|
|
// You shouldn't need this, but if you ever do and it's widespread, reconsider what you're doing.
|
|
plane = HUD_PLANE
|
|
animate_movement = SLIDE_STEPS
|
|
speech_span = SPAN_ROBOT
|
|
appearance_flags = APPEARANCE_UI
|
|
/// A reference to the object in the slot. Grabs or items, generally.
|
|
var/datum/weakref/master_ref = null
|
|
/// A reference to the owner HUD, if any.
|
|
VAR_PRIVATE/datum/hud/hud = null
|
|
|
|
/**
|
|
* Map name assigned to this object.
|
|
* Automatically set by /client/proc/add_obj_to_map.
|
|
*/
|
|
var/assigned_map
|
|
/**
|
|
* Mark this object as garbage-collectible after you clean the map
|
|
* it was registered on.
|
|
*
|
|
* This could probably be changed to be a proc, for conditional removal.
|
|
* But for now, this works.
|
|
*/
|
|
var/del_on_map_removal = TRUE
|
|
|
|
/// If FALSE, this will not be cleared when calling /client/clear_screen()
|
|
var/clear_with_screen = TRUE
|
|
|
|
/atom/movable/screen/New(datum/hud/new_hud)
|
|
. = ..()
|
|
if(istype(new_hud))
|
|
hud = new_hud
|
|
|
|
/atom/movable/screen/Destroy()
|
|
master_ref = null
|
|
hud = null
|
|
return ..()
|
|
|
|
/atom/movable/screen/examine(mob/user)
|
|
return list()
|
|
|
|
/atom/movable/screen/orbit()
|
|
return
|
|
|
|
/atom/movable/screen/proc/component_click(atom/movable/screen/component_button/component, params)
|
|
return
|
|
|
|
/// Returns the mob this is being displayed to, if any
|
|
/atom/movable/screen/proc/get_mob()
|
|
return hud?.mymob
|
|
|
|
/atom/movable/screen/text
|
|
icon = null
|
|
icon_state = null
|
|
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
|
screen_loc = "CENTER-7,CENTER-7"
|
|
maptext_height = 480
|
|
maptext_width = 480
|
|
|
|
/atom/movable/screen/swap_hand
|
|
plane = HUD_PLANE
|
|
name = "swap hand"
|
|
|
|
/atom/movable/screen/swap_hand/Click()
|
|
// At this point in client Click() code we have passed the 1/10 sec check and little else
|
|
// We don't even know if it's a middle click
|
|
if(world.time <= usr.next_move)
|
|
return 1
|
|
|
|
if(usr.incapacitated())
|
|
return 1
|
|
|
|
if(ismob(usr))
|
|
var/mob/M = usr
|
|
M.swap_hand()
|
|
return 1
|
|
|
|
/atom/movable/screen/craft
|
|
name = "crafting menu"
|
|
icon = 'icons/mob/screen_midnight.dmi'
|
|
icon_state = "craft"
|
|
screen_loc = ui_crafting
|
|
|
|
/atom/movable/screen/area_creator
|
|
name = "create new area"
|
|
icon = 'icons/mob/screen_midnight.dmi'
|
|
icon_state = "area_edit"
|
|
screen_loc = ui_building
|
|
|
|
/atom/movable/screen/area_creator/Click()
|
|
if(usr.incapacitated() || (isobserver(usr) && !IsAdminGhost(usr)))
|
|
return TRUE
|
|
var/area/A = get_area(usr)
|
|
if(!A.outdoors)
|
|
to_chat(usr, span_warning("There is already a defined structure here."))
|
|
return TRUE
|
|
create_area(usr)
|
|
|
|
/atom/movable/screen/language_menu
|
|
name = "language menu"
|
|
icon = 'icons/mob/screen_midnight.dmi'
|
|
icon_state = "talk_wheel"
|
|
screen_loc = ui_language_menu
|
|
|
|
/atom/movable/screen/language_menu/Click()
|
|
var/mob/M = usr
|
|
var/datum/language_holder/H = M.get_language_holder()
|
|
H.open_language_menu(usr)
|
|
|
|
/atom/movable/screen/skill_menu
|
|
name = "skills menu"
|
|
icon = 'icons/mob/screen_midnight.dmi'
|
|
icon_state = "skill_menu"
|
|
screen_loc = ui_skill_menu
|
|
var/list/allocated_skills = list(
|
|
SKILL_PHYSIOLOGY = EXP_NONE,
|
|
SKILL_MECHANICAL = EXP_NONE,
|
|
SKILL_TECHNICAL = EXP_NONE,
|
|
SKILL_SCIENCE = EXP_NONE,
|
|
SKILL_FITNESS = EXP_NONE,
|
|
)
|
|
var/allocated_points = EXP_NONE
|
|
|
|
/atom/movable/screen/skill_menu/Click()
|
|
ui_interact(usr)
|
|
|
|
/atom/movable/screen/skill_menu/ui_interact(mob/user, datum/tgui/ui)
|
|
if(!user.mind)
|
|
CRASH("[user.type] ([user]) tried to use the skill menu without a mind!")
|
|
ui = SStgui.try_update_ui(user, src, ui)
|
|
if (!ui)
|
|
ui = new(user, src, "SkillMenu", "Allocate Skill Points")
|
|
ui.open()
|
|
|
|
/atom/movable/screen/skill_menu/ui_data(mob/user)
|
|
var/list/data = list()
|
|
var/list/skill_data = list()
|
|
for(var/skill in user.mind.skills)
|
|
skill_data.Add(list(list(
|
|
"base" = user.get_skill(skill),
|
|
"allocated" = allocated_skills[skill],
|
|
"exp_progress" = user.mind?.exp_progress[skill],
|
|
)))
|
|
data["skills"] = skill_data
|
|
data["skill_points"] = user.mind.skill_points
|
|
data["allocated_points"] = allocated_points
|
|
data["exceptional_skill"] = HAS_MIND_TRAIT(user, TRAIT_EXCEPTIONAL_SKILL)
|
|
return data
|
|
|
|
/atom/movable/screen/skill_menu/ui_static_data(mob/user)
|
|
var/static/list/data = list(
|
|
"exp_per_level" = EXPERIENCE_PER_LEVEL
|
|
)
|
|
return data
|
|
|
|
/atom/movable/screen/skill_menu/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
var/mob/user = usr
|
|
if(!user.mind)
|
|
CRASH("User ([user]) without a mind attempted to allocate skill points!")
|
|
switch(action)
|
|
if("confirm")
|
|
if(allocated_points > user.mind.skill_points)
|
|
stack_trace("[user] attempted to allocate [allocated_points] skill points when they only had [user.mind.skill_points] available!")
|
|
message_admins("[key_name_admin(user)] may have attempted an exploit to gain more skill points than intended!")
|
|
qdel(allocated_skills)
|
|
allocated_skills = list(
|
|
SKILL_PHYSIOLOGY = EXP_NONE,
|
|
SKILL_MECHANICAL = EXP_NONE,
|
|
SKILL_TECHNICAL = EXP_NONE,
|
|
SKILL_SCIENCE = EXP_NONE,
|
|
SKILL_FITNESS = EXP_NONE,
|
|
)
|
|
allocated_points = EXP_NONE
|
|
return TRUE
|
|
for(var/skill in user.mind.skills)
|
|
user.adjust_skill(skill, allocated_skills[skill], max_skill = EXP_GENIUS)
|
|
allocated_skills[skill] = EXP_NONE
|
|
user.mind.skill_points -= allocated_points
|
|
allocated_points = EXP_NONE
|
|
if(!user.mind.skill_points)
|
|
user.clear_alert("skill points")
|
|
return TRUE
|
|
if("allocate")
|
|
if(allocated_points + params["amount"] > user.mind.skill_points)
|
|
return TRUE
|
|
if(allocated_points + params["amount"] < 0)
|
|
return TRUE
|
|
if(allocated_skills[params["skill"]] + params["amount"] + user.get_skill(params["skill"]) > (4 + HAS_MIND_TRAIT(user, TRAIT_EXCEPTIONAL_SKILL)))
|
|
return TRUE
|
|
if(allocated_skills[params["skill"]] + params["amount"] < 0)
|
|
return TRUE
|
|
allocated_skills[params["skill"]] += params["amount"]
|
|
allocated_points += params["amount"]
|
|
return TRUE
|
|
|
|
/atom/movable/screen/skill_menu/ui_status(mob/user)
|
|
if(!user.mind)
|
|
return UI_CLOSE
|
|
return UI_INTERACTIVE
|
|
|
|
/atom/movable/screen/skill_menu/ui_state(mob/user)
|
|
return GLOB.always_state
|
|
|
|
/atom/movable/screen/skill_menu/ui_assets(mob/user)
|
|
return list(
|
|
get_asset_datum(/datum/asset/spritesheet/crafting),
|
|
)
|
|
|
|
/atom/movable/screen/ghost/pai
|
|
name = "pAI Candidate"
|
|
icon = 'icons/mob/screen_midnight.dmi'
|
|
icon_state = "pai_setup"
|
|
screen_loc = ui_ghost_pai
|
|
|
|
/atom/movable/screen/ghost/pai/Click()
|
|
var/mob/dead/observer/G = usr
|
|
G.register_pai()
|
|
|
|
/atom/movable/screen/ghost/med_scan
|
|
name = "Toggle Medical Scan"
|
|
icon = 'icons/mob/screen_midnight.dmi'
|
|
icon_state = "med_scan"
|
|
screen_loc = ui_ghost_med
|
|
|
|
/atom/movable/screen/ghost/med_scan/Click()
|
|
var/mob/dead/observer/G = usr
|
|
G.toggle_health_scan()
|
|
|
|
/atom/movable/screen/ghost/chem_scan
|
|
name = "Toggle Chemical Scan"
|
|
icon = 'icons/mob/screen_midnight.dmi'
|
|
icon_state = "chem_scan"
|
|
screen_loc = ui_ghost_chem
|
|
|
|
/atom/movable/screen/ghost/chem_scan/Click()
|
|
var/mob/dead/observer/G = usr
|
|
G.toggle_chemical_scan()
|
|
|
|
/atom/movable/screen/ghost/nanite_scan
|
|
name = "Toggle Nanite Scan"
|
|
icon = 'icons/mob/screen_midnight.dmi'
|
|
icon_state = "nanite_scan"
|
|
screen_loc = ui_ghost_nanite
|
|
|
|
/atom/movable/screen/ghost/nanite_scan/Click()
|
|
var/mob/dead/observer/G = usr
|
|
G.toggle_nanite_scan()
|
|
|
|
/atom/movable/screen/ghost/wound_scan
|
|
name = "Toggle Wound Scan"
|
|
icon = 'icons/mob/screen_midnight.dmi'
|
|
icon_state = "wound_scan"
|
|
screen_loc = ui_ghost_wound
|
|
|
|
/atom/movable/screen/ghost/wound_scan/Click()
|
|
var/mob/dead/observer/G = usr
|
|
G.toggle_wound_scan()
|
|
|
|
/atom/movable/screen/language_menu/ghost
|
|
screen_loc = ui_ghost_language_menu
|
|
|
|
/atom/movable/screen/inventory
|
|
/// The identifier for the slot. It has nothing to do with ID cards.
|
|
var/slot_id
|
|
/// Icon when empty. For now used only by humans.
|
|
var/icon_empty
|
|
/// Icon when contains an item. For now used only by humans.
|
|
var/icon_full
|
|
/// The overlay when hovering over with an item in your hand
|
|
var/image/object_overlay
|
|
plane = HUD_PLANE
|
|
|
|
/atom/movable/screen/inventory/Click(location, control, params)
|
|
// At this point in client Click() code we have passed the 1/10 sec check and little else
|
|
// We don't even know if it's a middle click
|
|
if(world.time <= usr.next_move)
|
|
return TRUE
|
|
|
|
if(usr.incapacitated())
|
|
return TRUE
|
|
if(ismecha(usr.loc)) // stops inventory actions in a mech
|
|
return TRUE
|
|
|
|
if(hud && hud.mymob && slot_id)
|
|
var/obj/item/inv_item = hud.mymob.get_item_by_slot(slot_id)
|
|
if(inv_item)
|
|
return inv_item.Click(location, control, params)
|
|
|
|
if(usr.attack_ui(slot_id, params))
|
|
usr.update_inv_hands()
|
|
return TRUE
|
|
|
|
/atom/movable/screen/inventory/MouseEntered()
|
|
..()
|
|
add_overlays()
|
|
|
|
/atom/movable/screen/inventory/MouseExited()
|
|
..()
|
|
cut_overlay(object_overlay)
|
|
QDEL_NULL(object_overlay)
|
|
|
|
/atom/movable/screen/inventory/update_icon_state()
|
|
if(!icon_empty)
|
|
icon_empty = icon_state
|
|
|
|
if(hud?.mymob && slot_id && icon_full)
|
|
icon_state = hud.mymob.get_item_by_slot(slot_id) ? icon_full : icon_empty
|
|
return ..()
|
|
|
|
/atom/movable/screen/inventory/proc/add_overlays()
|
|
var/mob/user = hud?.mymob
|
|
|
|
if(!user || !slot_id)
|
|
return
|
|
|
|
var/obj/item/holding = user.get_active_held_item()
|
|
|
|
if(!holding || user.get_item_by_slot(slot_id))
|
|
return
|
|
|
|
var/image/item_overlay = image(holding)
|
|
item_overlay.alpha = 92
|
|
|
|
if(!user.can_equip(holding, slot_id, TRUE))
|
|
item_overlay.color = "#FF0000"
|
|
else
|
|
item_overlay.color = "#00ff00"
|
|
|
|
cut_overlay(object_overlay)
|
|
object_overlay = item_overlay
|
|
add_overlay(object_overlay)
|
|
|
|
/atom/movable/screen/inventory/hand
|
|
var/mutable_appearance/handcuff_overlay
|
|
var/static/mutable_appearance/blocked_overlay = mutable_appearance('icons/mob/screen_gen.dmi', "blocked")
|
|
var/held_index = 0
|
|
|
|
/atom/movable/screen/inventory/hand/update_overlays()
|
|
. = ..()
|
|
|
|
if(!handcuff_overlay)
|
|
var/state = (!(held_index % 2)) ? "markus" : "gabrielle"
|
|
handcuff_overlay = mutable_appearance('icons/mob/screen_gen.dmi', state)
|
|
|
|
if(!hud?.mymob)
|
|
return
|
|
|
|
if(iscarbon(hud.mymob))
|
|
var/mob/living/carbon/C = hud.mymob
|
|
if(C.handcuffed)
|
|
. += handcuff_overlay
|
|
|
|
if(held_index)
|
|
if(!C.has_hand_for_held_index(held_index))
|
|
. += blocked_overlay
|
|
|
|
if(held_index == hud.mymob.active_hand_index)
|
|
. += (held_index % 2) ? "lhandactive" : "rhandactive"
|
|
|
|
|
|
/atom/movable/screen/inventory/hand/Click(location, control, params)
|
|
// At this point in client Click() code we have passed the 1/10 sec check and little else
|
|
// We don't even know if it's a middle click
|
|
if(world.time <= usr.next_move)
|
|
return 1
|
|
if(usr.incapacitated() || isobserver(usr))
|
|
return 1
|
|
if (ismecha(usr.loc)) // stops inventory actions in a mech
|
|
return 1
|
|
|
|
if(hud.mymob.active_hand_index == held_index)
|
|
var/obj/item/I = hud.mymob.get_active_held_item()
|
|
if(I)
|
|
I.Click(location, control, params)
|
|
else
|
|
hud.mymob.swap_hand(held_index)
|
|
return 1
|
|
|
|
/atom/movable/screen/close
|
|
name = "close"
|
|
plane = ABOVE_HUD_PLANE
|
|
icon_state = "backpack_close"
|
|
|
|
/atom/movable/screen/close/Initialize(mapload, new_master)
|
|
. = ..()
|
|
master_ref = WEAKREF(new_master)
|
|
|
|
/atom/movable/screen/close/Click()
|
|
var/datum/component/storage/storage = master_ref?.resolve()
|
|
if(!storage)
|
|
return
|
|
storage.hide_from(usr)
|
|
return TRUE
|
|
|
|
/atom/movable/screen/drop
|
|
name = "drop"
|
|
icon = 'icons/mob/screen_midnight.dmi'
|
|
icon_state = "act_drop"
|
|
plane = HUD_PLANE
|
|
|
|
/atom/movable/screen/drop/Click()
|
|
if(usr.stat == CONSCIOUS)
|
|
usr.dropItemToGround(usr.get_active_held_item())
|
|
|
|
/atom/movable/screen/combattoggle
|
|
name = "toggle combat mode"
|
|
icon = 'icons/mob/screen_midnight.dmi'
|
|
icon_state = "combat_off"
|
|
screen_loc = ui_combat_toggle
|
|
|
|
/atom/movable/screen/combattoggle/New(loc, ...)
|
|
. = ..()
|
|
update_appearance(UPDATE_ICON)
|
|
|
|
/atom/movable/screen/combattoggle/Click()
|
|
if(isliving(usr))
|
|
var/mob/living/owner = usr
|
|
owner.set_combat_mode(!owner.combat_mode, FALSE)
|
|
update_appearance(UPDATE_ICON)
|
|
|
|
/atom/movable/screen/combattoggle/update_icon_state()
|
|
. = ..()
|
|
var/mob/living/user = hud?.mymob
|
|
if(!istype(user) || !user.client)
|
|
return
|
|
if(user.grab_mode)
|
|
icon_state = "grab" // indicate that you're grabbing instead of whatever else
|
|
else
|
|
icon_state = user.combat_mode ? "combat" : "combat_off" //Treats the combat_mode
|
|
|
|
//Version of the combat toggle with the flashy overlay
|
|
/atom/movable/screen/combattoggle/flashy
|
|
///Mut appearance for flashy border
|
|
var/mutable_appearance/flashy
|
|
|
|
/atom/movable/screen/combattoggle/flashy/update_overlays()
|
|
. = ..()
|
|
var/mob/living/user = hud?.mymob
|
|
if(!istype(user) || !user.client)
|
|
return
|
|
|
|
if(user.combat_mode)
|
|
if(!flashy)
|
|
flashy = mutable_appearance('icons/mob/screen_gen.dmi', "togglefull_flash")
|
|
flashy.color = "#C62727"
|
|
. += flashy
|
|
|
|
/atom/movable/screen/combattoggle/robot
|
|
icon = 'icons/mob/screen_cyborg.dmi'
|
|
screen_loc = ui_borg_intents
|
|
|
|
/atom/movable/screen/mov_intent
|
|
name = "run/walk toggle"
|
|
icon = 'icons/mob/screen_midnight.dmi'
|
|
icon_state = "running"
|
|
|
|
/atom/movable/screen/mov_intent/Click()
|
|
toggle(usr)
|
|
|
|
/atom/movable/screen/mov_intent/update_icon_state()
|
|
switch(hud?.mymob?.m_intent)
|
|
if(MOVE_INTENT_WALK)
|
|
icon_state = "walking"
|
|
if(MOVE_INTENT_RUN)
|
|
icon_state = "running"
|
|
return ..()
|
|
|
|
/atom/movable/screen/mov_intent/proc/toggle(mob/user)
|
|
if(isobserver(user))
|
|
return
|
|
user.toggle_move_intent(user)
|
|
|
|
/atom/movable/screen/pull
|
|
name = "stop pulling"
|
|
icon = 'icons/mob/screen_midnight.dmi'
|
|
icon_state = "pull"
|
|
|
|
/atom/movable/screen/pull/Click()
|
|
if(isobserver(usr))
|
|
return
|
|
usr.stop_pulling()
|
|
|
|
/atom/movable/screen/pull/update_icon_state()
|
|
icon_state = "[initial(icon_state)][hud?.mymob?.pulling ? null : 0]"
|
|
return ..()
|
|
|
|
/atom/movable/screen/resist
|
|
name = "resist"
|
|
icon = 'icons/mob/screen_midnight.dmi'
|
|
icon_state = "act_resist"
|
|
plane = HUD_PLANE
|
|
|
|
/atom/movable/screen/resist/Click()
|
|
if(isliving(usr))
|
|
var/mob/living/L = usr
|
|
L.resist()
|
|
|
|
/atom/movable/screen/rest
|
|
name = "rest"
|
|
icon = 'icons/mob/screen_midnight.dmi'
|
|
icon_state = "act_rest"
|
|
plane = HUD_PLANE
|
|
|
|
/atom/movable/screen/rest/Click()
|
|
if(isliving(usr))
|
|
var/mob/living/L = usr
|
|
L.lay_down()
|
|
|
|
/atom/movable/screen/rest/update_icon_state()
|
|
var/mob/living/user = hud?.mymob
|
|
if(!istype(user))
|
|
return ..()
|
|
icon_state = "[initial(icon_state)][user.resting ? 0 : null]"
|
|
return ..()
|
|
|
|
/atom/movable/screen/storage
|
|
name = "storage"
|
|
icon_state = "block"
|
|
screen_loc = "7,7 to 10,8"
|
|
plane = HUD_PLANE
|
|
|
|
/atom/movable/screen/storage/Initialize(mapload, new_master)
|
|
. = ..()
|
|
master_ref = WEAKREF(new_master)
|
|
|
|
/atom/movable/screen/storage/Click(location, control, params)
|
|
var/datum/component/storage/storage_master = master_ref?.resolve()
|
|
if(!istype(storage_master))
|
|
return FALSE
|
|
|
|
if(world.time <= usr.next_move)
|
|
return TRUE
|
|
if(usr.incapacitated())
|
|
return TRUE
|
|
if (ismecha(usr.loc)) // stops inventory actions in a mech
|
|
return TRUE
|
|
|
|
var/obj/item/inserted = usr.get_active_held_item()
|
|
if(inserted)
|
|
storage_master.attackby(null, inserted, usr, params)
|
|
return TRUE
|
|
|
|
/atom/movable/screen/throw_catch
|
|
name = "throw/catch"
|
|
icon = 'icons/mob/screen_midnight.dmi'
|
|
icon_state = "act_throw_off"
|
|
|
|
/atom/movable/screen/throw_catch/Click()
|
|
if(iscarbon(usr))
|
|
var/mob/living/carbon/C = usr
|
|
C.toggle_throw_mode()
|
|
|
|
/atom/movable/screen/zone_sel
|
|
name = "damage zone"
|
|
icon_state = "zone_sel"
|
|
screen_loc = ui_zonesel
|
|
var/overlay_icon = 'icons/mob/screen_gen.dmi'
|
|
var/static/list/hover_overlays_cache = list()
|
|
var/hovering
|
|
|
|
/atom/movable/screen/zone_sel/Click(location, control,params)
|
|
if(isobserver(usr))
|
|
return
|
|
|
|
var/list/PL = params2list(params)
|
|
var/icon_x = text2num(PL["icon-x"])
|
|
var/icon_y = text2num(PL["icon-y"])
|
|
var/choice = get_zone_at(icon_x, icon_y)
|
|
if (!choice)
|
|
return 1
|
|
|
|
return set_selected_zone(choice, usr)
|
|
|
|
/atom/movable/screen/zone_sel/MouseEntered(location, control, params)
|
|
. = ..()
|
|
MouseMove(location, control, params)
|
|
|
|
/atom/movable/screen/zone_sel/MouseMove(location, control, params)
|
|
if(isobserver(usr))
|
|
return
|
|
|
|
var/list/PL = params2list(params)
|
|
var/icon_x = text2num(PL["icon-x"])
|
|
var/icon_y = text2num(PL["icon-y"])
|
|
var/choice = get_zone_at(icon_x, icon_y)
|
|
|
|
if(hovering == choice)
|
|
return
|
|
vis_contents -= hover_overlays_cache[hovering]
|
|
hovering = choice
|
|
|
|
var/obj/effect/overlay/zone_sel/overlay_object = hover_overlays_cache[choice]
|
|
if(!overlay_object)
|
|
overlay_object = new
|
|
overlay_object.icon_state = "[choice]"
|
|
hover_overlays_cache[choice] = overlay_object
|
|
vis_contents += overlay_object
|
|
|
|
/obj/effect/overlay/zone_sel
|
|
icon = 'icons/mob/screen_gen.dmi'
|
|
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
|
alpha = 128
|
|
anchored = TRUE
|
|
plane = ABOVE_HUD_PLANE
|
|
|
|
/atom/movable/screen/zone_sel/MouseExited(location, control, params)
|
|
if(!isobserver(usr) && hovering)
|
|
vis_contents -= hover_overlays_cache[hovering]
|
|
hovering = null
|
|
|
|
/atom/movable/screen/zone_sel/proc/get_zone_at(icon_x, icon_y)
|
|
switch(icon_y)
|
|
if(1 to 9) //Legs
|
|
switch(icon_x)
|
|
if(10 to 15)
|
|
return BODY_ZONE_R_LEG
|
|
if(17 to 22)
|
|
return BODY_ZONE_L_LEG
|
|
if(10 to 13) //Hands and groin
|
|
switch(icon_x)
|
|
if(8 to 11)
|
|
return BODY_ZONE_R_ARM
|
|
if(12 to 20)
|
|
return BODY_ZONE_PRECISE_GROIN
|
|
if(21 to 24)
|
|
return BODY_ZONE_L_ARM
|
|
if(14 to 22) //Chest and arms to shoulders
|
|
switch(icon_x)
|
|
if(8 to 11)
|
|
return BODY_ZONE_R_ARM
|
|
if(12 to 20)
|
|
return BODY_ZONE_CHEST
|
|
if(21 to 24)
|
|
return BODY_ZONE_L_ARM
|
|
if(23 to 30) //Head, but we need to check for eye or mouth
|
|
if(icon_x in 12 to 20)
|
|
switch(icon_y)
|
|
if(23 to 24)
|
|
if(icon_x in 15 to 17)
|
|
return BODY_ZONE_PRECISE_MOUTH
|
|
if(26) //Eyeline, eyes are on 15 and 17
|
|
if(icon_x in 14 to 18)
|
|
return BODY_ZONE_PRECISE_EYES
|
|
if(25 to 27)
|
|
if(icon_x in 15 to 17)
|
|
return BODY_ZONE_PRECISE_EYES
|
|
return BODY_ZONE_HEAD
|
|
|
|
/atom/movable/screen/zone_sel/proc/set_selected_zone(choice, mob/user)
|
|
if(user != hud?.mymob)
|
|
return
|
|
|
|
if(choice != hud.mymob.zone_selected)
|
|
hud.mymob.zone_selected = choice
|
|
update_appearance(UPDATE_ICON)
|
|
SEND_SIGNAL(user, COMSIG_MOB_SELECTED_ZONE_SET, choice)
|
|
return 1
|
|
|
|
/atom/movable/screen/zone_sel/update_overlays()
|
|
. = ..()
|
|
if(!hud?.mymob)
|
|
return
|
|
. += mutable_appearance(overlay_icon, "[hud.mymob.zone_selected]")
|
|
|
|
/atom/movable/screen/zone_sel/alien
|
|
icon = 'icons/mob/screen_alien.dmi'
|
|
overlay_icon = 'icons/mob/screen_alien.dmi'
|
|
|
|
/atom/movable/screen/zone_sel/robot
|
|
icon = 'icons/mob/screen_cyborg.dmi'
|
|
|
|
/atom/movable/screen/flash
|
|
name = "flash"
|
|
icon_state = "blank"
|
|
blend_mode = BLEND_ADD
|
|
screen_loc = "WEST,SOUTH to EAST,NORTH"
|
|
layer = FLASH_LAYER
|
|
plane = FULLSCREEN_PLANE
|
|
|
|
/atom/movable/screen/damageoverlay
|
|
icon = 'icons/mob/screen_full.dmi'
|
|
icon_state = "oxydamageoverlay0"
|
|
name = "dmg"
|
|
blend_mode = BLEND_MULTIPLY
|
|
screen_loc = "CENTER-7,CENTER-7"
|
|
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
|
layer = UI_DAMAGE_LAYER
|
|
plane = FULLSCREEN_PLANE
|
|
|
|
/atom/movable/screen/healths
|
|
name = "health"
|
|
icon_state = "health0"
|
|
screen_loc = ui_health
|
|
|
|
/atom/movable/screen/healths/alien
|
|
icon = 'icons/mob/screen_alien.dmi'
|
|
screen_loc = ui_alien_health
|
|
|
|
/atom/movable/screen/healths/robot
|
|
icon = 'icons/mob/screen_cyborg.dmi'
|
|
screen_loc = ui_borg_health
|
|
|
|
/atom/movable/screen/healths/blob
|
|
name = "blob health"
|
|
icon_state = "block"
|
|
screen_loc = ui_internal
|
|
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
|
|
|
/atom/movable/screen/healths/blob/overmind
|
|
name = "overmind health"
|
|
icon = 'icons/mob/blob.dmi'
|
|
screen_loc = ui_blobbernaut_overmind_health
|
|
icon_state = "corehealth"
|
|
|
|
/atom/movable/screen/healths/guardian
|
|
name = "summoner health"
|
|
icon = 'icons/mob/guardian.dmi'
|
|
icon_state = "base"
|
|
screen_loc = ui_health
|
|
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
|
|
|
/atom/movable/screen/healths/clock
|
|
icon = 'icons/mob/actions.dmi'
|
|
icon_state = "bg_clock"
|
|
screen_loc = ui_living_health
|
|
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
|
|
|
/atom/movable/screen/healths/clock/gear
|
|
icon = 'icons/mob/clockwork_mobs.dmi'
|
|
icon_state = "bg_gear"
|
|
screen_loc = ui_internal
|
|
|
|
/atom/movable/screen/healths/revenant
|
|
name = "essence"
|
|
icon = 'icons/mob/actions.dmi'
|
|
icon_state = "bg_revenant"
|
|
screen_loc = ui_health
|
|
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
|
|
|
/atom/movable/screen/healths/construct
|
|
icon = 'icons/mob/screen_construct.dmi'
|
|
icon_state = "artificer_health0"
|
|
screen_loc = ui_construct_health
|
|
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
|
|
|
/atom/movable/screen/healths/slime
|
|
icon = 'icons/mob/screen_slime.dmi'
|
|
icon_state = "slime_health0"
|
|
screen_loc = ui_slime_health
|
|
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
|
|
|
/atom/movable/screen/healths/lavaland_elite
|
|
icon = 'icons/mob/screen_elite.dmi'
|
|
icon_state = "elite_health0"
|
|
screen_loc = ui_living_health
|
|
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
|
|
|
/atom/movable/screen/healthdoll
|
|
name = "health doll"
|
|
screen_loc = ui_healthdoll
|
|
|
|
/atom/movable/screen/healthdoll/Click()
|
|
if (ishuman(usr))
|
|
var/mob/living/carbon/human/H = usr
|
|
H.check_self_for_injuries()
|
|
|
|
/atom/movable/screen/healthdoll/living
|
|
icon_state = "fullhealth0"
|
|
screen_loc = ui_living_healthdoll
|
|
var/filtered = FALSE //so we don't repeatedly create the mask of the mob every update
|
|
|
|
/atom/movable/screen/mood
|
|
name = "mood"
|
|
icon_state = "mood5"
|
|
screen_loc = ui_mood
|
|
|
|
/atom/movable/screen/sanity
|
|
name = "sanity"
|
|
icon_state = "sanity3"
|
|
screen_loc = ui_mood
|
|
|
|
/atom/movable/screen/splash
|
|
icon = 'icons/blanks/blank_title.png'
|
|
icon_state = ""
|
|
screen_loc = "1,1"
|
|
plane = SPLASHSCREEN_PLANE
|
|
var/client/holder
|
|
|
|
//INITIALIZE_IMMEDIATE(/atom/movable/screen/splash)
|
|
//We need to change this from /New to /Initialize but i really don't feel like changing the 200 instances of new(src) to new(null, src) in this already massive PR
|
|
/atom/movable/screen/splash/New(datum/hud/new_hud, client/C, visible, use_previous_title)
|
|
. = ..()
|
|
if(!istype(C))
|
|
return
|
|
|
|
holder = C
|
|
|
|
if(!visible)
|
|
alpha = 0
|
|
|
|
if(!use_previous_title)
|
|
if(SStitle.icon)
|
|
icon = SStitle.icon
|
|
else
|
|
if(!SStitle.previous_icon)
|
|
return INITIALIZE_HINT_QDEL
|
|
icon = SStitle.previous_icon
|
|
|
|
holder.screen += src
|
|
|
|
/atom/movable/screen/splash/proc/Fade(out, qdel_after = TRUE)
|
|
if(QDELETED(src))
|
|
return
|
|
if(out)
|
|
animate(src, alpha = 0, time = 3 SECONDS)
|
|
else
|
|
alpha = 0
|
|
animate(src, alpha = 255, time = 3 SECONDS)
|
|
if(qdel_after)
|
|
QDEL_IN(src, 30)
|
|
|
|
/atom/movable/screen/splash/Destroy()
|
|
if(holder)
|
|
holder.screen -= src
|
|
holder = null
|
|
return ..()
|
|
|
|
|
|
/atom/movable/screen/component_button
|
|
var/atom/movable/screen/parent
|
|
|
|
/atom/movable/screen/component_button/Initialize(mapload, atom/movable/screen/parent)
|
|
. = ..()
|
|
src.parent = parent
|
|
|
|
/atom/movable/screen/component_button/Click(params)
|
|
if(parent)
|
|
parent.component_click(src, params)
|
|
|
|
/atom/movable/screen/cooldown_overlay
|
|
name = ""
|
|
icon_state = "cooldown"
|
|
pixel_y = 4
|
|
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
|
appearance_flags = RESET_COLOR | PIXEL_SCALE | RESET_TRANSFORM | KEEP_TOGETHER | RESET_ALPHA
|
|
vis_flags = VIS_INHERIT_ID
|
|
var/end_time = 0
|
|
var/atom/movable/screen/parent_button
|
|
var/datum/callback/callback
|
|
var/timer
|
|
|
|
/atom/movable/screen/cooldown_overlay/Initialize(mapload, button)
|
|
. = ..(mapload)
|
|
parent_button = button
|
|
|
|
/atom/movable/screen/cooldown_overlay/Destroy()
|
|
stop_cooldown()
|
|
deltimer(timer)
|
|
return ..()
|
|
|
|
/atom/movable/screen/cooldown_overlay/proc/start_cooldown(end_time, need_timer = TRUE)
|
|
parent_button.color = "#8000007c"
|
|
parent_button.vis_contents += src
|
|
src.end_time = end_time
|
|
set_maptext("[round((end_time - world.time) / 10, 1)]")
|
|
if(need_timer)
|
|
timer = addtimer(CALLBACK(src, PROC_REF(tick)), 1 SECONDS, TIMER_STOPPABLE)
|
|
|
|
/atom/movable/screen/cooldown_overlay/proc/tick()
|
|
if(world.time >= end_time)
|
|
stop_cooldown()
|
|
return
|
|
set_maptext("[round((end_time - world.time) / 10, 1)]")
|
|
if(timer)
|
|
timer = addtimer(CALLBACK(src, PROC_REF(tick)), 1 SECONDS, TIMER_STOPPABLE)
|
|
|
|
/atom/movable/screen/cooldown_overlay/proc/stop_cooldown()
|
|
parent_button.color = "#ffffffff"
|
|
parent_button.vis_contents -= src
|
|
if(callback)
|
|
callback.Invoke()
|
|
|
|
/atom/movable/screen/cooldown_overlay/proc/set_maptext(time)
|
|
maptext = "<div style=\"font-size:6pt;font:'Arial Black';text-align:center;\">[time]</div>"
|
|
|
|
/proc/start_cooldown(atom/movable/screen/button, time, datum/callback/callback)
|
|
if(!time)
|
|
return
|
|
var/atom/movable/screen/cooldown_overlay/cooldown = new(button, button)
|
|
if(callback)
|
|
cooldown.callback = callback
|
|
cooldown.start_cooldown(time)
|
|
else
|
|
cooldown.start_cooldown(time, FALSE)
|
|
return cooldown
|
|
|
|
/atom/movable/screen/stamina
|
|
name = "stamina"
|
|
icon_state = "stamina0"
|
|
screen_loc = ui_stamina
|
|
|
|
/atom/movable/screen/move
|
|
name = "move up"
|
|
icon_state = "move_up"
|
|
screen_loc = ui_move_up
|
|
var/direction = UP
|
|
|
|
/atom/movable/screen/move/Click(location, control, params)
|
|
. = ..()
|
|
var/mob/M = usr
|
|
switch(direction)
|
|
if(UP)
|
|
M.up()
|
|
if(DOWN)
|
|
M.down()
|
|
|
|
/atom/movable/screen/move/down
|
|
name = "move down"
|
|
icon_state = "move_down"
|
|
screen_loc = ui_move_down
|
|
direction = DOWN
|