mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-06-08 15:46:07 +01:00
a03f170f16
Ports (and adjusts) Baystation12/Baystation12#12521 et al. Essentially brings our visualnet code up to the standard of three years ago, rather than five. Side effects of merging may include but are not limited to loss of AI vision, helmet camera failure, garbage collection implosion, infinite turf loops, and unintended layer shenanigans. High-level changes: Overall, visualnet/chunk procs have been renamed and refactored to be clear as to their function. Fix some layering issues related to magic numbers, these have been set to constants. Visualnets now track source movement rather than overriding individual mob/obj procs. Adds obfuscation underlay to complicate memory fudging to remove camera static. Cameras now only add themselves to the cameranet if they're on open (non-restricted) networks. Helmet cameras now use cameras themselves rather than network defines. Adds a sorted object list insertion helper. The Camera MIU (presently unused) should now function properly. Unused cultnet / cult mask deleted because refactoring that would likely kill the few brain cells I have left
341 lines
7.5 KiB
Plaintext
341 lines
7.5 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.
|
|
*/
|
|
/obj/screen
|
|
name = ""
|
|
icon = 'icons/mob/screen/generic.dmi'
|
|
layer = SCREEN_LAYER
|
|
unacidable = 1
|
|
var/obj/master = null //A reference to the object in the slot. Grabs or items, generally.
|
|
appearance_flags = NO_CLIENT_COLOR
|
|
|
|
/obj/screen/Destroy(force = FALSE)
|
|
master = null
|
|
screen_loc = null
|
|
return ..()
|
|
|
|
/obj/screen/text
|
|
icon = null
|
|
icon_state = null
|
|
mouse_opacity = 0
|
|
screen_loc = "CENTER-7,CENTER-7"
|
|
maptext_height = 480
|
|
maptext_width = 480
|
|
|
|
|
|
/obj/screen/inventory
|
|
var/slot_id //The indentifier for the slot. It has nothing to do with ID cards.
|
|
|
|
|
|
/obj/screen/close
|
|
name = "close"
|
|
|
|
/obj/screen/close/Click()
|
|
if(master)
|
|
if(istype(master, /obj/item/storage))
|
|
var/obj/item/storage/S = master
|
|
S.close(usr)
|
|
return 1
|
|
|
|
|
|
/obj/screen/item_action
|
|
var/obj/item/owner
|
|
|
|
/obj/screen/item_action/Destroy()
|
|
. = ..()
|
|
owner = null
|
|
|
|
/obj/screen/item_action/Click()
|
|
if(!usr || !owner)
|
|
return 1
|
|
if(!usr.canClick())
|
|
return
|
|
|
|
if(usr.stat || usr.restrained() || usr.stunned || usr.lying)
|
|
return 1
|
|
|
|
if(!(owner in usr))
|
|
return 1
|
|
|
|
owner.ui_action_click()
|
|
return 1
|
|
|
|
/obj/screen/grab
|
|
name = "grab"
|
|
|
|
/obj/screen/grab/Click()
|
|
var/obj/item/grab/G = master
|
|
G.s_click(src)
|
|
return 1
|
|
|
|
/obj/screen/grab/attack_hand()
|
|
return
|
|
|
|
/obj/screen/grab/attackby()
|
|
return
|
|
|
|
|
|
/obj/screen/storage
|
|
name = "storage"
|
|
layer = SCREEN_LAYER
|
|
screen_loc = "7,7 to 10,8"
|
|
|
|
/obj/screen/storage/Click()
|
|
if(!usr.canClick())
|
|
return 1
|
|
if(usr.stat || usr.paralysis || usr.stunned || usr.weakened)
|
|
return 1
|
|
if(master)
|
|
var/obj/item/I = usr.get_active_hand()
|
|
if(I)
|
|
usr.ClickOn(master)
|
|
return 1
|
|
|
|
/obj/screen/zone_sel
|
|
name = "damage zone"
|
|
icon_state = "zone_sel"
|
|
screen_loc = ui_zonesel
|
|
var/selecting = BP_CHEST
|
|
|
|
/obj/screen/zone_sel/Click(location, control,params)
|
|
var/list/PL = params2list(params)
|
|
var/icon_x = text2num(PL["icon-x"])
|
|
var/icon_y = text2num(PL["icon-y"])
|
|
var/old_selecting = selecting //We're only going to update_icon() if there's been a change
|
|
|
|
switch(icon_y)
|
|
if(1 to 3) //Feet
|
|
switch(icon_x)
|
|
if(10 to 15)
|
|
selecting = BP_R_FOOT
|
|
if(17 to 22)
|
|
selecting = BP_L_FOOT
|
|
else
|
|
return 1
|
|
if(4 to 9) //Legs
|
|
switch(icon_x)
|
|
if(10 to 15)
|
|
selecting = BP_R_LEG
|
|
if(17 to 22)
|
|
selecting = BP_L_LEG
|
|
else
|
|
return 1
|
|
if(10 to 13) //Hands and groin
|
|
switch(icon_x)
|
|
if(8 to 11)
|
|
selecting = BP_R_HAND
|
|
if(12 to 20)
|
|
selecting = BP_GROIN
|
|
if(21 to 24)
|
|
selecting = BP_L_HAND
|
|
else
|
|
return 1
|
|
if(14 to 22) //Chest and arms to shoulders
|
|
switch(icon_x)
|
|
if(8 to 11)
|
|
selecting = BP_R_ARM
|
|
if(12 to 20)
|
|
selecting = BP_CHEST
|
|
if(21 to 24)
|
|
selecting = BP_L_ARM
|
|
else
|
|
return 1
|
|
if(23 to 30) //Head, but we need to check for eye or mouth
|
|
if(icon_x in 12 to 20)
|
|
selecting = BP_HEAD
|
|
switch(icon_y)
|
|
if(23 to 24)
|
|
if(icon_x in 15 to 17)
|
|
selecting = "mouth"
|
|
if(26) //Eyeline, eyes are on 15 and 17
|
|
if(icon_x in 14 to 18)
|
|
selecting = BP_EYES
|
|
if(25 to 27)
|
|
if(icon_x in 15 to 17)
|
|
selecting = BP_EYES
|
|
|
|
if(old_selecting != selecting)
|
|
update_icon()
|
|
return 1
|
|
|
|
/obj/screen/zone_sel/proc/set_selected_zone(bodypart)
|
|
var/old_selecting = selecting
|
|
selecting = bodypart
|
|
if(old_selecting != selecting)
|
|
update_icon()
|
|
|
|
/obj/screen/zone_sel/update_icon()
|
|
cut_overlays()
|
|
add_overlay(image('icons/mob/zone_sel.dmi', "[selecting]"))
|
|
|
|
/obj/screen/Click(location, control, params)
|
|
if(!usr) return 1
|
|
switch(name)
|
|
if("toggle")
|
|
if(usr.hud_used.inventory_shown)
|
|
usr.hud_used.inventory_shown = 0
|
|
usr.client.screen -= usr.hud_used.other
|
|
else
|
|
usr.hud_used.inventory_shown = 1
|
|
usr.client.screen += usr.hud_used.other
|
|
|
|
usr.hud_used.hidden_inventory_update()
|
|
|
|
if("equip")
|
|
if(ishuman(usr))
|
|
var/mob/living/carbon/human/H = usr
|
|
H.quick_equip()
|
|
|
|
if("resist")
|
|
if(isliving(usr))
|
|
var/mob/living/L = usr
|
|
L.resist()
|
|
|
|
if("act_intent")
|
|
usr.a_intent_change("right")
|
|
if(I_HELP)
|
|
usr.a_intent = I_HELP
|
|
usr.hud_used.action_intent.icon_state = "intent_help"
|
|
if(I_HURT)
|
|
usr.a_intent = I_HURT
|
|
usr.hud_used.action_intent.icon_state = "intent_harm"
|
|
if(I_GRAB)
|
|
usr.a_intent = I_GRAB
|
|
usr.hud_used.action_intent.icon_state = "intent_grab"
|
|
if(I_DISARM)
|
|
usr.a_intent = I_DISARM
|
|
usr.hud_used.action_intent.icon_state = "intent_disarm"
|
|
|
|
if("pull")
|
|
usr.stop_pulling()
|
|
if("throw")
|
|
if(!usr.stat && isturf(usr.loc) && !usr.restrained())
|
|
usr:toggle_throw_mode()
|
|
if("drop")
|
|
if(usr.client)
|
|
usr.client.drop_item()
|
|
|
|
if("up hint")
|
|
var/turf/T = GetAbove(usr)
|
|
if (!T)
|
|
to_chat(usr, "<span class='notice'>There is nothing above you!</span>")
|
|
else if (T.is_hole)
|
|
to_chat(usr, "<span class='notice'>There's no roof above your head! You can see up!</span>")
|
|
else
|
|
to_chat(usr, "<span class='notice'>You see a ceiling staring back at you.</span>")
|
|
|
|
if("module")
|
|
if(isrobot(usr))
|
|
var/mob/living/silicon/robot/R = usr
|
|
// if(R.module)
|
|
// R.hud_used.toggle_show_robot_modules()
|
|
// return 1
|
|
R.pick_module()
|
|
|
|
if("inventory")
|
|
if(isrobot(usr))
|
|
var/mob/living/silicon/robot/R = usr
|
|
if(R.module)
|
|
R.hud_used.toggle_show_robot_modules()
|
|
return 1
|
|
else
|
|
to_chat(R, "You haven't selected a module yet.")
|
|
|
|
if("radio")
|
|
if(issilicon(usr))
|
|
usr:radio_menu()
|
|
if("panel")
|
|
if(issilicon(usr))
|
|
usr:installed_modules()
|
|
|
|
if("store")
|
|
if(isrobot(usr))
|
|
var/mob/living/silicon/robot/R = usr
|
|
if(R.module)
|
|
R.uneq_active()
|
|
else
|
|
to_chat(R, "You haven't selected a module yet.")
|
|
|
|
else
|
|
return 0
|
|
return 1
|
|
|
|
/obj/screen/inventory/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(!usr.canClick())
|
|
return 1
|
|
if(usr.stat || usr.paralysis || usr.stunned || usr.weakened)
|
|
return 1
|
|
switch(name)
|
|
if(BP_R_HAND)
|
|
if(iscarbon(usr))
|
|
var/mob/living/carbon/C = usr
|
|
C.activate_hand("r")
|
|
if(BP_L_HAND)
|
|
if(iscarbon(usr))
|
|
var/mob/living/carbon/C = usr
|
|
C.activate_hand("l")
|
|
if("swap")
|
|
usr:swap_hand()
|
|
if("hand")
|
|
usr:swap_hand()
|
|
else
|
|
if(usr.attack_ui(slot_id))
|
|
usr.update_inv_l_hand(0)
|
|
usr.update_inv_r_hand(0)
|
|
return 1
|
|
|
|
/obj/screen/movement_intent
|
|
name = "mov_intent"
|
|
screen_loc = ui_movi
|
|
layer = SCREEN_LAYER
|
|
|
|
//This updates the run/walk button on the hud
|
|
/obj/screen/movement_intent/proc/update_move_icon(var/mob/living/user)
|
|
if (!user.client)
|
|
return
|
|
|
|
if (user.max_stamina == -1 || user.stamina == user.max_stamina)
|
|
if (user.stamina_bar)
|
|
QDEL_NULL(user.stamina_bar)
|
|
else
|
|
if (!user.stamina_bar)
|
|
user.stamina_bar = new(user, user.max_stamina, src)
|
|
|
|
user.stamina_bar.update(user.stamina)
|
|
|
|
if (user.m_intent == "run")
|
|
icon_state = "running"
|
|
else
|
|
icon_state = "walking"
|
|
|
|
/obj/screen/movement_intent/Click(location, control, params)
|
|
if(!usr)
|
|
return 1
|
|
var/list/modifiers = params2list(params)
|
|
|
|
if(iscarbon(usr))
|
|
var/mob/living/carbon/C = usr
|
|
if (modifiers["alt"])
|
|
C.set_walk_speed()
|
|
return
|
|
|
|
if(C.legcuffed)
|
|
to_chat(C, "<span class='notice'>You are legcuffed! You cannot run until you get [C.legcuffed] removed!</span>")
|
|
C.m_intent = "walk" //Just incase
|
|
C.hud_used.move_intent.icon_state = "walking"
|
|
return 1
|
|
switch(usr.m_intent)
|
|
if("run")
|
|
usr.m_intent = "walk"
|
|
if("walk")
|
|
usr.m_intent = "run"
|
|
|
|
update_move_icon(usr)
|