Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Item & Footprints offsets #4762

Merged
merged 7 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions code/game/objects/effects/decals/cleanable/blood/tracks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,37 @@

var/list/overlay_images = list()

/// Amount of pixels to shift either way in an attempt to make the trakcs more organic
var/transverse_amplitude = 2

/obj/effect/decal/cleanable/blood/tracks/Crossed()
return

/obj/effect/decal/cleanable/blood/tracks/can_place_cleanable()
return FALSE

/obj/effect/decal/cleanable/blood/tracks/proc/add_tracks(direction, tcolor, out)
var/image/I = image(icon = icon, icon_state = out ? going_state : coming_state, dir = direction)
var/mutable_appearance/MA = new(I)
var/image/image = image(icon = icon, icon_state = out ? going_state : coming_state, dir = direction)

var/mutable_appearance/MA = new(image)
MA.color = tcolor
MA.layer = layer
MA.appearance_flags |= RESET_COLOR
I.appearance = MA
image.appearance = MA

switch(direction)
if(NORTH, SOUTH)
image.pixel_x += rand(-transverse_amplitude, transverse_amplitude)
if(EAST, WEST)
image.pixel_y += rand(-transverse_amplitude, transverse_amplitude)

if(out)
LAZYSET(steps_out, "[direction]", I)
LAZYSET(steps_out, "[direction]", image)
else
LAZYSET(steps_in, "[direction]", I)
LAZYSET(steps_in, "[direction]", image)

overlay_images += I
cleanable_turf.overlays += I
overlay_images += image
cleanable_turf.overlays += image

/obj/effect/decal/cleanable/blood/tracks/clear_overlay()
if(length(overlay_images))
Expand Down
12 changes: 12 additions & 0 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@

var/list/inherent_traits

/// How much to offset the item alongside X visually
var/ground_offset_x = 2
/// How much to offset the item alongside X visually
fira marked this conversation as resolved.
Show resolved Hide resolved
var/ground_offset_y = 2

/obj/item/Initialize(mapload, ...)
. = ..()

Expand All @@ -175,6 +180,8 @@
if(flags_item & MOB_LOCK_ON_EQUIP)
AddComponent(/datum/component/id_lock)

scatter_item()

/obj/item/Destroy()
flags_item &= ~DELONDROP //to avoid infinite loop of unequip, delete, unequip, delete.
flags_item &= ~NODROP //so the item is properly unequipped if on a mob.
Expand Down Expand Up @@ -459,6 +466,11 @@ cases. Override_icon_state should be a list.*/
/obj/item/proc/item_action_slot_check(mob/user, slot)
return TRUE

/obj/item/proc/scatter_item()
if(!pixel_x && !pixel_y)
pixel_x = rand(-ground_offset_x, ground_offset_x)
pixel_y = rand(-ground_offset_y, ground_offset_y)

// The mob M is attempting to equip this item into the slot passed through as 'slot'. return TRUE if it can do this and 0 if it can't.
// If you are making custom procs but would like to retain partial or complete functionality of this one, include a 'return ..()' to where you want this to happen.
// Set disable_warning to TRUE if you wish it to not give you outputs.
Expand Down
7 changes: 2 additions & 5 deletions code/game/objects/items/devices/coins.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@
black_market_value = 10
var/string_attached
var/sides = 2

/obj/item/coin/Initialize()
. = ..()
pixel_x = rand(0,16)-8
pixel_y = rand(0,8)-8
ground_offset_x = 8
ground_offset_y = 4

/obj/item/coin/gold
name = "gold coin"
Expand Down
9 changes: 7 additions & 2 deletions code/game/objects/items/devices/flashlight.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

light_range = 5
light_power = 1
ground_offset_x = 2
ground_offset_y = 6

actions_types = list(/datum/action/item_action)
var/on = FALSE
Expand All @@ -33,6 +35,11 @@
else
icon_state = initial(icon_state)

/obj/item/device/flashlight/animation_spin(speed = 5, loop_amount = -1, clockwise = TRUE, sections = 3, angular_offset = 0, pixel_fuzz = 0)
clockwise = pick(TRUE, FALSE)
angular_offset = rand(360)
return ..()

/obj/item/device/flashlight/proc/update_brightness(mob/user = null)
if(on)
set_light_range(light_range)
Expand Down Expand Up @@ -296,8 +303,6 @@

// Causes flares to stop with a rotation offset for visual purposes
/obj/item/device/flashlight/flare/animation_spin(speed = 5, loop_amount = -1, clockwise = TRUE, sections = 3, angular_offset = 0, pixel_fuzz = 0)
clockwise = pick(TRUE, FALSE)
angular_offset = rand(360)
pixel_fuzz = 16
return ..()
/obj/item/device/flashlight/flare/pickup()
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/explosives/grenades/grenade.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
var/hand_throwable = TRUE
harmful = TRUE //Is it harmful? Are they banned for synths?
antigrief_protection = TRUE //Should it be checked by antigrief?
ground_offset_x = 7
ground_offset_y = 6

