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
+1 -2
View File
@@ -159,8 +159,7 @@
/obj/item/shard/shark_teeth/set_initial_icon_state()
icon_state = "teeth"
pixel_x = rand(-5,5)
pixel_y = rand(-5,5)
scatter_atom()
/obj/item/fish/catfish
name = "catfish"
+1 -2
View File
@@ -336,8 +336,7 @@
for(var/i in 1 to (slices_num - slices_lost))
var/obj/slice = new slice_path (loc)
reagents.trans_to(slice,reagents_per_slice)
slice.pixel_x = rand(-7, 7)
slice.pixel_y = rand(-7, 7)
slice.scatter_atom()
qdel(src)
return ..()
@@ -7,11 +7,11 @@
volume = 10
list_reagents = list("honey" = 5)
var/honey_color = ""
scatter_distance = 8
/obj/item/food/honeycomb/Initialize(mapload)
. = ..()
pixel_x = rand(8,-8)
pixel_y = rand(8,-8)
scatter_atom()
update_icon(UPDATE_OVERLAYS)
/obj/item/food/honeycomb/update_overlays()
+2 -4
View File
@@ -36,8 +36,7 @@
else if(seed)
seed = new seed
pixel_x = rand(-5, 5)
pixel_y = rand(-5, 5)
scatter_atom()
if(dried_type == -1)
dried_type = type
@@ -92,8 +91,7 @@
for(var/i = 1 to (slices_num - slices_lost))
var/obj/slice = new slice_path (loc)
reagents.trans_to(slice, reagents_per_slice)
slice.pixel_x = rand(-7, 7)
slice.pixel_y = rand(-7, 7)
slice.scatter_atom()
qdel(src)
return ..()
+1 -2
View File
@@ -174,8 +174,7 @@
if(!has_buckled_mobs() && do_after(user, 50, target = src))
for(var/I in 1 to 5)
var/obj/item/grown/log/L = new /obj/item/grown/log(loc)
L.pixel_x += rand(1,4)
L.pixel_y += rand(1,4)
L.scatter_atom()
qdel(src)
return
..()
+1 -3
View File
@@ -26,9 +26,7 @@
else if(seed)
seed = new seed
pixel_x = rand(-5, 5)
pixel_y = rand(-5, 5)
scatter_atom()
if(seed)
for(var/datum/plant_gene/trait/T in seed.genes)
T.on_new(src)
+1 -2
View File
@@ -342,8 +342,7 @@
/obj/item/reagent_containers/glass/bottle/nutrient/killer/Initialize(mapload)
. = ..()
pixel_x = rand(-5, 5)
pixel_y = rand(-5, 5)
scatter_atom()
/obj/item/reagent_containers/glass/bottle/nutrient/killer/weedkiller
name = "jug of weed killer"
+1 -2
View File
@@ -621,8 +621,7 @@
/obj/item/unsorted_seeds/New(obj/item/seeds/template, mutation_level, list/mutation_focus, seed_data_in = null)
..()
template = template.Copy()
pixel_x = rand(-6, 6)
pixel_y = rand(-6, 6)
scatter_atom()
if(seed_data_in)
seed_data = seed_data_in
else
+1 -2
View File
@@ -203,8 +203,7 @@
/obj/item/food/grown/ash_flora/Initialize(mapload)
. = ..()
pixel_x = rand(-4, 4)
pixel_y = rand(-4, 4)
scatter_atom()
/// for actual crafting
/obj/item/food/grown/ash_flora/shavings
+5 -2
View File
@@ -19,8 +19,11 @@
/obj/item/stack/ore/Initialize(mapload, new_amount, merge = TRUE)
. = ..()
pixel_x = rand(0, 16) - 8
pixel_y = rand(0, 8) - 8
scatter_atom()
/obj/item/stack/ore/scatter_atom(x_offset, y_offset)
pixel_x = rand(-8, 8) + x_offset
pixel_y = rand(-8, 0) + y_offset
/obj/item/stack/ore/welder_act(mob/user, obj/item/I)
. = TRUE
@@ -223,9 +223,11 @@
/mob/living/simple_animal/chick/Initialize(mapload)
. = ..()
scatter_atom()
pixel_x = rand(-6, 6)
pixel_y = rand(0, 10)
/mob/living/simple_animal/chick/scatter_atom(x_offset, y_offset)
pixel_x = rand(-6, 6) + x_offset
pixel_y = rand(0, 10) + y_offset
/mob/living/simple_animal/chick/Life(seconds, times_fired)
. =..()
@@ -302,11 +304,14 @@ GLOBAL_VAR_INIT(chicken_count, 0)
icon_state = "[icon_prefix]_[body_color]"
icon_living = "[icon_prefix]_[body_color]"
icon_dead = "[icon_prefix]_[body_color]_dead"
pixel_x = rand(-6, 6)
pixel_y = rand(0, 10)
scatter_atom()
update_appearance(UPDATE_ICON_STATE)
GLOB.chicken_count += 1
/mob/living/simple_animal/chick/scatter_atom(x_offset, y_offset)
pixel_x = rand(-6, 6) + x_offset
pixel_y = rand(0, 10) + y_offset
/mob/living/simple_animal/chicken/death(gibbed)
// Only execute the below if we successfully died
. = ..(gibbed)
@@ -339,8 +344,7 @@ GLOBAL_VAR_INIT(chicken_count, 0)
visible_message("[src] [pick(layMessage)]")
eggsleft--
var/obj/item/E = new egg_type(get_turf(src))
E.pixel_x = rand(-6,6)
E.pixel_y = rand(-6,6)
E.scatter_atom()
if(eggsFertile)
if(GLOB.chicken_count < MAX_CHICKENS && prob(25))
START_PROCESSING(SSobj, E)
+2
View File
@@ -50,6 +50,8 @@
var/const/crayonfont = "Comic Sans MS"
var/regex/blacklist = new("(<iframe|<embed|<script|<canvas|<video|<audio|onload)", "g") // Blacklist of naughties
scatter_distance = 8
//lipstick wiping is in code/game/objects/items/weapons/cosmetics.dm!
/obj/item/paper/New()
+1
View File
@@ -15,6 +15,7 @@
var/screen = 0
drop_sound = 'sound/items/handling/paper_drop.ogg'
pickup_sound = 'sound/items/handling/paper_pickup.ogg'
scatter_distance = 8
/obj/item/paper_bundle/New(default_papers = TRUE)
. = ..()
+1 -2
View File
@@ -96,8 +96,7 @@
P.loc = user.loc
user.put_in_hands(P)
P.add_fingerprint(user)
P.pixel_x = rand(-9, 9) // Random position
P.pixel_y = rand(-8, 8)
P.scatter_atom()
to_chat(user, "<span class='notice'>You take [P] out of [src].</span>")
else
to_chat(user, "<span class='notice'>[src] is empty!</span>")
+2 -2
View File
@@ -13,11 +13,11 @@
no_spin = TRUE
var/obj/item/paper/internal_paper
scatter_distance = 8
/obj/item/paperplane/New(loc, obj/item/paper/new_paper)
..()
pixel_y = rand(-8, 8)
pixel_x = rand(-9, 9)
scatter_atom()
if(new_paper)
internal_paper = new_paper
flags = new_paper.flags
+3 -6
View File
@@ -128,8 +128,7 @@
p.tiny = photocopy.tiny
p.img = photocopy.img
p.desc = photocopy.desc
p.pixel_x = rand(-10, 10)
p.pixel_y = rand(-10, 10)
p.scatter_atom()
if(photocopy.scribble)
p.scribble = photocopy.scribble
return p
@@ -170,8 +169,7 @@
else if(folder)
p.forceMove(folder)
p.desc = "You see [copymob]'s ass on the photo."
p.pixel_x = rand(-10, 10)
p.pixel_y = rand(-10, 10)
p.scatter_atom()
p.img = temp_img
var/icon/small_img = icon(temp_img) //Icon() is needed or else temp_img will be rescaled too >.>
var/icon/ic = icon('icons/obj/items.dmi',"photo")
@@ -220,8 +218,7 @@
P.icon_state = "paper_words"
P.name = bundle.name
P.pixel_y = rand(-8, 8)
P.pixel_x = rand(-9, 9)
P.scatter_atom()
return P
/obj/machinery/photocopier/proc/remove_document()
+1
View File
@@ -35,6 +35,7 @@
var/scribble //Scribble on the back.
var/icon/tiny
var/photo_size = 3
scatter_distance = 8
/obj/item/photo/attack_self__legacy__attackchain(mob/user as mob)
user.examinate(src)
+3 -2
View File
@@ -28,12 +28,13 @@
/// How strong the flash is
var/muzzle_flash_strength = MUZZLE_FLASH_STRENGTH_WEAK
scatter_distance = 10
/obj/item/ammo_casing/New()
..()
if(projectile_type)
BB = new projectile_type(src)
pixel_x = rand(-10.0, 10)
pixel_y = rand(-10.0, 10)
scatter_atom()
dir = pick(GLOB.alldirs)
update_appearance(UPDATE_DESC|UPDATE_ICON_STATE)
@@ -571,8 +571,7 @@
var/obj/item/reagent_containers/P = new item_type(location)
if(!isnull(medicine_name))
P.name = "[medicine_name][name_suffix]"
P.pixel_x = rand(-7, 7) // Random position
P.pixel_y = rand(-7, 7)
P.scatter_atom()
configure_item(data, reagents, P)
reagents.trans_to(P, amount_per_item)
@@ -82,8 +82,7 @@
/obj/machinery/computer/pandemic/proc/create_culture(name, bottle_type = "culture", cooldown = 50)
var/obj/item/reagent_containers/glass/bottle/B = new/obj/item/reagent_containers/glass/bottle(loc)
B.icon_state = "bottle"
B.pixel_x = rand(-3, 3)
B.pixel_y = rand(-3, 3)
B.scatter_atom()
replicator_cooldown(cooldown)
B.name = "[name] [bottle_type] bottle"
return B
+1 -2
View File
@@ -270,8 +270,7 @@
/obj/item/disk/rnd_backup_disk/Initialize(mapload)
. = ..()
pixel_x = rand(-5, 5)
pixel_y = rand(-5, 5)
scatter_atom()
// Level it all out
for(var/tech_id in GLOB.rnd_tech_id_to_name)
stored_tech_assoc[tech_id] = 0
+1 -3
View File
@@ -453,9 +453,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
SSblackbox.record_feedback("tally", "station_protolathe_production", amount, "[being_built.type]")
for(var/i in 1 to amount)
var/obj/item/new_item = new being_built.build_path(src)
if(istype(new_item)) // Only want a random pixel offset if it IS actually an item, and not a structure like a bluespace closet
new_item.pixel_x = rand(-5, 5)
new_item.pixel_y = rand(-5, 5)
new_item.scatter_atom()
if(istype(new_item, /obj/item/storage/backpack/holding))
new_item.investigate_log("built by [key]","singulo")
if(!istype(new_item, /obj/item/stack/sheet)) // To avoid materials dupe glitches
@@ -144,15 +144,14 @@
resistance_flags = LAVA_PROOF | FIRE_PROOF | ACID_PROOF
var/randomsinglesprite = FALSE
var/randomspritemax = 2
var/sprite_shift = 9
scatter_distance = 9
/obj/item/clockwork/alloy_shards/Initialize(mapload)
. = ..()
if(randomsinglesprite)
replace_name_desc()
icon_state = "[base_icon_state][rand(1, randomspritemax)]"
pixel_x = rand(-sprite_shift, sprite_shift)
pixel_y = rand(-sprite_shift, sprite_shift)
scatter_atom()
/obj/item/clockwork/alloy_shards/proc/replace_name_desc()
name = "replicant alloy shard"
@@ -162,27 +161,27 @@
name = "clockwork golem scrap"
desc = "A pile of scrap metal. It seems damaged beyond repair."
icon_state = "clockgolem_dead"
sprite_shift = 0
scatter_distance = 0
/obj/item/clockwork/alloy_shards/large
w_class = WEIGHT_CLASS_TINY
randomsinglesprite = TRUE
icon_state = "shard_large"
base_icon_state = "shard_large"
sprite_shift = 9
scatter_distance = 9
/obj/item/clockwork/alloy_shards/medium
w_class = WEIGHT_CLASS_TINY
randomsinglesprite = TRUE
icon_state = "shard_medium"
base_icon_state = "shard_medium"
sprite_shift = 10
scatter_distance = 10
/obj/item/clockwork/alloy_shards/medium/gear_bit
randomspritemax = 4
icon_state = "gear_bit1"
base_icon_state = "gear_bit"
sprite_shift = 12
scatter_distance = 12
/obj/item/clockwork/alloy_shards/medium/gear_bit/replace_name_desc()
name = "gear bit"
@@ -201,7 +200,7 @@
randomspritemax = 3
icon_state = "shard_small"
base_icon_state = "shard_small"
sprite_shift = 12
scatter_distance = 12
/obj/item/clockwork/alloy_shards/pinion_lock
name = "pinion lock"
+1 -2
View File
@@ -31,8 +31,7 @@
/obj/item/stack/ore/bluespace_crystal/Initialize(mapload, new_amount, merge)
. = ..()
pixel_x = rand(-5, 5)
pixel_y = rand(-5, 5)
scatter_atom()
/obj/item/stack/ore/bluespace_crystal/attack_self__legacy__attackchain(mob/user)
if(use(1))