Ports sliding things along tables

This commit is contained in:
Cerebulon
2021-08-23 00:45:08 +01:00
parent 17cbd9e7fb
commit faf4a4121a
4 changed files with 52 additions and 22 deletions
+1 -1
View File
@@ -75,7 +75,7 @@ var/list/slot_equipment_priority = list( \
/mob/proc/equip_voidsuit_to_slot_or_del_with_refit(obj/item/clothing/suit/space/void/W as obj, slot, species = SPECIES_HUMAN)
W.refit_for_species(species)
return equip_to_slot_if_possible(W, slot, 1, 1, 0)
/mob/proc/equip_voidhelm_to_slot_or_del_with_refit(obj/item/clothing/head/helmet/space/void/W as obj, slot, species = SPECIES_HUMAN)
W.refit_for_species(species)
return equip_to_slot_if_possible(W, slot, 1, 1, 0)
+2 -2
View File
@@ -301,7 +301,7 @@
if(istype(H.w_uniform, /obj/item/clothing/under))
suit = H.w_uniform
var/list/slots = list()
for(var/entry in H.species.hud.gear)
var/list/slot_ref = H.species.hud.gear[entry]
@@ -316,7 +316,7 @@
)))
data["slots"] = slots
var/list/specialSlots = list()
if(H.species.hud.has_hands)
specialSlots.Add(list(list(
+41 -10
View File
@@ -60,14 +60,37 @@
return 1
/obj/structure/table/MouseDrop_T(obj/O as obj, mob/user as mob)
/obj/structure/table/MouseDrop_T(obj/O, mob/user, src_location, over_location, src_control, over_control, params)
if(ismob(O.loc)) //If placing an item
to_world("It's a drop!")
if(!isitem(O) || user.get_active_hand() != O)
return ..()
if(isrobot(user))
return
user.drop_item()
if(O.loc != src.loc)
step(O, get_dir(O, src))
to_world("Dropping Item On Table")
if ((!( istype(O, /obj/item/weapon) ) || user.get_active_hand() != O))
return ..()
if(isrobot(user))
return
user.unEquip(O, 0, src.loc)
return
else if(isturf(O.loc) && isitem(O)) //If pushing an item on the tabletop
to_world("It's a slide!")
var/obj/item/I = O
if(I.anchored)
to_world("Item is anchored and cannot be pushed")
return
if((isliving(user)) && (Adjacent(user)) && !(user.incapacitated()))
to_world("Should be pushing...")
if(O.w_class <= user.can_pull_size)
O.forceMove(loc)
auto_align(I, params, TRUE)
to_world("Woosh!")
else
to_chat(user, SPAN_WARNING("\The [I] is too big for you to move!"))
return
to_world("Exiting the drop loop")
return ..()
/obj/structure/table/attackby(obj/item/W as obj, mob/user as mob, var/hit_modifier, var/click_parameters)
@@ -159,7 +182,7 @@ Note: This proc can be overwritten to allow for different types of auto-alignmen
/obj/item/var/list/center_of_mass = list("x" = 16,"y" = 16)
/obj/structure/table/proc/auto_align(obj/item/W, click_parameters)
/obj/structure/table/proc/auto_align(obj/item/W, click_parameters, var/animate = FALSE)
if(!W.center_of_mass)
W.randpixel_xy()
return
@@ -176,8 +199,16 @@ Note: This proc can be overwritten to allow for different types of auto-alignmen
var/cell_x = max(0, min(CELLS-1, round(mouse_x/CELLSIZE)))
var/cell_y = max(0, min(CELLS-1, round(mouse_y/CELLSIZE)))
W.pixel_x = (CELLSIZE * (0.5 + cell_x)) - W.center_of_mass["x"]
W.pixel_y = (CELLSIZE * (0.5 + cell_y)) - W.center_of_mass["y"]
var/target_x = (CELLSIZE * (cell_x + 0.5)) - W.center_of_mass["x"]
var/target_y = (CELLSIZE * (cell_y + 0.5)) - W.center_of_mass["y"]
if(animate)
var/dist_x = abs(W.pixel_x - target_x)
var/dist_y = abs(W.pixel_y - target_y)
var/dist = sqrt((dist_x*dist_x)+(dist_y*dist_y))
animate(W, pixel_x=target_x, pixel_y=target_y,time=dist*0.5)
else
W.pixel_x = target_x
W.pixel_y = target_y
#undef CELLS
#undef CELLSIZE