/obj/item/explosive/grenade/Initialize()
. = ..()
det_time = max(0, rand(det_time - 5, det_time + 5))
pixel_y = rand(-6, 6)
pixel_x = rand(-7, 7)

/obj/item/explosive/grenade/proc/can_use_grenade(mob/living/carbon/human/user)
if(!hand_throwable)
Expand Down
7 changes: 2 additions & 5 deletions code/game/objects/items/explosives/warhead.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
icon = 'icons/obj/items/weapons/grenade.dmi'
customizable = TRUE
allowed_sensors = list() //We only need a detonator

/obj/item/explosive/warhead/Initialize(mapload, ...)
. = ..()
pixel_y = rand(-6, 6)
pixel_x = rand(-7, 7)
ground_offset_x = 7
ground_offset_y = 6

/obj/item/explosive/warhead/rocket
name = "84mm rocket warhead"
Expand Down
7 changes: 2 additions & 5 deletions code/game/objects/items/reagent_containers/glass.dm
Original file line number Diff line number Diff line change
Expand Up @@ -363,11 +363,8 @@
matter = list()
possible_transfer_amounts = list(5,10,15,25,30)
flags_atom = FPRINT|OPENCONTAINER

/obj/item/reagent_container/glass/beaker/vial/Initialize()
. = ..()
pixel_y = rand(-8, 8)
pixel_x = rand(-9, 9)
ground_offset_x = 9
ground_offset_y = 8

/obj/item/reagent_container/glass/beaker/vial/tricordrazine
name = "tricordrazine vial"
Expand Down
2 changes: 2 additions & 0 deletions code/game/objects/items/reagent_containers/pill.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
w_class = SIZE_TINY
volume = 60
reagent_desc_override = TRUE //it has a special examining mechanic
ground_offset_x = 7
ground_offset_y = 7
var/identificable = TRUE //can medically trained people tell what's in it?
var/pill_desc = "An unknown pill." // The real description of the pill, shown when examined by a medically trained person
var/pill_icon_class = "random" // Pills with the same icon class share icons
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
var/transparent = FALSE //can we see what's in it?
var/reagent_desc_override = FALSE //does it have a special examining mechanic that should override the normal /reagent_containers examine proc?
actions_types = list(/datum/action/item_action/reagent_container/set_transfer_amount)
ground_offset_x = 7
ground_offset_y = 7

/obj/item/reagent_container/Initialize()
if(!possible_transfer_amounts)
Expand Down
6 changes: 2 additions & 4 deletions code/game/objects/items/stacks/cable_coil.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
attack_verb = list("whipped", "lashed", "disciplined", "flogged")
stack_id = "cable coil"
attack_speed = 3
ground_offset_x = 2
ground_offset_y = 2

/obj/item/stack/cable_coil/Initialize(mapload, length = MAXCOIL, param_color = null)
. = ..()
src.amount = length
if (param_color) // It should be red by default, so only recolor it if parameter was specified.
color = param_color
pixel_x = rand(-2,2)
pixel_y = rand(-2,2)
updateicon()
update_wclass()

Expand Down Expand Up @@ -276,8 +276,6 @@
/obj/item/stack/cable_coil/cut/Initialize()
. = ..()
src.amount = rand(1,2)
pixel_x = rand(-2,2)
pixel_y = rand(-2,2)
updateicon()
update_wclass()

