mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-10 09:54:52 +00:00
Onclick
This commit is contained in:
@@ -40,7 +40,7 @@
|
||||
*/
|
||||
/atom/Click(location,control,params)
|
||||
if(flags_1 & INITIALIZED_1)
|
||||
SEND_SIGNAL(src, COMSIG_CLICK, location, control, params)
|
||||
SEND_SIGNAL(src, COMSIG_CLICK, location, control, params, usr)
|
||||
usr.ClickOn(src, params)
|
||||
|
||||
/atom/DblClick(location,control,params)
|
||||
@@ -199,17 +199,8 @@
|
||||
|
||||
if (!target.loc)
|
||||
continue
|
||||
GET_COMPONENT_FROM(storage, /datum/component/storage, target.loc)
|
||||
if (storage)
|
||||
var/datum/component/storage/concrete/master = storage.master()
|
||||
if (master)
|
||||
next += master.parent
|
||||
for(var/S in master.slaves)
|
||||
var/datum/component/storage/slave = S
|
||||
next += slave.parent
|
||||
else
|
||||
next += target.loc
|
||||
else
|
||||
|
||||
if(!(SEND_SIGNAL(target.loc, COMSIG_ATOM_CANREACH, next) & COMPONENT_BLOCK_REACH))
|
||||
next += target.loc
|
||||
|
||||
checking = next
|
||||
|
||||
@@ -109,6 +109,7 @@
|
||||
D.onMouseMove(object, location, control, params)
|
||||
if(mob) //CIT CHANGE - passes onmousemove() to mobs
|
||||
mob.onMouseMove(object, location, control, params) //CIT CHANGE - ditto
|
||||
..()
|
||||
|
||||
/datum/proc/onMouseMove(object, location, control, params)
|
||||
return
|
||||
|
||||
@@ -281,7 +281,3 @@
|
||||
using = new /obj/screen/ai/add_multicam()
|
||||
using.screen_loc = ui_ai_add_multicam
|
||||
static_inventory += using
|
||||
|
||||
/mob/living/silicon/ai/create_mob_hud()
|
||||
if(client && !hud_used)
|
||||
hud_used = new /datum/hud/ai(src)
|
||||
|
||||
@@ -338,13 +338,13 @@ or shoot a gun to move around via Newton's 3rd Law of Motion."
|
||||
angle = 0
|
||||
cut_overlays()
|
||||
icon_state = "runed_sense0"
|
||||
desc = "Nar-Sie demands that [sac_objective.target] be sacrificed before the summoning ritual can begin."
|
||||
desc = "Nar'Sie demands that [sac_objective.target] be sacrificed before the summoning ritual can begin."
|
||||
add_overlay(sac_objective.sac_image)
|
||||
else
|
||||
var/datum/objective/eldergod/summon_objective = locate() in antag.cult_team.objectives
|
||||
if(!summon_objective)
|
||||
return
|
||||
desc = "The sacrifice is complete, summon Nar-Sie! The summoning can only take place in [english_list(summon_objective.summon_spots)]!"
|
||||
desc = "The sacrifice is complete, summon Nar'Sie! The summoning can only take place in [english_list(summon_objective.summon_spots)]!"
|
||||
if(icon_state == "runed_sense1")
|
||||
return
|
||||
animate(src, transform = null, time = 1, loop = 0)
|
||||
|
||||
@@ -121,7 +121,3 @@
|
||||
for(var/obj/item/I in H.held_items)
|
||||
I.screen_loc = null
|
||||
H.client.screen -= I
|
||||
|
||||
/mob/living/carbon/alien/humanoid/create_mob_hud()
|
||||
if(client && !hud_used)
|
||||
hud_used = new /datum/hud/alien(src)
|
||||
|
||||
@@ -28,7 +28,3 @@
|
||||
zone_select = new /obj/screen/zone_sel/alien()
|
||||
zone_select.update_icon(mymob)
|
||||
static_inventory += zone_select
|
||||
|
||||
/mob/living/carbon/alien/larva/create_mob_hud()
|
||||
if(client && !hud_used)
|
||||
hud_used = new /datum/hud/larva(src)
|
||||
|
||||
@@ -175,10 +175,3 @@
|
||||
using = new /obj/screen/blob/RelocateCore()
|
||||
using.screen_loc = ui_storage2
|
||||
static_inventory += using
|
||||
|
||||
|
||||
/mob/camera/blob/create_mob_hud()
|
||||
if(client && !hud_used)
|
||||
hud_used = new /datum/hud/blob_overmind(src)
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,3 @@
|
||||
|
||||
healths = new /obj/screen/healths/blob/naut()
|
||||
infodisplay += healths
|
||||
|
||||
/mob/living/simple_animal/hostile/blob/blobbernaut/create_mob_hud()
|
||||
if(client && !hud_used)
|
||||
hud_used = new /datum/hud/blobbernaut(src)
|
||||
|
||||
@@ -11,7 +11,3 @@
|
||||
|
||||
healths = new /obj/screen/healths/construct()
|
||||
infodisplay += healths
|
||||
|
||||
/mob/living/simple_animal/hostile/construct/create_mob_hud()
|
||||
if(client && !hud_used)
|
||||
hud_used = new /datum/hud/constructs(src)
|
||||
|
||||
@@ -59,7 +59,3 @@
|
||||
for(var/obj/item/I in D.held_items)
|
||||
I.screen_loc = null
|
||||
D.client.screen -= I
|
||||
|
||||
/mob/living/carbon/true_devil/create_mob_hud()
|
||||
if(client && !hud_used)
|
||||
hud_used = new /datum/hud/devil(src)
|
||||
|
||||
@@ -110,11 +110,6 @@
|
||||
layer = BLIND_LAYER
|
||||
plane = FULLSCREEN_PLANE
|
||||
|
||||
/obj/screen/fullscreen/depression
|
||||
icon_state = "depression"
|
||||
layer = FLASH_LAYER
|
||||
plane = FULLSCREEN_PLANE
|
||||
|
||||
/obj/screen/fullscreen/curse
|
||||
icon_state = "curse"
|
||||
layer = CURSE_LAYER
|
||||
@@ -123,6 +118,11 @@
|
||||
/obj/screen/fullscreen/impaired
|
||||
icon_state = "impairedoverlay"
|
||||
|
||||
/obj/screen/fullscreen/blurry
|
||||
icon = 'icons/mob/screen_gen.dmi'
|
||||
screen_loc = "WEST,SOUTH to EAST,NORTH"
|
||||
icon_state = "blurry"
|
||||
|
||||
/obj/screen/fullscreen/flash
|
||||
icon = 'icons/mob/screen_gen.dmi'
|
||||
screen_loc = "WEST,SOUTH to EAST,NORTH"
|
||||
|
||||
@@ -76,8 +76,6 @@
|
||||
|
||||
//Dextrous simple mobs can use hands!
|
||||
/mob/living/simple_animal/create_mob_hud()
|
||||
if(client && !hud_used)
|
||||
if(dextrous)
|
||||
hud_used = new dextrous_hud_type(src)
|
||||
else
|
||||
..()
|
||||
hud_type = dextrous_hud_type
|
||||
return ..()
|
||||
|
||||
@@ -87,7 +87,3 @@
|
||||
screenmob.client.screen -= static_inventory
|
||||
else
|
||||
screenmob.client.screen += static_inventory
|
||||
|
||||
/mob/dead/observer/create_mob_hud()
|
||||
if(client && !hud_used)
|
||||
hud_used = new /datum/hud/ghost(src)
|
||||
|
||||
@@ -26,14 +26,6 @@
|
||||
using.screen_loc = ui_back
|
||||
static_inventory += using
|
||||
|
||||
|
||||
/mob/living/simple_animal/hostile/guardian/create_mob_hud()
|
||||
if(client && !hud_used)
|
||||
if(dextrous)
|
||||
..()
|
||||
else
|
||||
hud_used = new /datum/hud/guardian(src)
|
||||
|
||||
/datum/hud/dextrous/guardian/New(mob/living/simple_animal/hostile/guardian/owner) //for a dextrous guardian
|
||||
..()
|
||||
var/obj/screen/using
|
||||
|
||||
@@ -38,6 +38,7 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
|
||||
var/obj/screen/action_intent
|
||||
var/obj/screen/zone_select
|
||||
var/obj/screen/pull_icon
|
||||
var/obj/screen/rest_icon
|
||||
var/obj/screen/throw_icon
|
||||
var/obj/screen/module_store_icon
|
||||
|
||||
@@ -56,7 +57,6 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
|
||||
var/obj/screen/healths
|
||||
var/obj/screen/healthdoll
|
||||
var/obj/screen/internals
|
||||
var/obj/screen/mood
|
||||
|
||||
// subtypes can override this to force a specific UI style
|
||||
var/ui_style
|
||||
@@ -101,7 +101,6 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
|
||||
healths = null
|
||||
healthdoll = null
|
||||
internals = null
|
||||
mood = null
|
||||
lingchemdisplay = null
|
||||
devilsouldisplay = null
|
||||
lingstingdisplay = null
|
||||
@@ -115,10 +114,15 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
|
||||
|
||||
return ..()
|
||||
|
||||
/mob
|
||||
var/hud_type = /datum/hud
|
||||
|
||||
/mob/proc/create_mob_hud()
|
||||
if(client && !hud_used)
|
||||
hud_used = new /datum/hud(src)
|
||||
if(!client || hud_used)
|
||||
return
|
||||
hud_used = new hud_type(src)
|
||||
update_sight()
|
||||
SEND_SIGNAL(src, COMSIG_MOB_HUD_CREATED)
|
||||
|
||||
//Version denotes which style should be displayed. blank or 0 means "next version"
|
||||
/datum/hud/proc/show_hud(version = 0, mob/viewmob)
|
||||
|
||||
@@ -324,10 +324,6 @@
|
||||
healthdoll = new /obj/screen/healthdoll()
|
||||
infodisplay += healthdoll
|
||||
|
||||
if(!CONFIG_GET(flag/disable_human_mood))
|
||||
mood = new /obj/screen/mood()
|
||||
infodisplay += mood
|
||||
|
||||
pull_icon = new /obj/screen/pull()
|
||||
pull_icon.icon = ui_style
|
||||
pull_icon.update_icon(mymob)
|
||||
|
||||
@@ -149,7 +149,3 @@
|
||||
for(var/obj/item/I in M.held_items)
|
||||
I.screen_loc = null
|
||||
M.client.screen -= I
|
||||
|
||||
/mob/living/carbon/monkey/create_mob_hud()
|
||||
if(client && !hud_used)
|
||||
hud_used = new /datum/hud/monkey(src)
|
||||
|
||||
@@ -124,14 +124,16 @@
|
||||
vis_contents -= viewing_turfs
|
||||
if(!width || !height)
|
||||
return
|
||||
var/turf/T = get_turf(center)
|
||||
if(!T)
|
||||
return
|
||||
var/turf/lowerleft = locate(max(1, T.x - round(width/2)), max(1, T.y - round(height/2)), T.z)
|
||||
var/turf/upperright = locate(min(world.maxx, lowerleft.x + width - 1), min(world.maxy, lowerleft.y + height - 1), lowerleft.z)
|
||||
viewing_turfs = block(lowerleft, upperright)
|
||||
viewing_turfs = get_visible_turfs()
|
||||
vis_contents += viewing_turfs
|
||||
|
||||
/obj/screen/movable/pic_in_pic/proc/get_visible_turfs()
|
||||
var/turf/T = get_turf(center)
|
||||
if(!T)
|
||||
return list()
|
||||
var/turf/lowerleft = locate(max(1, T.x - round(width/2)), max(1, T.y - round(height/2)), T.z)
|
||||
var/turf/upperright = locate(min(world.maxx, lowerleft.x + width - 1), min(world.maxy, lowerleft.y + height - 1), lowerleft.z)
|
||||
return block(lowerleft, upperright)
|
||||
|
||||
/obj/screen/movable/pic_in_pic/proc/show_to(client/C)
|
||||
if(C)
|
||||
|
||||
@@ -54,3 +54,9 @@
|
||||
/obj/screen/plane_master/lighting/backdrop(mob/mymob)
|
||||
mymob.overlay_fullscreen("lighting_backdrop_lit", /obj/screen/fullscreen/lighting_backdrop/lit)
|
||||
mymob.overlay_fullscreen("lighting_backdrop_unlit", /obj/screen/fullscreen/lighting_backdrop/unlit)
|
||||
|
||||
/obj/screen/plane_master/camera_static
|
||||
name = "camera static plane master"
|
||||
plane = CAMERA_STATIC_PLANE
|
||||
appearance_flags = PLANE_MASTER
|
||||
blend_mode = BLEND_OVERLAY
|
||||
|
||||
270
code/_onclick/hud/radial.dm
Normal file
270
code/_onclick/hud/radial.dm
Normal file
@@ -0,0 +1,270 @@
|
||||
#define NEXT_PAGE_ID "__next__"
|
||||
|
||||
/obj/screen/radial
|
||||
icon = 'icons/mob/radial.dmi'
|
||||
layer = ABOVE_HUD_LAYER
|
||||
plane = ABOVE_HUD_PLANE
|
||||
var/datum/radial_menu/parent
|
||||
|
||||
/obj/screen/radial/slice
|
||||
icon_state = "radial_slice"
|
||||
var/choice
|
||||
var/next_page = FALSE
|
||||
|
||||
/obj/screen/radial/slice/MouseEntered(location, control, params)
|
||||
. = ..()
|
||||
icon_state = "radial_slice_focus"
|
||||
|
||||
/obj/screen/radial/slice/MouseExited(location, control, params)
|
||||
. = ..()
|
||||
icon_state = "radial_slice"
|
||||
|
||||
/obj/screen/radial/slice/Click(location, control, params)
|
||||
if(usr.client == parent.current_user)
|
||||
if(next_page)
|
||||
parent.next_page()
|
||||
else
|
||||
parent.element_chosen(choice,usr)
|
||||
|
||||
/obj/screen/radial/center
|
||||
name = "Close Menu"
|
||||
icon_state = "radial_center"
|
||||
|
||||
/obj/screen/radial/center/Click(location, control, params)
|
||||
if(usr.client == parent.current_user)
|
||||
parent.finished = TRUE
|
||||
|
||||
/datum/radial_menu
|
||||
var/list/choices = list() //List of choice id's
|
||||
var/list/choices_icons = list() //choice_id -> icon
|
||||
var/list/choices_values = list() //choice_id -> choice
|
||||
var/list/page_data = list() //list of choices per page
|
||||
|
||||
|
||||
var/selected_choice
|
||||
var/list/obj/screen/elements = list()
|
||||
var/obj/screen/radial/center/close_button
|
||||
var/client/current_user
|
||||
var/atom/anchor
|
||||
var/image/menu_holder
|
||||
var/finished = FALSE
|
||||
|
||||
var/radius = 32
|
||||
var/starting_angle = 0
|
||||
var/ending_angle = 360
|
||||
var/zone = 360
|
||||
var/min_angle = 45 //Defaults are setup for this value, if you want to make the menu more dense these will need changes.
|
||||
var/max_elements
|
||||
var/pages = 1
|
||||
var/current_page = 1
|
||||
|
||||
var/hudfix_method = TRUE //TRUE to change anchor to user, FALSE to shift by py_shift
|
||||
var/py_shift = 0
|
||||
var/entry_animation = TRUE
|
||||
|
||||
//If we swap to vis_contens inventory these will need a redo
|
||||
/datum/radial_menu/proc/check_screen_border(mob/user)
|
||||
var/atom/movable/AM = anchor
|
||||
if(!istype(AM) || !AM.screen_loc)
|
||||
return
|
||||
if(AM in user.client.screen)
|
||||
if(hudfix_method)
|
||||
anchor = user
|
||||
else
|
||||
py_shift = 32
|
||||
restrict_to_dir(NORTH) //I was going to parse screen loc here but that's more effort than it's worth.
|
||||
|
||||
//Sets defaults
|
||||
//These assume 45 deg min_angle
|
||||
/datum/radial_menu/proc/restrict_to_dir(dir)
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
starting_angle = 270
|
||||
ending_angle = 135
|
||||
if(SOUTH)
|
||||
starting_angle = 90
|
||||
ending_angle = 315
|
||||
if(EAST)
|
||||
starting_angle = 0
|
||||
ending_angle = 225
|
||||
if(WEST)
|
||||
starting_angle = 180
|
||||
ending_angle = 45
|
||||
|
||||
/datum/radial_menu/proc/setup_menu()
|
||||
if(ending_angle > starting_angle)
|
||||
zone = ending_angle - starting_angle
|
||||
else
|
||||
zone = 360 - starting_angle + ending_angle
|
||||
|
||||
max_elements = round(zone / min_angle)
|
||||
var/paged = max_elements < choices.len
|
||||
if(elements.len < max_elements)
|
||||
var/elements_to_add = max_elements - elements.len
|
||||
for(var/i in 1 to elements_to_add) //Create all elements
|
||||
var/obj/screen/radial/new_element = new /obj/screen/radial/slice
|
||||
new_element.parent = src
|
||||
elements += new_element
|
||||
|
||||
var/page = 1
|
||||
page_data = list(null)
|
||||
var/list/current = list()
|
||||
var/list/choices_left = choices.Copy()
|
||||
while(choices_left.len)
|
||||
if(current.len == max_elements)
|
||||
page_data[page] = current
|
||||
page++
|
||||
page_data.len++
|
||||
current = list()
|
||||
if(paged && current.len == max_elements - 1)
|
||||
current += NEXT_PAGE_ID
|
||||
continue
|
||||
else
|
||||
current += popleft(choices_left)
|
||||
if(paged && current.len < max_elements)
|
||||
current += NEXT_PAGE_ID
|
||||
|
||||
page_data[page] = current
|
||||
pages = page
|
||||
current_page = 1
|
||||
update_screen_objects(anim = entry_animation)
|
||||
|
||||
/datum/radial_menu/proc/update_screen_objects(anim = FALSE)
|
||||
var/list/page_choices = page_data[current_page]
|
||||
var/angle_per_element = round(zone / page_choices.len)
|
||||
for(var/i in 1 to elements.len)
|
||||
var/obj/screen/radial/E = elements[i]
|
||||
var/angle = WRAP(starting_angle + (i - 1) * angle_per_element,0,360)
|
||||
if(i > page_choices.len)
|
||||
HideElement(E)
|
||||
else
|
||||
SetElement(E,page_choices[i],angle,anim = anim,anim_order = i)
|
||||
|
||||
/datum/radial_menu/proc/HideElement(obj/screen/radial/slice/E)
|
||||
E.cut_overlays()
|
||||
E.alpha = 0
|
||||
E.name = "None"
|
||||
E.maptext = null
|
||||
E.mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
||||
E.choice = null
|
||||
E.next_page = FALSE
|
||||
|
||||
/datum/radial_menu/proc/SetElement(obj/screen/radial/slice/E,choice_id,angle,anim,anim_order)
|
||||
//Position
|
||||
var/py = round(cos(angle) * radius) + py_shift
|
||||
var/px = round(sin(angle) * radius)
|
||||
if(anim)
|
||||
var/timing = anim_order * 0.5
|
||||
var/matrix/starting = matrix()
|
||||
starting.Scale(0.1,0.1)
|
||||
E.transform = starting
|
||||
var/matrix/TM = matrix()
|
||||
animate(E,pixel_x = px,pixel_y = py, transform = TM, time = timing)
|
||||
else
|
||||
E.pixel_y = py
|
||||
E.pixel_x = px
|
||||
|
||||
//Visuals
|
||||
E.alpha = 255
|
||||
E.mouse_opacity = MOUSE_OPACITY_ICON
|
||||
E.cut_overlays()
|
||||
if(choice_id == NEXT_PAGE_ID)
|
||||
E.name = "Next Page"
|
||||
E.next_page = TRUE
|
||||
E.add_overlay("radial_next")
|
||||
else
|
||||
if(istext(choices_values[choice_id]))
|
||||
E.name = choices_values[choice_id]
|
||||
else
|
||||
var/atom/movable/AM = choices_values[choice_id] //Movables only
|
||||
E.name = AM.name
|
||||
E.choice = choice_id
|
||||
E.maptext = null
|
||||
E.next_page = FALSE
|
||||
if(choices_icons[choice_id])
|
||||
E.add_overlay(choices_icons[choice_id])
|
||||
|
||||
/datum/radial_menu/New()
|
||||
close_button = new
|
||||
close_button.parent = src
|
||||
|
||||
/datum/radial_menu/proc/Reset()
|
||||
choices.Cut()
|
||||
choices_icons.Cut()
|
||||
choices_values.Cut()
|
||||
current_page = 1
|
||||
|
||||
/datum/radial_menu/proc/element_chosen(choice_id,mob/user)
|
||||
selected_choice = choices_values[choice_id]
|
||||
|
||||
/datum/radial_menu/proc/get_next_id()
|
||||
return "c_[choices.len]"
|
||||
|
||||
/datum/radial_menu/proc/set_choices(list/new_choices)
|
||||
if(choices.len)
|
||||
Reset()
|
||||
for(var/E in new_choices)
|
||||
var/id = get_next_id()
|
||||
choices += id
|
||||
choices_values[id] = E
|
||||
if(new_choices[E])
|
||||
var/I = extract_image(new_choices[E])
|
||||
if(I)
|
||||
choices_icons[id] = I
|
||||
setup_menu()
|
||||
|
||||
|
||||
/datum/radial_menu/proc/extract_image(E)
|
||||
var/mutable_appearance/MA = new /mutable_appearance(E)
|
||||
if(MA)
|
||||
MA.layer = ABOVE_HUD_LAYER
|
||||
MA.appearance_flags |= RESET_TRANSFORM
|
||||
return MA
|
||||
|
||||
|
||||
/datum/radial_menu/proc/next_page()
|
||||
if(pages > 1)
|
||||
current_page = WRAP(current_page + 1,1,pages+1)
|
||||
update_screen_objects()
|
||||
|
||||
/datum/radial_menu/proc/show_to(mob/M)
|
||||
if(current_user)
|
||||
hide()
|
||||
if(!M.client || !anchor)
|
||||
return
|
||||
current_user = M.client
|
||||
//Blank
|
||||
menu_holder = image(icon='icons/effects/effects.dmi',loc=anchor,icon_state="nothing",layer = ABOVE_HUD_LAYER)
|
||||
menu_holder.appearance_flags |= KEEP_APART
|
||||
menu_holder.vis_contents += elements + close_button
|
||||
current_user.images += menu_holder
|
||||
|
||||
/datum/radial_menu/proc/hide()
|
||||
if(current_user)
|
||||
current_user.images -= menu_holder
|
||||
|
||||
/datum/radial_menu/proc/wait()
|
||||
while (current_user && !finished && !selected_choice)
|
||||
stoplag(1)
|
||||
|
||||
/datum/radial_menu/Destroy()
|
||||
Reset()
|
||||
hide()
|
||||
. = ..()
|
||||
/*
|
||||
Presents radial menu to user anchored to anchor (or user if the anchor is currently in users screen)
|
||||
Choices should be a list where list keys are movables or text used for element names and return value
|
||||
and list values are movables/icons/images used for element icons
|
||||
*/
|
||||
/proc/show_radial_menu(mob/user,atom/anchor,list/choices)
|
||||
var/datum/radial_menu/menu = new
|
||||
if(!user)
|
||||
user = usr
|
||||
menu.anchor = anchor
|
||||
menu.check_screen_border(user) //Do what's needed to make it look good near borders or on hud
|
||||
menu.set_choices(choices)
|
||||
menu.show_to(user)
|
||||
menu.wait()
|
||||
var/answer = menu.selected_choice
|
||||
qdel(menu)
|
||||
return answer
|
||||
@@ -4,7 +4,3 @@
|
||||
|
||||
healths = new /obj/screen/healths/revenant()
|
||||
infodisplay += healths
|
||||
|
||||
/mob/living/simple_animal/revenant/create_mob_hud()
|
||||
if(client && !hud_used)
|
||||
hud_used = new /datum/hud/revenant(src)
|
||||
|
||||
@@ -245,11 +245,6 @@
|
||||
R.shown_robot_modules = 0
|
||||
screenmob.client.screen -= R.robot_modules_background
|
||||
|
||||
/mob/living/silicon/robot/create_mob_hud()
|
||||
if(client && !hud_used)
|
||||
hud_used = new /datum/hud/robot(src)
|
||||
|
||||
|
||||
/datum/hud/robot/persistent_inventory_update(mob/viewer)
|
||||
if(!mymob)
|
||||
return
|
||||
|
||||
@@ -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 = ""
|
||||
|
||||
@@ -90,8 +90,3 @@
|
||||
using = new /obj/screen/swarmer/ContactSwarmers()
|
||||
using.screen_loc = ui_inventory
|
||||
static_inventory += using
|
||||
|
||||
|
||||
/mob/living/simple_animal/hostile/swarmer/create_mob_hud()
|
||||
if(client && !hud_used)
|
||||
hud_used = new /datum/hud/swarmer(src)
|
||||
@@ -36,6 +36,8 @@
|
||||
return ..() || ((obj_flags & CAN_BE_HIT) && I.attack_obj(src, user))
|
||||
|
||||
/mob/living/attackby(obj/item/I, mob/living/user, params)
|
||||
if(..())
|
||||
return TRUE
|
||||
user.changeNext_move(CLICK_CD_MELEE)
|
||||
if(user.a_intent == INTENT_HARM && stat == DEAD && (butcher_results || guaranteed_butcher_results)) //can we butcher it?
|
||||
GET_COMPONENT_FROM(butchering, /datum/component/butchering, I)
|
||||
@@ -76,7 +78,7 @@
|
||||
user.do_attack_animation(M)
|
||||
M.attacked_by(src, user)
|
||||
|
||||
add_logs(user, M, "attacked", src.name, "(INTENT: [uppertext(user.a_intent)]) (DAMTYPE: [uppertext(damtype)])")
|
||||
log_combat(user, M, "attacked", src.name, "(INTENT: [uppertext(user.a_intent)]) (DAMTYPE: [uppertext(damtype)])")
|
||||
add_fingerprint(user)
|
||||
|
||||
user.adjustStaminaLossBuffered(getweight())//CIT CHANGE - makes attacking things cause stamina loss
|
||||
@@ -102,6 +104,7 @@
|
||||
if(I.force)
|
||||
visible_message("<span class='danger'>[user] has hit [src] with [I]!</span>", null, null, COMBAT_MESSAGE_RANGE)
|
||||
//only witnesses close by and the victim see a hit message.
|
||||
log_combat(user, src, "attacked", I)
|
||||
take_damage(I.force, I.damtype, "melee", 1)
|
||||
|
||||
/mob/living/attacked_by(obj/item/I, mob/living/user)
|
||||
@@ -135,7 +138,7 @@
|
||||
// Proximity_flag is 1 if this afterattack was called on something adjacent, in your square, or on your person.
|
||||
// Click parameters is the params string from byond Click() code, see that documentation.
|
||||
/obj/item/proc/afterattack(atom/target, mob/user, proximity_flag, click_parameters)
|
||||
return
|
||||
SEND_SIGNAL(src, COMSIG_ITEM_AFTERATTACK, target, user, proximity_flag, click_parameters)
|
||||
|
||||
|
||||
/obj/item/proc/get_clamped_volume()
|
||||
|
||||
@@ -56,6 +56,11 @@
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/atom/ui_status(mob/user)
|
||||
. = ..()
|
||||
if(!can_interact(user))
|
||||
. = min(., UI_UPDATE)
|
||||
|
||||
/atom/movable/can_interact(mob/user)
|
||||
. = ..()
|
||||
if(!.)
|
||||
|
||||
@@ -120,6 +120,7 @@
|
||||
update_icon()
|
||||
|
||||
/obj/item/tk_grab/afterattack(atom/target, mob/living/carbon/user, proximity, params)//TODO: go over this
|
||||
. = ..()
|
||||
if(!target || !user)
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user