mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Merge pull request #11499 from VOREStation/upstream-merge-8233
[MIRROR] Ports sliding things along tables
This commit is contained in:
committed by
Chompstation Bot
parent
145f8172f4
commit
99d4db145d
@@ -15,14 +15,13 @@
|
|||||||
return FALSE // should stop you from dragging through windows
|
return FALSE // should stop you from dragging through windows
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|
||||||
/atom/MouseDrop(atom/over)
|
/atom/MouseDrop(atom/over, src_location, over_location, src_control, over_control, params)
|
||||||
if(!usr || !over) return
|
if(!usr || !over)
|
||||||
if(!Adjacent(usr) || !over.Adjacent(usr)) return // should stop you from dragging through windows
|
return
|
||||||
|
if(!Adjacent(usr) || !over.Adjacent(usr))
|
||||||
|
return // should stop you from dragging through windows
|
||||||
|
|
||||||
spawn(0)
|
INVOKE_ASYNC(over, /atom/.proc/MouseDrop_T, src, usr, src_location, over_location, src_control, over_control, params)
|
||||||
over.MouseDrop_T(src,usr)
|
|
||||||
return
|
|
||||||
|
|
||||||
// recieve a mousedrop
|
/atom/proc/MouseDrop_T(atom/dropping, mob/user, src_location, over_location, src_control, over_control, params)
|
||||||
/atom/proc/MouseDrop_T(atom/dropping, mob/user)
|
return
|
||||||
return
|
|
||||||
@@ -968,7 +968,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/item/var/list/center_of_mass = list("x" = 16,"y" = 16)
|
||||||
|
|
||||||
/proc/auto_align(obj/item/W, click_parameters)
|
/proc/auto_align(obj/item/W, click_parameters, var/animate = FALSE)
|
||||||
if(!W.center_of_mass)
|
if(!W.center_of_mass)
|
||||||
W.randpixel_xy()
|
W.randpixel_xy()
|
||||||
return
|
return
|
||||||
@@ -985,8 +985,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_x = max(0, min(CELLS-1, round(mouse_x/CELLSIZE)))
|
||||||
var/cell_y = max(0, min(CELLS-1, round(mouse_y/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"]
|
var/target_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_y = (CELLSIZE * (0.5 + cell_y)) - 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 CELLS
|
||||||
#undef CELLSIZE
|
#undef CELLSIZE
|
||||||
@@ -121,19 +121,37 @@
|
|||||||
return FALSE
|
return FALSE
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|
||||||
/obj/structure/low_wall/MouseDrop_T(obj/O as obj, mob/user as mob)
|
/obj/structure/low_wall/MouseDrop_T(obj/O, mob/user, src_location, over_location, src_control, over_control, params)
|
||||||
if(istype(O, /obj/structure/window))
|
if(istype(O, /obj/structure/window))
|
||||||
var/obj/structure/window/W = O
|
var/obj/structure/window/W = O
|
||||||
if(Adjacent(W) && !W.anchored)
|
if(Adjacent(W) && !W.anchored)
|
||||||
to_chat("<span class='notice'>You hoist [W] up onto [src].</span>")
|
to_chat("<span class='notice'>You hoist [W] up onto [src].</span>")
|
||||||
W.forceMove(loc)
|
W.forceMove(loc)
|
||||||
return
|
return
|
||||||
if ((!( istype(O, /obj/item/weapon) ) || user.get_active_hand() != O))
|
|
||||||
return ..()
|
|
||||||
if(isrobot(user))
|
if(isrobot(user))
|
||||||
return
|
return
|
||||||
if(can_place_items())
|
if(can_place_items())
|
||||||
user.unEquip(O, 0, src.loc)
|
if(ismob(O.loc)) //If placing an item
|
||||||
|
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))
|
||||||
|
|
||||||
|
else if(isturf(O.loc) && isitem(O)) //If pushing an item on the tabletop
|
||||||
|
var/obj/item/I = O
|
||||||
|
if(I.anchored)
|
||||||
|
return
|
||||||
|
|
||||||
|
if((isliving(user)) && (Adjacent(user)) && !(user.incapacitated()))
|
||||||
|
if(O.w_class <= user.can_pull_size)
|
||||||
|
O.forceMove(loc)
|
||||||
|
auto_align(I, params, TRUE)
|
||||||
|
else
|
||||||
|
to_chat(user, SPAN_WARNING("\The [I] is too big for you to move!"))
|
||||||
|
return
|
||||||
|
|
||||||
/obj/structure/low_wall/proc/handle_rod_use(mob/user, obj/item/stack/rods/R)
|
/obj/structure/low_wall/proc/handle_rod_use(mob/user, obj/item/stack/rods/R)
|
||||||
if(!grille_type)
|
if(!grille_type)
|
||||||
|
|||||||
@@ -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)
|
/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)
|
W.refit_for_species(species)
|
||||||
return equip_to_slot_if_possible(W, slot, 1, 1, 0)
|
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)
|
/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)
|
W.refit_for_species(species)
|
||||||
return equip_to_slot_if_possible(W, slot, 1, 1, 0)
|
return equip_to_slot_if_possible(W, slot, 1, 1, 0)
|
||||||
|
|||||||
@@ -307,7 +307,7 @@
|
|||||||
if(istype(H.w_uniform, /obj/item/clothing/under))
|
if(istype(H.w_uniform, /obj/item/clothing/under))
|
||||||
suit = H.w_uniform
|
suit = H.w_uniform
|
||||||
|
|
||||||
|
|
||||||
var/list/slots = list()
|
var/list/slots = list()
|
||||||
for(var/entry in H.species.hud.gear)
|
for(var/entry in H.species.hud.gear)
|
||||||
var/list/slot_ref = H.species.hud.gear[entry]
|
var/list/slot_ref = H.species.hud.gear[entry]
|
||||||
@@ -322,7 +322,7 @@
|
|||||||
)))
|
)))
|
||||||
data["slots"] = slots
|
data["slots"] = slots
|
||||||
|
|
||||||
|
|
||||||
var/list/specialSlots = list()
|
var/list/specialSlots = list()
|
||||||
if(H.species.hud.has_hands)
|
if(H.species.hud.has_hands)
|
||||||
specialSlots.Add(list(list(
|
specialSlots.Add(list(list(
|
||||||
|
|||||||
@@ -60,14 +60,30 @@
|
|||||||
return 1
|
return 1
|
||||||
return 1
|
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
|
||||||
|
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))
|
||||||
|
|
||||||
if ((!( istype(O, /obj/item/weapon) ) || user.get_active_hand() != O))
|
else if(isturf(O.loc) && isitem(O)) //If pushing an item on the tabletop
|
||||||
return ..()
|
var/obj/item/I = O
|
||||||
if(isrobot(user))
|
if(I.anchored)
|
||||||
return
|
return
|
||||||
user.unEquip(O, 0, src.loc)
|
|
||||||
return
|
if((isliving(user)) && (Adjacent(user)) && !(user.incapacitated()))
|
||||||
|
if(O.w_class <= user.can_pull_size)
|
||||||
|
O.forceMove(loc)
|
||||||
|
auto_align(I, params, TRUE)
|
||||||
|
else
|
||||||
|
to_chat(user, SPAN_WARNING("\The [I] is too big for you to move!"))
|
||||||
|
return
|
||||||
|
|
||||||
|
return ..()
|
||||||
|
|
||||||
|
|
||||||
/obj/structure/table/attackby(obj/item/W as obj, mob/user as mob, var/hit_modifier, var/click_parameters)
|
/obj/structure/table/attackby(obj/item/W as obj, mob/user as mob, var/hit_modifier, var/click_parameters)
|
||||||
|
|||||||
Reference in New Issue
Block a user