From ba3edef820fd68aa14480d23f1464b6d8c9bfe81 Mon Sep 17 00:00:00 2001 From: "Wowzewow (Wezzy)" <42310821+alsoandanswer@users.noreply.github.com> Date: Thu, 21 Jul 2022 04:44:04 +0800 Subject: [PATCH] Fixes pickup animation layering and colored chairs (#14453) --- code/game/atoms_movable.dm | 3 +- code/game/objects/items.dm | 7 ++++ code/game/objects/items/weapons/dice.dm | 2 +- .../items/weapons/material/twohanded.dm | 1 - .../structures/stool_bed_chair_nest/bed.dm | 8 ++-- .../structures/stool_bed_chair_nest/stools.dm | 14 +++---- .../clothing/under/accessories/lockets.dm | 1 - html/changelogs/wezzy_pickupfix.yml | 42 +++++++++++++++++++ 8 files changed, 62 insertions(+), 16 deletions(-) create mode 100644 html/changelogs/wezzy_pickupfix.yml diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index db4001ab85e..9aa1226c944 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -369,10 +369,9 @@ /atom/movable/proc/get_bullet_impact_effect_type() return BULLET_IMPACT_NONE -/atom/movable/proc/do_pickup_animation(atom/target) +/atom/movable/proc/do_pickup_animation(atom/target, var/image/pickup_animation = image(icon, loc, icon_state, ABOVE_ALL_MOB_LAYER, dir, pixel_x, pixel_y)) if(!isturf(loc)) return - var/image/pickup_animation = image(icon, loc, icon_state, layer + 0.1, dir, pixel_x, pixel_y) pickup_animation.color = color pickup_animation.transform.Scale(0.75) pickup_animation.appearance_flags = APPEARANCE_UI_IGNORE_ALPHA diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index cdb5aa8bbfc..32f2070f0f4 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -65,6 +65,7 @@ //var/item_state = null // Used to specify the item state for the on-mob overlays. var/item_state_slots //overrides the default item_state for particular slots. + var/base_icon // used in furniture for previews. used in material weapons too. var/build_from_parts = FALSE // when it uses coloration and a part of it wants to remain uncolored. e.g., handle of the screwdriver is colored while the head is not. var/worn_overlay = null // used similarly as above, except for inhands. var/worn_overlay_color = null // When you want your worn overlay to have colors. So you can have more than one modular coloring. @@ -1039,3 +1040,9 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out. /obj/item/proc/can_swap_hands(var/mob/user) return TRUE + +/obj/item/do_pickup_animation(atom/target, var/image/pickup_animation = image(icon, loc, icon_state, ABOVE_ALL_MOB_LAYER, dir, pixel_x, pixel_y)) + if(!isturf(loc)) + return + pickup_animation.overlays = overlays + . = ..() diff --git a/code/game/objects/items/weapons/dice.dm b/code/game/objects/items/weapons/dice.dm index 9dbb3732770..5491cc5567b 100644 --- a/code/game/objects/items/weapons/dice.dm +++ b/code/game/objects/items/weapons/dice.dm @@ -7,7 +7,7 @@ attack_verb = list("diced") max_amount = 6 - var/base_icon = "d6" + base_icon = "d6" var/side_mult = 1 // Used for d100s. var/sides = 6 var/weight_roll = 0 // chance of the dice falling on its favored number diff --git a/code/game/objects/items/weapons/material/twohanded.dm b/code/game/objects/items/weapons/material/twohanded.dm index ea2bff6179d..16561cc43ed 100644 --- a/code/game/objects/items/weapons/material/twohanded.dm +++ b/code/game/objects/items/weapons/material/twohanded.dm @@ -23,7 +23,6 @@ var/force_unwielded var/wield_sound = /decl/sound_category/generic_wield_sound var/unwield_sound = null - var/base_icon var/base_name var/unwielded_force_divisor = 0.25 var/parry_chance = 15 diff --git a/code/game/objects/structures/stool_bed_chair_nest/bed.dm b/code/game/objects/structures/stool_bed_chair_nest/bed.dm index 5cb7015690e..191020a6b15 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/bed.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/bed.dm @@ -346,7 +346,7 @@ item_state = "rollerbed" anchored = FALSE makes_rolling_sound = TRUE - var/base_state = "standard" + base_icon = "standard" held_item = /obj/item/roller var/obj/item/reagent_containers/beaker var/obj/item/vitals_monitor/vitals @@ -368,9 +368,9 @@ cut_overlays() vis_contents = list() if(density) - icon_state = "[base_state]_up" + icon_state = "[base_icon]_up" else - icon_state = "[base_state]_down" + icon_state = "[base_icon]_down" if(beaker) var/image/iv = image(icon, "iv[iv_attached]") var/percentage = round((beaker.reagents.total_volume / beaker.volume) * 100, 25) @@ -518,7 +518,7 @@ /obj/structure/bed/roller/hover name = "medical hoverbed" icon_state = "hover_down" - base_state = "hover" + base_icon = "hover" makes_rolling_sound = FALSE held_item = /obj/item/roller/hover patient_shift = 6 diff --git a/code/game/objects/structures/stool_bed_chair_nest/stools.dm b/code/game/objects/structures/stool_bed_chair_nest/stools.dm index 60031c5504e..437b620087b 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/stools.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/stools.dm @@ -20,7 +20,7 @@ if(!held_item || use_check_and_message(usr) || buckled || (anchored && padding_material)) // Make sure held_item = null if you don't want it to get picked up. return usr.visible_message(SPAN_NOTICE("[usr] [withdraw_verb]s \the [src.name]."), SPAN_NOTICE("You [withdraw_verb] \the [src.name].")) - var/obj/item/material/stool/S = new held_item(src.loc, material.name, padding_material ? padding_material.name : null) // Handles all the material code so you don't have to. + var/obj/item/material/stool/S = new held_item(src.loc, material.name, padding_material ? padding_material.name : null, painted_colour) // Handles all the material code so you don't have to. TransferComponents(S) if(material_alteration & MATERIAL_ALTERATION_COLOR) // For snowflakes like wood chairs. S.color = material.icon_colour @@ -28,8 +28,6 @@ S.name = name // Get the name and desc of the stool, rather. We already went through all the trouble in New in bed.dm if(material_alteration & MATERIAL_ALTERATION_DESC) S.desc = desc - if(painted_colour) - S.painted_colour = painted_colour if(blood_DNA) S.blood_DNA |= blood_DNA // Transfer blood, if any. S.add_blood() @@ -163,7 +161,7 @@ ) icon_state = "stool_item_preview" item_state = "stool" - var/base_icon = "stool" + base_icon = "stool" desc_info = "Use in-hand or alt-click to right this." randpixel = 0 center_of_mass = null @@ -178,10 +176,12 @@ var/deploy_verb = "right" var/painted_colour -/obj/item/material/stool/New(var/newloc, var/new_material, var/new_padding_material) +/obj/item/material/stool/New(var/newloc, var/new_material, var/new_padding_material, var/new_painted_colour) ..(newloc, new_material) // new_material handled in material_weapons.dm if(new_padding_material) padding_material = SSmaterials.get_material_by_name(new_padding_material) + if(new_painted_colour) + painted_colour = new_painted_colour update_icon() /obj/item/material/stool/attack_self(mob/user) @@ -240,12 +240,12 @@ user.visible_message(SPAN_NOTICE("[user] [deploy_verb]s \the [src.name]."), SPAN_NOTICE("You [deploy_verb] \the [name].")) // playsound(src, deploy_sound ? deploy_sound : drop_sound, DROP_SOUND_VOLUME) user.drop_from_inventory(src) - var/obj/structure/bed/stool/S = new origin_type(get_turf(loc), material.name, padding_material ? padding_material.name : null) // Fuck me. - S.update_icon() + var/obj/structure/bed/stool/S = new origin_type(get_turf(loc), material.name, padding_material ? padding_material.name : null, painted_colour) // Fuck me. TransferComponents(S) S.dir = user.dir // Plant it where the user's facing if(blood_DNA) S.blood_DNA |= blood_DNA // Transfer blood. + S.update_icon() qdel(src) /obj/item/material/stool/update_icon() diff --git a/code/modules/clothing/under/accessories/lockets.dm b/code/modules/clothing/under/accessories/lockets.dm index 58f489d8e39..e2af2625e3a 100644 --- a/code/modules/clothing/under/accessories/lockets.dm +++ b/code/modules/clothing/under/accessories/lockets.dm @@ -6,7 +6,6 @@ slot_flags = 0 w_class = ITEMSIZE_SMALL slot_flags = SLOT_MASK | SLOT_TIE - var/base_icon var/open var/obj/item/held //Item inside locket. diff --git a/html/changelogs/wezzy_pickupfix.yml b/html/changelogs/wezzy_pickupfix.yml new file mode 100644 index 00000000000..8bb7d619ed4 --- /dev/null +++ b/html/changelogs/wezzy_pickupfix.yml @@ -0,0 +1,42 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: Wowzewow (Wezzy) + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Fixes pickup animations not applying overlays and not layering over mobs." + - bugfix: "Fixes colored chairs not re-applying colors when picked up and placed down."