Onclick
This commit is contained in:
@@ -9,8 +9,8 @@
|
||||
/obj/screen
|
||||
name = ""
|
||||
icon = 'icons/mob/screen_gen.dmi'
|
||||
layer = ABOVE_HUD_LAYER
|
||||
plane = ABOVE_HUD_PLANE
|
||||
layer = HUD_LAYER
|
||||
plane = HUD_PLANE
|
||||
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
|
||||
appearance_flags = APPEARANCE_UI
|
||||
var/obj/master = null //A reference to the object in the slot. Grabs or items, generally.
|
||||
@@ -102,6 +102,7 @@
|
||||
var/slot_id // The indentifier for the slot. It has nothing to do with ID cards.
|
||||
var/icon_empty // Icon when empty. For now used only by humans.
|
||||
var/icon_full // Icon when contains an item. For now used only by humans.
|
||||
var/list/object_overlays = list()
|
||||
layer = HUD_LAYER
|
||||
plane = HUD_PLANE
|
||||
|
||||
@@ -125,6 +126,15 @@
|
||||
usr.update_inv_hands()
|
||||
return 1
|
||||
|
||||
/obj/screen/inventory/MouseEntered()
|
||||
..()
|
||||
add_overlays()
|
||||
|
||||
/obj/screen/inventory/MouseExited()
|
||||
..()
|
||||
cut_overlay(object_overlays)
|
||||
object_overlays.Cut()
|
||||
|
||||
/obj/screen/inventory/update_icon()
|
||||
if(!icon_empty)
|
||||
icon_empty = icon_state
|
||||
@@ -135,6 +145,26 @@
|
||||
else
|
||||
icon_state = icon_empty
|
||||
|
||||
/obj/screen/inventory/proc/add_overlays()
|
||||
var/mob/user = hud.mymob
|
||||
|
||||
if(hud && user && slot_id)
|
||||
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, disable_warning = TRUE))
|
||||
item_overlay.color = "#FF0000"
|
||||
else
|
||||
item_overlay.color = "#00ff00"
|
||||
|
||||
object_overlays += item_overlay
|
||||
add_overlay(object_overlays)
|
||||
|
||||
/obj/screen/inventory/hand
|
||||
var/mutable_appearance/handcuff_overlay
|
||||
var/static/mutable_appearance/blocked_overlay = mutable_appearance('icons/mob/screen_gen.dmi', "blocked")
|
||||
@@ -310,17 +340,21 @@
|
||||
/obj/screen/mov_intent/Click()
|
||||
toggle(usr)
|
||||
|
||||
/obj/screen/mov_intent/update_icon(mob/user)
|
||||
if(!user && hud)
|
||||
user = hud.mymob
|
||||
if(!user)
|
||||
return
|
||||
switch(user.m_intent)
|
||||
if(MOVE_INTENT_WALK)
|
||||
icon_state = "walking"
|
||||
if(MOVE_INTENT_RUN)
|
||||
icon_state = "running"
|
||||
|
||||
/obj/screen/mov_intent/proc/toggle(mob/user)
|
||||
if(isobserver(user))
|
||||
return
|
||||
switch(user.m_intent)
|
||||
if("run")
|
||||
user.m_intent = MOVE_INTENT_WALK
|
||||
icon_state = "walking"
|
||||
if("walk")
|
||||
user.m_intent = MOVE_INTENT_RUN
|
||||
icon_state = "running"
|
||||
user.update_icons()
|
||||
user.toggle_move_intent(user)
|
||||
|
||||
/obj/screen/pull
|
||||
name = "stop pulling"
|
||||
@@ -352,6 +386,27 @@
|
||||
var/mob/living/L = usr
|
||||
L.resist()
|
||||
|
||||
/obj/screen/rest
|
||||
name = "rest"
|
||||
icon = 'icons/mob/screen_midnight.dmi'
|
||||
icon_state = "act_rest"
|
||||
layer = HUD_LAYER
|
||||
plane = HUD_PLANE
|
||||
|
||||
/obj/screen/rest/Click()
|
||||
if(isliving(usr))
|
||||
var/mob/living/L = usr
|
||||
L.lay_down()
|
||||
|
||||
/obj/screen/rest/update_icon(mob/mymob)
|
||||
if(!isliving(mymob))
|
||||
return
|
||||
var/mob/living/L = mymob
|
||||
if(!L.resting)
|
||||
icon_state = "act_rest"
|
||||
else
|
||||
icon_state = "act_rest0"
|
||||
|
||||
/obj/screen/storage
|
||||
name = "storage"
|
||||
icon_state = "block"
|
||||
@@ -373,7 +428,7 @@
|
||||
if(master)
|
||||
var/obj/item/I = usr.get_active_held_item()
|
||||
if(I)
|
||||
master.attackby(I, usr, params)
|
||||
master.attackby(null, I, usr, params)
|
||||
return TRUE
|
||||
|
||||
/obj/screen/throw_catch
|
||||
@@ -391,6 +446,8 @@
|
||||
icon_state = "zone_sel"
|
||||
screen_loc = ui_zonesel
|
||||
var/selecting = BODY_ZONE_CHEST
|
||||
var/static/list/hover_overlays_cache = list()
|
||||
var/hovering
|
||||
|
||||
/obj/screen/zone_sel/Click(location, control,params)
|
||||
if(isobserver(usr))
|
||||
@@ -399,52 +456,86 @@
|
||||
var/list/PL = params2list(params)
|
||||
var/icon_x = text2num(PL["icon-x"])
|
||||
var/icon_y = text2num(PL["icon-y"])
|
||||
var/choice
|
||||
var/choice = get_zone_at(icon_x, icon_y)
|
||||
if (!choice)
|
||||
return 1
|
||||
|
||||
return set_selected_zone(choice, usr)
|
||||
|
||||
/obj/screen/zone_sel/MouseEntered(location, control, params)
|
||||
MouseMove(location, control, params)
|
||||
|
||||
/obj/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
|
||||
layer = ABOVE_HUD_LAYER
|
||||
plane = ABOVE_HUD_PLANE
|
||||
|
||||
/obj/screen/zone_sel/MouseExited(location, control, params)
|
||||
if(!isobserver(usr) && hovering)
|
||||
vis_contents -= hover_overlays_cache[hovering]
|
||||
hovering = null
|
||||
|
||||
/obj/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)
|
||||
choice = BODY_ZONE_R_LEG
|
||||
return BODY_ZONE_R_LEG
|
||||
if(17 to 22)
|
||||
choice = BODY_ZONE_L_LEG
|
||||
else
|
||||
return 1
|
||||
return BODY_ZONE_L_LEG
|
||||
if(10 to 13) //Hands and groin
|
||||
switch(icon_x)
|
||||
if(8 to 11)
|
||||
choice = BODY_ZONE_R_ARM
|
||||
return BODY_ZONE_R_ARM
|
||||
if(12 to 20)
|
||||
choice = BODY_ZONE_PRECISE_GROIN
|
||||
return BODY_ZONE_PRECISE_GROIN
|
||||
if(21 to 24)
|
||||
choice = BODY_ZONE_L_ARM
|
||||
else
|
||||
return 1
|
||||
return BODY_ZONE_L_ARM
|
||||
if(14 to 22) //Chest and arms to shoulders
|
||||
switch(icon_x)
|
||||
if(8 to 11)
|
||||
choice = BODY_ZONE_R_ARM
|
||||
return BODY_ZONE_R_ARM
|
||||
if(12 to 20)
|
||||
choice = BODY_ZONE_CHEST
|
||||
return BODY_ZONE_CHEST
|
||||
if(21 to 24)
|
||||
choice = BODY_ZONE_L_ARM
|
||||
else
|
||||
return 1
|
||||
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)
|
||||
choice = BODY_ZONE_HEAD
|
||||
switch(icon_y)
|
||||
if(23 to 24)
|
||||
if(icon_x in 15 to 17)
|
||||
choice = BODY_ZONE_PRECISE_MOUTH
|
||||
return BODY_ZONE_PRECISE_MOUTH
|
||||
if(26) //Eyeline, eyes are on 15 and 17
|
||||
if(icon_x in 14 to 18)
|
||||
choice = BODY_ZONE_PRECISE_EYES
|
||||
return BODY_ZONE_PRECISE_EYES
|
||||
if(25 to 27)
|
||||
if(icon_x in 15 to 17)
|
||||
choice = BODY_ZONE_PRECISE_EYES
|
||||
|
||||
return set_selected_zone(choice, usr)
|
||||
return BODY_ZONE_PRECISE_EYES
|
||||
return BODY_ZONE_HEAD
|
||||
|
||||
/obj/screen/zone_sel/proc/set_selected_zone(choice, mob/user)
|
||||
if(isobserver(user))
|
||||
@@ -559,11 +650,6 @@
|
||||
icon_state = "mood5"
|
||||
screen_loc = ui_mood
|
||||
|
||||
/obj/screen/mood/Click()
|
||||
GET_COMPONENT_FROM(mood, /datum/component/mood, usr)
|
||||
if(mood)
|
||||
mood.print_mood()
|
||||
|
||||
/obj/screen/splash
|
||||
icon = 'icons/blank_title.png'
|
||||
icon_state = ""
|
||||
|
||||
Reference in New Issue
Block a user