Expand Down
3 changes: 3 additions & 0 deletions code/game/objects/items/stacks/sheets/sheet_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ var/global/list/datum/stack_recipe/metal_recipes = list ( \
sheettype = "metal"
stack_id = "metal"


/obj/item/stack/sheet/metal/small_stack
amount = STACK_10

Expand Down Expand Up @@ -114,6 +115,8 @@ var/global/list/datum/stack_recipe/plasteel_recipes = list ( \
amount_sprites = TRUE
sheettype = "plasteel"
stack_id = "plasteel"
ground_offset_x = 4
ground_offset_y = 5

/obj/item/stack/sheet/plasteel/New(loc, amount=null)
recipes = plasteel_recipes
Expand Down
3 changes: 1 addition & 2 deletions code/game/objects/structures/surface.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@
draw_item_overlays()

/obj/structure/surface/proc/detach_item(obj/item/O)
O.pixel_x = initial(O.pixel_x)
O.pixel_y = initial(O.pixel_y)
O.scatter_item()
UnregisterSignal(O, COMSIG_ATOM_DECORATED)
draw_item_overlays()
return
Expand Down
1 change: 1 addition & 0 deletions code/modules/cm_marines/equipment/guncases.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
can_hold = list()//define on a per case basis for the original firearm.
foldable = TRUE
foldable = /obj/item/stack/sheet/mineral/plastic//it makes sense
ground_offset_y = 5

/obj/item/storage/box/guncase/update_icon()
if(LAZYLEN(contents))
Expand Down
4 changes: 2 additions & 2 deletions code/modules/cm_marines/equipment/kit_boxes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,12 @@
slowdown = 1
can_hold = list() //Nada. Once you take the stuff out it doesn't fit back in.
foldable = TRUE
ground_offset_x = 5
ground_offset_y = 5
var/pro_case_overlay

/obj/item/storage/box/kit/Initialize()
. = ..()
pixel_x = rand(-5, 5)
pixel_y = rand(-5, 5)
if(pro_case_overlay)
overlays += image('icons/obj/items/storage.dmi', "+[pro_case_overlay]")

Expand Down
6 changes: 2 additions & 4 deletions code/modules/cm_marines/equipment/mortar/mortar_shells.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
w_class = SIZE_HUGE
flags_atom = FPRINT|CONDUCT
var/datum/cause_data/cause_data
ground_offset_x = 7
ground_offset_y = 6

/obj/item/mortar_shell/Initialize(mapload, ...)
. = ..()
pixel_y = rand(-6, 6)
pixel_x = rand(-7, 7)

/obj/item/mortar_shell/Destroy()
. = ..()
Expand Down
4 changes: 2 additions & 2 deletions code/modules/cm_marines/orbital_cannon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,8 @@ var/list/ob_type_fuel_requirements
icon_state = "ob_fuel"
is_solid_fuel = 1

/obj/structure/ob_ammo/ob_fuel/New()
..()
/obj/structure/ob_ammo/ob_fuel/Initialize()
. = ..()
pixel_x = rand(-5,5)
pixel_y = rand(-5,5)

Expand Down
6 changes: 2 additions & 4 deletions code/modules/hydroponics/botany_disks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@
icon = 'icons/obj/items/disk.dmi'
icon_state = "botanydisk"
w_class = SIZE_TINY
ground_offset_x = 5
ground_offset_y = 5

var/list/genes = list()
var/genesource = "unknown"

/obj/item/disk/botany/Initialize()
. = ..()
pixel_x = rand(-5,5)
pixel_y = rand(-5,5)

/obj/item/disk/botany/attack_self(mob/user)
..()
Expand Down
4 changes: 2 additions & 2 deletions code/modules/objectives/data_retrieval.dm
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@
var/datum/cm_objective/retrieve_item/document/retrieve_objective
var/display_color = "white"
var/disk_color = "White"
ground_offset_x = 9
ground_offset_y = 8

/obj/item/disk/objective/Initialize(mapload, ...)
. = ..()
Expand Down Expand Up @@ -210,8 +212,6 @@
name = "[disk_color] computer disk [label]"
objective = new /datum/cm_objective/retrieve_data/disk(src)
retrieve_objective = new /datum/cm_objective/retrieve_item/document(src)
pixel_y = rand(-8, 8)
pixel_x = rand(-9, 9)
w_class = SIZE_TINY

/obj/item/disk/objective/Destroy()
Expand Down
4 changes: 2 additions & 2 deletions code/modules/objectives/documents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@
unacidable = TRUE
indestructible = 1
is_objective = TRUE
ground_offset_x = 9
ground_offset_y = 8
var/label // label on the document
var/renamed = FALSE //Once someone reads a document the item gets renamed based on the objective they are linked to)

Expand All @@ -131,8 +133,6 @@
objective = new objective_type(src)
retrieve_objective = new /datum/cm_objective/retrieve_item/document(src)
LAZYADD(objective.enables_objectives, retrieve_objective)
pixel_y = rand(-8, 8)
pixel_x = rand(-9, 9)

/obj/item/document_objective/Destroy()
qdel(objective)
Expand Down
4 changes: 2 additions & 2 deletions code/modules/paperwork/paper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
flags_equip_slot = SLOT_HEAD
flags_armor_protection = BODY_FLAG_HEAD
attack_verb = list("bapped")
ground_offset_x = 9
ground_offset_y = 8

var/info //What's actually written on the paper.
var/info_links //A different version of the paper which includes html links at fields and EOF
Expand All @@ -42,8 +44,6 @@

/obj/item/paper/Initialize(mapload, photo_list)
. = ..()
pixel_y = rand(-8, 8)
pixel_x = rand(-9, 9)
stamps = ""
src.photo_list = photo_list

Expand Down
2 changes: 0 additions & 2 deletions code/modules/paperwork/photocopier.dm
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@
p.update_icon()
p.icon_state = "paper_words"
p.name = bundle.name
p.pixel_y = rand(-8, 8)
p.pixel_x = rand(-9, 9)
sleep(15*j)
updateUsrDialog()
else if(href_list["remove"])
Expand Down
4 changes: 2 additions & 2 deletions code/modules/projectiles/ammo_boxes/ammo_boxes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@
var/handful = "shells" //used for 'magazine' boxes that give handfuls to determine what kind for the sprite
can_explode = TRUE
limit_per_tile = 2
ground_offset_x = 5
ground_offset_y = 5

/obj/item/ammo_box/magazine/empty
empty = TRUE
Expand All @@ -102,8 +104,6 @@
while(i < num_of_magazines)
contents += new magazine_type(src)
i++
pixel_x = rand(-5, 5)
pixel_y = rand(-5, 5)
update_icon()

/obj/item/ammo_box/magazine/update_icon()
Expand Down
Loading
Loading