Dragging storage bags now drops items around the mouse pointer (#27790)

* Standardize attom scatter and make bag drops offset it based on mouse position

* Init sanity

* Update code/game/atoms_movable.dm

Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com>

---------

Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
This commit is contained in:
Charlie Nolan
2025-01-06 18:02:09 +00:00
committed by GitHub
co-authored by DGamerL
parent a387c18e16
commit 8e60888659
39 changed files with 94 additions and 94 deletions
+2
View File
@@ -186,6 +186,8 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons
/// In tiles, how far this weapon can reach; 1 for adjacent, which is default
var/reach = 1
scatter_distance = 5
/obj/item/New()
..()
+3 -4
View File
@@ -39,19 +39,18 @@
reagents.add_reagent(R, volume)
name = "unlabelled bottle"
icon_state = pick("alco-white","alco-green","alco-blue","alco-clear","alco-red")
pixel_x = rand(-5, 5)
pixel_y = rand(-5, 5)
scatter_atom()
/obj/item/storage/pill_bottle/random_meds
name = "unlabelled pillbottle"
desc = "The sheer recklessness of this bottle's existence astounds you."
allow_wrap = FALSE
var/labelled = FALSE
scatter_distance = 10
/obj/item/storage/pill_bottle/random_meds/Initialize(mapload)
. = ..()
pixel_x = rand(-10, 10)
pixel_y = rand(-10, 10)
scatter_atom()
/obj/item/storage/pill_bottle/random_meds/populate_contents()
var/list/possible_meds_standard = GLOB.standard_medicines.Copy()
@@ -150,8 +150,11 @@ GLOBAL_LIST_INIT(snow_recipes, list(
/obj/item/stack/sheet/mineral/Initialize(mapload, new_amount, merge)
. = ..()
pixel_x = rand(0,4)-4
pixel_y = rand(0,4)-4
scatter_atom()
/obj/item/stack/sheet/mineral/scatter_atom(offset_x, offset_y)
pixel_x = rand(-4,0) + offset_x
pixel_y = rand(-4,0) + offset_y
/obj/item/stack/sheet/mineral/sandstone
name = "sandstone brick"
@@ -15,11 +15,11 @@
origin_tech = "materials=1"
var/turf_type = null
var/mineralType = null
scatter_distance = 3
/obj/item/stack/tile/Initialize(mapload, new_amount, merge)
. = ..()
pixel_x = rand(-3, 3)
pixel_y = rand(-3, 3) //randomize a little
scatter_atom()
/obj/item/stack/tile/welder_act(mob/user, obj/item/I)
if(get_amount() < 4)
+2 -2
View File
@@ -142,11 +142,11 @@
name = "arbitrary spent casing item"
desc = "If you can see this and didn't spawn it, make an issue report on GitHub."
icon_state = "gshell"
scatter_distance = 10
/obj/item/trash/spentcasing/Initialize(mapload)
. = ..()
pixel_x = rand(-10, 10)
pixel_y = rand(-10, 10)
scatter_atom()
transform = turn(transform, rand(0, 360))
/obj/item/trash/spentcasing/shotgun
+5 -7
View File
@@ -333,9 +333,7 @@ LIGHTERS ARE IN LIGHTERS.DM
/obj/item/clothing/mask/cigarette/rollie/Initialize(mapload)
. = ..()
pixel_x = rand(-5, 5)
pixel_y = rand(-5, 5)
scatter_atom()
/obj/item/clothing/mask/cigarette/rollie/custom
list_reagents = list()
@@ -346,11 +344,11 @@ LIGHTERS ARE IN LIGHTERS.DM
icon_state = "cigbutt"
w_class = WEIGHT_CLASS_TINY
throwforce = 1
scatter_distance = 10
/obj/item/cigbutt/Initialize(mapload)
. = ..()
pixel_x = rand(-10, 10)
pixel_y = rand(-10, 10)
scatter_atom()
transform = turn(transform, rand(0, 360))
/obj/item/cigbutt/decompile_act(obj/item/matter_decompiler/C, mob/user)
@@ -364,11 +362,11 @@ LIGHTERS ARE IN LIGHTERS.DM
name = "roach"
desc = "A manky old roach, or for non-stoners, a used rollup."
icon_state = "roach"
scatter_distance = 5
/obj/item/cigbutt/roach/Initialize(mapload)
. = ..()
pixel_x = rand(-5, 5)
pixel_y = rand(-5, 5)
scatter_atom()
//////////////////////////////
// MARK: ROLLING
@@ -14,11 +14,11 @@
icon_state = "gift1"
item_state = "gift1"
resistance_flags = FLAMMABLE
scatter_distance = 10
/obj/item/a_gift/New()
..()
pixel_x = rand(-10,10)
pixel_y = rand(-10,10)
scatter_atom()
if(w_class > 0 && w_class < 4)
icon_state = "gift[w_class]"
else
@@ -66,11 +66,11 @@
w_class = WEIGHT_CLASS_SMALL
sharp = TRUE
hitsound = 'sound/weapons/pierce.ogg'
scatter_distance = 8
/obj/item/shrapnel/Initialize(mapload)
. = ..()
icon_state = pick("shrapnel1", "shrapnel2", "shrapnel3")
pixel_x = rand(-8, 8)
pixel_y = rand(-8, 8)
scatter_atom()
#undef DEFAULT_SHRAPNEL_RANGE
@@ -103,7 +103,7 @@
/obj/item/storage/proc/removal_allowed_check(mob/user)
return TRUE
/obj/item/storage/MouseDrop(obj/over_object)
/obj/item/storage/MouseDrop(obj/over_object, src_location, over_location, src_control, over_control, params)
if(!ismob(usr)) //so monkeys can take off their backpacks -- Urist
return
var/mob/M = usr
@@ -134,8 +134,12 @@
M.face_atom(over_object)
M.visible_message("<span class='notice'>[M] empties [src] onto [over_object].</span>",
"<span class='notice'>You empty [src] onto [over_object].</span>")
var/list/params_list = params2list(params)
var/x_offset = text2num(params_list["icon-x"]) - 16
var/y_offset = text2num(params_list["icon-y"]) - 16
for(var/obj/item/I in contents)
remove_from_storage(I, T)
I.scatter_atom(x_offset, y_offset)
update_icon() // For content-sensitive icons
return
@@ -608,6 +612,7 @@
hide_from(user)
for(var/obj/item/I in contents)
remove_from_storage(I, T)
I.scatter_atom()
CHECK_TICK
/**