From 2f1b08c9ca0643c64c74f7725fccae856bd4f031 Mon Sep 17 00:00:00 2001 From: Ed640 Date: Sat, 3 Feb 2024 20:12:33 -0600 Subject: [PATCH 01/13] Statuettes Initial file, still figuring out how to have it show inhand. --- maplestation.dme | 1 + .../code/modules/art/statuettes.dm | 231 ++++++++++++++++++ 2 files changed, 232 insertions(+) create mode 100644 maplestation_modules/code/modules/art/statuettes.dm diff --git a/maplestation.dme b/maplestation.dme index 40d6cc981133..68ed74cf1763 100644 --- a/maplestation.dme +++ b/maplestation.dme @@ -6234,6 +6234,7 @@ #include "maplestation_modules\code\modules\antagonists\advanced_traitor\advanced_traitor.dm" #include "maplestation_modules\code\modules\antagonists\infiltrator\advanced_infiltrator.dm" #include "maplestation_modules\code\modules\antagonists\infiltrator\infiltrator.dm" +#include "maplestation_modules\code\modules\art\statuettes.dm" #include "maplestation_modules\code\modules\cargo\costumes_toys.dm" #include "maplestation_modules\code\modules\cargo\packs.dm" #include "maplestation_modules\code\modules\client\preferences\_preferences.dm" diff --git a/maplestation_modules/code/modules/art/statuettes.dm b/maplestation_modules/code/modules/art/statuettes.dm new file mode 100644 index 000000000000..71964c3a3518 --- /dev/null +++ b/maplestation_modules/code/modules/art/statuettes.dm @@ -0,0 +1,231 @@ +//Copied mostly from statues.dm with edits to apply for an item +/obj/item/statue/custom + name = "custom statue" + icon = 'icons/obj/art/statue.dmi' + icon_state = "base" + obj_flags = UNIQUE_RENAME + appearance_flags = KEEP_TOGETHER//Added keep together in case targets has weird layering + w_class = WEIGHT_CLASS_SMALL + /// primary statue overlay + var/mutable_appearance/content_ma + var/static/list/greyscale_with_value_bump = list(0,0,0, 0,0,0, 0,0,1, 0,0,-0.05) + +//When out in the world, is tiny like action figures, but can pick up to see better +/obj/item/statue/custom/Initialize(mapload) + . = ..() + AddElement(/datum/element/item_scaling, 0.4, 1) + AddComponent(/datum/component/simple_rotation) + +/obj/structure/statue/AltClick(mob/user) + return ..() // This hotkey is BLACKLISTED since it's used by /datum/component/simple_rotation + +/obj/item/statue/custom/Destroy() + content_ma = null + return ..() + +/obj/item/statue/custom/proc/set_visuals(model_appearance) + if(content_ma) + QDEL_NULL(content_ma) + content_ma = new + content_ma.appearance = model_appearance + content_ma.pixel_x = 0 + content_ma.pixel_y = 0 + content_ma.alpha = 255 +/* + var/static/list/plane_whitelist = list(FLOAT_PLANE, GAME_PLANE, FLOOR_PLANE) + + /// Ideally we'd have knowledge what we're removing but i'd have to be done on target appearance retrieval + var/list/overlays_to_remove = list() + for(var/mutable_appearance/special_overlay as anything in content_ma.overlays) + var/mutable_appearance/real = new() + real.appearance = special_overlay + if(PLANE_TO_TRUE(real.plane) in plane_whitelist) + continue + overlays_to_remove += real + content_ma.overlays -= overlays_to_remove + + var/list/underlays_to_remove = list() + for(var/mutable_appearance/special_underlay as anything in content_ma.underlays) + var/mutable_appearance/real = new() + real.appearance = special_underlay + if(PLANE_TO_TRUE(real.plane) in plane_whitelist) + continue + underlays_to_remove += real + content_ma.underlays -= underlays_to_remove +*/ + content_ma.appearance_flags &= ~KEEP_APART //Don't want this + content_ma.filters = filter(type="color",color=greyscale_with_value_bump,space=FILTER_COLOR_HSV) + update_content_planes() + update_appearance() +/* +/obj/item/carving_block/update_overlays() + . = ..() + if(!target_appearance_with_filters) + return + //We're only keeping one instance here that changes in the middle so we have to clone it to avoid managed overlay issues + var/mutable_appearance/clone = new(target_appearance_with_filters) + . += clone +*/ +/obj/item/statue/custom/proc/update_content_planes() + if(!content_ma) + return + var/turf/our_turf = get_turf(src) + // MA's stored in the overlays list are not actually mutable, they've been flattened + // This proc unflattens them, updates them, and then reapplies + var/list/created = update_appearance_planes(list(content_ma), GET_TURF_PLANE_OFFSET(our_turf)) + content_ma = created[1] + +//Inhand version of a carving block that doesnt need a chisel +/obj/item/modeling_block + name = "Modeling block" + desc = "Ready for sculpting. Look for a subject and use in hand to sculpt." + icon = 'icons/obj/art/statue.dmi' + icon_state = "block" + w_class = WEIGHT_CLASS_SMALL + + /// The thing it will look like - Unmodified resulting statue appearance + var/current_target + /// Currently chosen preset statue type + var/current_preset_type + /// statue completion from 0 to 1.0 + var/completion = 0 + /// Greyscaled target with cutout filter + var/mutable_appearance/target_appearance_with_filters + /// HSV color filters parameters + var/static/list/greyscale_with_value_bump = list(0,0,0, 0,0,0, 0,0,1, 0,0,-0.05) + + //Adding chisel vars + /// Block we're currently carving in + var/obj/item/modeling_block/prepared_block + /// If tracked user moves we stop sculpting + var/mob/living/tracked_user + /// Currently sculpting + var/sculpting = FALSE + +/obj/item/modeling_block/Initialize(mapload) + . = ..() + AddElement(/datum/element/item_scaling, 0.4, 1) + +// Add to plastic recipes +/obj/item/stack/sheet/plastic/get_main_recipes() + . = ..() + . += list(new /datum/stack_recipe("Modeling block", /obj/item/modeling_block, 2)) + +/* +/obj/item/modeling_block/Destroy() + current_target = null + target_appearance_with_filters = null + return ..() + + +/obj/item/modeling_block/pre_attack(atom/target, mob/living/user, params) + . = ..() + /* + if(sculpting) + return TRUE + */ + //We're aiming at something next to us + set_target(target, user) + //skip sculpting time + create_statue() + return TRUE +*/ + +// We aim at something distant. +/obj/item/modeling_block/afterattack(atom/target, mob/user, proximity_flag, click_parameters) + . = ..() + + if (!sculpting && ismovable(target)) + set_target(target,user) + //skip sculpting time + create_statue() + + return . | AFTERATTACK_PROCESSED_ITEM + +/obj/item/modeling_block/proc/is_viable_target(mob/living/user, atom/movable/target) + //Only things on turfs + if(!isturf(target.loc)) + user.balloon_alert(user, "no sculpt target!") + return FALSE + //No big icon things + var/list/icon_dimensions = get_icon_dimensions(target.icon) + if(icon_dimensions["width"] != world.icon_size || icon_dimensions["height"] != world.icon_size) + user.balloon_alert(user, "sculpt target is too big!") + return FALSE + return TRUE + +/obj/item/modeling_block/proc/set_target(atom/movable/target, mob/living/user) + if(!is_viable_target(user, target)) + return + if(istype(target,/obj/item/statue/custom)) + var/obj/item/statue/custom/original = target + current_target = original.content_ma + else + current_target = target.appearance + var/mutable_appearance/ma = current_target + user.balloon_alert(user, "sculpt target is [ma.name]") +/* seeing if i can skip the sculpting time and/or if setting target works +/obj/item/modeling_block/attack_self(mob/user) + start_sculpting(user) + +/// Starts or continues the sculpting action on the carving block material +/obj/item/modeling_block/proc/start_sculpting(mob/living/user) + user.balloon_alert(user, "sculpting block...") + playsound(src, pick(usesound), 75, TRUE) + sculpting = TRUE + //How long whole process takes + var/sculpting_time = 30 SECONDS + //Single interruptible progress period + var/sculpting_period = round(sculpting_time / world.icon_size) //this is just so it reveals pixels line by line for each. + var/interrupted = FALSE + var/remaining_time = sculpting_time - (prepared_block.completion * sculpting_time) + + var/datum/progressbar/total_progress_bar = new(user, sculpting_time, prepared_block) + while(remaining_time > 0 && !interrupted) + if(do_after(user, sculpting_period, target = prepared_block, progress = FALSE)) + var/time_delay = !(remaining_time % SCULPT_SOUND_INCREMENT) + if(time_delay) + playsound(src, 'sound/effects/break_stone.ogg', 50, TRUE) + remaining_time -= sculpting_period + prepared_block.set_completion((sculpting_time - remaining_time)/sculpting_time) + total_progress_bar.update(sculpting_time - remaining_time) + else + interrupted = TRUE + total_progress_bar.end_progress() + if(!interrupted && !QDELETED(prepared_block)) + prepared_block.create_statue() + user.balloon_alert(user, "statue finished") + stop_sculpting(silent = !interrupted) + +/obj/item/modeling_block/dropped(mob/user, silent) + . = ..() + stop_sculpting() + +/// Cancel the sculpting action +/obj/item/modeling_block/proc/stop_sculpting(silent = FALSE) + sculpting = FALSE + if(prepared_block && prepared_block.completion == 0) + prepared_block.reset_target() + prepared_block = null + + if(!silent && tracked_user) + tracked_user.balloon_alert(tracked_user, "sculpting cancelled!") + + if(tracked_user) + UnregisterSignal(tracked_user, COMSIG_MOVABLE_MOVED) + tracked_user = null + +/obj/item/modeling_block/proc/on_moved() + SIGNAL_HANDLER + + stop_sculpting() + */ + +/obj/item/modeling_block/proc/create_statue() + var/obj/item/statue/custom/new_statue = new(get_turf(src)) + new_statue.set_visuals(current_target) + var/mutable_appearance/ma = current_target + new_statue.name = "statuette of [ma.name]" + new_statue.desc = "A carved statuette depicting [ma.name]." + qdel(src) + From 5e1be436e62db7fefe9d13e950dd5d5acf41bebf Mon Sep 17 00:00:00 2001 From: Ed640 Date: Sun, 4 Feb 2024 02:08:41 -0600 Subject: [PATCH 02/13] Get target check and Doubled max size --- .../code/modules/art/statuettes.dm | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/maplestation_modules/code/modules/art/statuettes.dm b/maplestation_modules/code/modules/art/statuettes.dm index 71964c3a3518..09b632585b42 100644 --- a/maplestation_modules/code/modules/art/statuettes.dm +++ b/maplestation_modules/code/modules/art/statuettes.dm @@ -4,7 +4,7 @@ icon = 'icons/obj/art/statue.dmi' icon_state = "base" obj_flags = UNIQUE_RENAME - appearance_flags = KEEP_TOGETHER//Added keep together in case targets has weird layering + appearance_flags = KEEP_TOGETHER | PIXEL_SCALE | TILE_BOUND//Added keep together in case targets has weird layering w_class = WEIGHT_CLASS_SMALL /// primary statue overlay var/mutable_appearance/content_ma @@ -31,7 +31,7 @@ content_ma.pixel_x = 0 content_ma.pixel_y = 0 content_ma.alpha = 255 -/* + var/static/list/plane_whitelist = list(FLOAT_PLANE, GAME_PLANE, FLOOR_PLANE) /// Ideally we'd have knowledge what we're removing but i'd have to be done on target appearance retrieval @@ -52,7 +52,7 @@ continue underlays_to_remove += real content_ma.underlays -= underlays_to_remove -*/ + content_ma.appearance_flags &= ~KEEP_APART //Don't want this content_ma.filters = filter(type="color",color=greyscale_with_value_bump,space=FILTER_COLOR_HSV) update_content_planes() @@ -66,6 +66,11 @@ var/mutable_appearance/clone = new(target_appearance_with_filters) . += clone */ +/obj/structure/statue/custom/update_overlays() + . = ..() + if(content_ma) + . += content_ma + /obj/item/statue/custom/proc/update_content_planes() if(!content_ma) return @@ -138,7 +143,8 @@ if (!sculpting && ismovable(target)) set_target(target,user) //skip sculpting time - create_statue() + if(current_target != null) + create_statue() return . | AFTERATTACK_PROCESSED_ITEM @@ -149,7 +155,7 @@ return FALSE //No big icon things var/list/icon_dimensions = get_icon_dimensions(target.icon) - if(icon_dimensions["width"] != world.icon_size || icon_dimensions["height"] != world.icon_size) + if(icon_dimensions["width"] > 2*world.icon_size || icon_dimensions["height"] > 2*world.icon_size) user.balloon_alert(user, "sculpt target is too big!") return FALSE return TRUE @@ -222,10 +228,10 @@ */ /obj/item/modeling_block/proc/create_statue() - var/obj/item/statue/custom/new_statue = new(get_turf(src)) - new_statue.set_visuals(current_target) - var/mutable_appearance/ma = current_target - new_statue.name = "statuette of [ma.name]" - new_statue.desc = "A carved statuette depicting [ma.name]." - qdel(src) + var/obj/item/statue/custom/new_statue = new(get_turf(src)) + new_statue.set_visuals(current_target) + var/mutable_appearance/ma = current_target + new_statue.name = "statuette of [ma.name]" + new_statue.desc = "A carved statuette depicting [ma.name]." + qdel(src) From 67d2924513c98b180c076706875cc46f0404f72a Mon Sep 17 00:00:00 2001 From: Ed640 Date: Sun, 4 Feb 2024 06:12:09 -0600 Subject: [PATCH 03/13] Minor fix, but stuck over HUD --- maplestation_modules/code/modules/art/statuettes.dm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/maplestation_modules/code/modules/art/statuettes.dm b/maplestation_modules/code/modules/art/statuettes.dm index 09b632585b42..523166972e3f 100644 --- a/maplestation_modules/code/modules/art/statuettes.dm +++ b/maplestation_modules/code/modules/art/statuettes.dm @@ -71,6 +71,15 @@ if(content_ma) . += content_ma +/obj/item/statue/custom/equipped(mob/user) + . = ..() + if(!isturf(src)) + SET_PLANE_EXPLICIT(src.content_ma, ABOVE_HUD_PLANE, user) + update_appearance_planes(content_ma) + else + SET_PLANE_EXPLICIT(src.content_ma, GAME_PLANE, user) + update_appearance_planes(content_ma) + /obj/item/statue/custom/proc/update_content_planes() if(!content_ma) return @@ -234,4 +243,3 @@ new_statue.name = "statuette of [ma.name]" new_statue.desc = "A carved statuette depicting [ma.name]." qdel(src) - From 4637bf33a5dc92909411921a8de1b71c75397bc8 Mon Sep 17 00:00:00 2001 From: Ed640 Date: Sun, 4 Feb 2024 06:44:02 -0600 Subject: [PATCH 04/13] newly sculpted statuettes stay inhand --- maplestation_modules/code/modules/art/statuettes.dm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/maplestation_modules/code/modules/art/statuettes.dm b/maplestation_modules/code/modules/art/statuettes.dm index 523166972e3f..97031da70ad6 100644 --- a/maplestation_modules/code/modules/art/statuettes.dm +++ b/maplestation_modules/code/modules/art/statuettes.dm @@ -153,7 +153,7 @@ set_target(target,user) //skip sculpting time if(current_target != null) - create_statue() + create_statue(user) return . | AFTERATTACK_PROCESSED_ITEM @@ -181,7 +181,7 @@ user.balloon_alert(user, "sculpt target is [ma.name]") /* seeing if i can skip the sculpting time and/or if setting target works /obj/item/modeling_block/attack_self(mob/user) - start_sculpting(user) + create_statue(user) /// Starts or continues the sculpting action on the carving block material /obj/item/modeling_block/proc/start_sculpting(mob/living/user) @@ -236,10 +236,11 @@ stop_sculpting() */ -/obj/item/modeling_block/proc/create_statue() +/obj/item/modeling_block/proc/create_statue(mob/user) var/obj/item/statue/custom/new_statue = new(get_turf(src)) new_statue.set_visuals(current_target) var/mutable_appearance/ma = current_target new_statue.name = "statuette of [ma.name]" new_statue.desc = "A carved statuette depicting [ma.name]." + user.put_in_active_hand(new_statue, TRUE) qdel(src) From e9aac38eec0f14bc668c71d19e819eb3ccfbfb9d Mon Sep 17 00:00:00 2001 From: Ed640 Date: Tue, 6 Feb 2024 21:01:05 -0600 Subject: [PATCH 05/13] fixed crafting needing an empty tile, testing --- .../code/modules/art/statuettes.dm | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/maplestation_modules/code/modules/art/statuettes.dm b/maplestation_modules/code/modules/art/statuettes.dm index 97031da70ad6..2c3603e77484 100644 --- a/maplestation_modules/code/modules/art/statuettes.dm +++ b/maplestation_modules/code/modules/art/statuettes.dm @@ -4,7 +4,7 @@ icon = 'icons/obj/art/statue.dmi' icon_state = "base" obj_flags = UNIQUE_RENAME - appearance_flags = KEEP_TOGETHER | PIXEL_SCALE | TILE_BOUND//Added keep together in case targets has weird layering + appearance_flags = TILE_BOUND | PIXEL_SCALE | KEEP_TOGETHER//Added keep together in case targets has weird layering w_class = WEIGHT_CLASS_SMALL /// primary statue overlay var/mutable_appearance/content_ma @@ -16,7 +16,7 @@ AddElement(/datum/element/item_scaling, 0.4, 1) AddComponent(/datum/component/simple_rotation) -/obj/structure/statue/AltClick(mob/user) +/obj/item/statue/AltClick(mob/user) return ..() // This hotkey is BLACKLISTED since it's used by /datum/component/simple_rotation /obj/item/statue/custom/Destroy() @@ -58,15 +58,15 @@ update_content_planes() update_appearance() /* -/obj/item/carving_block/update_overlays() +/obj/item/modeling_block/update_overlays() . = ..() if(!target_appearance_with_filters) return //We're only keeping one instance here that changes in the middle so we have to clone it to avoid managed overlay issues var/mutable_appearance/clone = new(target_appearance_with_filters) . += clone -*/ -/obj/structure/statue/custom/update_overlays() + +/obj/item/statue/custom/update_overlays() . = ..() if(content_ma) . += content_ma @@ -76,17 +76,19 @@ if(!isturf(src)) SET_PLANE_EXPLICIT(src.content_ma, ABOVE_HUD_PLANE, user) update_appearance_planes(content_ma) - else - SET_PLANE_EXPLICIT(src.content_ma, GAME_PLANE, user) - update_appearance_planes(content_ma) +/obj/item/statue/custom/dropped(mob/user) + . = ..() + SET_PLANE_EXPLICIT(src.content_ma, GAME_PLANE, user) + update_appearance_planes(content_ma) +*/ /obj/item/statue/custom/proc/update_content_planes() if(!content_ma) return - var/turf/our_turf = get_turf(src) + //var/turf/our_turf = get_turf(src) // MA's stored in the overlays list are not actually mutable, they've been flattened // This proc unflattens them, updates them, and then reapplies - var/list/created = update_appearance_planes(list(content_ma), GET_TURF_PLANE_OFFSET(our_turf)) + var/list/created = update_appearance_planes(list(content_ma), src) content_ma = created[1] //Inhand version of a carving block that doesnt need a chisel @@ -237,7 +239,7 @@ */ /obj/item/modeling_block/proc/create_statue(mob/user) - var/obj/item/statue/custom/new_statue = new(get_turf(src)) + var/obj/item/statue/custom/new_statue = new(user.loc) new_statue.set_visuals(current_target) var/mutable_appearance/ma = current_target new_statue.name = "statuette of [ma.name]" From ae6ff42d48f3a430c8ed627dc15a3398c66053e3 Mon Sep 17 00:00:00 2001 From: Ed640 Date: Thu, 8 Feb 2024 17:55:49 -0600 Subject: [PATCH 06/13] Actually Fix crafting --- .../code/modules/art/statuettes.dm | 39 ++++++++++++------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/maplestation_modules/code/modules/art/statuettes.dm b/maplestation_modules/code/modules/art/statuettes.dm index 2c3603e77484..bdcc919b9dbd 100644 --- a/maplestation_modules/code/modules/art/statuettes.dm +++ b/maplestation_modules/code/modules/art/statuettes.dm @@ -35,23 +35,31 @@ var/static/list/plane_whitelist = list(FLOAT_PLANE, GAME_PLANE, FLOOR_PLANE) /// Ideally we'd have knowledge what we're removing but i'd have to be done on target appearance retrieval - var/list/overlays_to_remove = list() + var/list/overlays_to_keep = list() for(var/mutable_appearance/special_overlay as anything in content_ma.overlays) var/mutable_appearance/real = new() real.appearance = special_overlay if(PLANE_TO_TRUE(real.plane) in plane_whitelist) - continue - overlays_to_remove += real - content_ma.overlays -= overlays_to_remove + content_ma.overlays -= real + real.plane = FLOAT_PLANE + real.layer = FLOAT_LAYER + overlays_to_keep += real + else + content_ma.overlays -= real + content_ma.overlays = overlays_to_keep - var/list/underlays_to_remove = list() + var/list/underlays_to_keep = list() for(var/mutable_appearance/special_underlay as anything in content_ma.underlays) var/mutable_appearance/real = new() real.appearance = special_underlay if(PLANE_TO_TRUE(real.plane) in plane_whitelist) - continue - underlays_to_remove += real - content_ma.underlays -= underlays_to_remove + content_ma.underlays -= real + real.plane = FLOAT_PLANE + real.layer = FLOAT_LAYER + underlays_to_keep += real + else + content_ma.underlays -= real + content_ma.underlays = underlays_to_keep content_ma.appearance_flags &= ~KEEP_APART //Don't want this content_ma.filters = filter(type="color",color=greyscale_with_value_bump,space=FILTER_COLOR_HSV) @@ -85,11 +93,11 @@ /obj/item/statue/custom/proc/update_content_planes() if(!content_ma) return - //var/turf/our_turf = get_turf(src) + var/turf/our_turf = get_turf(src) // MA's stored in the overlays list are not actually mutable, they've been flattened // This proc unflattens them, updates them, and then reapplies - var/list/created = update_appearance_planes(list(content_ma), src) - content_ma = created[1] + var/list/created = update_appearance_planes(list(content_ma), GET_TURF_PLANE_OFFSET(our_turf)) + content_ma = new /mutable_appearance(created[1]) //Inhand version of a carving block that doesnt need a chisel /obj/item/modeling_block @@ -125,15 +133,15 @@ // Add to plastic recipes /obj/item/stack/sheet/plastic/get_main_recipes() . = ..() - . += list(new /datum/stack_recipe("Modeling block", /obj/item/modeling_block, 2)) + . += list(new /datum/stack_recipe("Modeling block", /obj/item/modeling_block, 2, check_density = FALSE)) + -/* /obj/item/modeling_block/Destroy() current_target = null target_appearance_with_filters = null return ..() - +/* /obj/item/modeling_block/pre_attack(atom/target, mob/living/user, params) . = ..() /* @@ -244,5 +252,6 @@ var/mutable_appearance/ma = current_target new_statue.name = "statuette of [ma.name]" new_statue.desc = "A carved statuette depicting [ma.name]." - user.put_in_active_hand(new_statue, TRUE) qdel(src) + user.put_in_active_hand(new_statue, TRUE) + From 198e308a5c3c1f2f9c5c36368cc38bfbdb33edda Mon Sep 17 00:00:00 2001 From: Ed640 Date: Fri, 9 Feb 2024 21:47:30 -0600 Subject: [PATCH 07/13] Fixes Planes --- .../code/modules/art/statuettes.dm | 43 +++---------------- 1 file changed, 5 insertions(+), 38 deletions(-) diff --git a/maplestation_modules/code/modules/art/statuettes.dm b/maplestation_modules/code/modules/art/statuettes.dm index bdcc919b9dbd..a1bab7231924 100644 --- a/maplestation_modules/code/modules/art/statuettes.dm +++ b/maplestation_modules/code/modules/art/statuettes.dm @@ -63,9 +63,10 @@ content_ma.appearance_flags &= ~KEEP_APART //Don't want this content_ma.filters = filter(type="color",color=greyscale_with_value_bump,space=FILTER_COLOR_HSV) - update_content_planes() + content_ma.plane = FLOAT_PLANE + content_ma.layer = FLOAT_LAYER update_appearance() -/* + /obj/item/modeling_block/update_overlays() . = ..() if(!target_appearance_with_filters) @@ -79,26 +80,6 @@ if(content_ma) . += content_ma -/obj/item/statue/custom/equipped(mob/user) - . = ..() - if(!isturf(src)) - SET_PLANE_EXPLICIT(src.content_ma, ABOVE_HUD_PLANE, user) - update_appearance_planes(content_ma) - -/obj/item/statue/custom/dropped(mob/user) - . = ..() - SET_PLANE_EXPLICIT(src.content_ma, GAME_PLANE, user) - update_appearance_planes(content_ma) -*/ -/obj/item/statue/custom/proc/update_content_planes() - if(!content_ma) - return - var/turf/our_turf = get_turf(src) - // MA's stored in the overlays list are not actually mutable, they've been flattened - // This proc unflattens them, updates them, and then reapplies - var/list/created = update_appearance_planes(list(content_ma), GET_TURF_PLANE_OFFSET(our_turf)) - content_ma = new /mutable_appearance(created[1]) - //Inhand version of a carving block that doesnt need a chisel /obj/item/modeling_block name = "Modeling block" @@ -141,21 +122,7 @@ target_appearance_with_filters = null return ..() -/* -/obj/item/modeling_block/pre_attack(atom/target, mob/living/user, params) - . = ..() - /* - if(sculpting) - return TRUE - */ - //We're aiming at something next to us - set_target(target, user) - //skip sculpting time - create_statue() - return TRUE -*/ - -// We aim at something distant. +// We aim at something to turn into our sculpting target /obj/item/modeling_block/afterattack(atom/target, mob/user, proximity_flag, click_parameters) . = ..() @@ -189,7 +156,7 @@ current_target = target.appearance var/mutable_appearance/ma = current_target user.balloon_alert(user, "sculpt target is [ma.name]") -/* seeing if i can skip the sculpting time and/or if setting target works +/* Seeing if i can skip the sculpting time and/or if setting target works /obj/item/modeling_block/attack_self(mob/user) create_statue(user) From dc70b1cd8749f9b118e3cf722379c8586eef93e9 Mon Sep 17 00:00:00 2001 From: Ed640 Date: Fri, 9 Feb 2024 22:33:22 -0600 Subject: [PATCH 08/13] check if there is target before trying to sculpt --- maplestation_modules/code/modules/art/statuettes.dm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/maplestation_modules/code/modules/art/statuettes.dm b/maplestation_modules/code/modules/art/statuettes.dm index a1bab7231924..7962a87fe88b 100644 --- a/maplestation_modules/code/modules/art/statuettes.dm +++ b/maplestation_modules/code/modules/art/statuettes.dm @@ -128,10 +128,10 @@ if (!sculpting && ismovable(target)) set_target(target,user) - //skip sculpting time + /*skip sculpting time if(current_target != null) create_statue(user) - + */ return . | AFTERATTACK_PROCESSED_ITEM /obj/item/modeling_block/proc/is_viable_target(mob/living/user, atom/movable/target) @@ -156,10 +156,13 @@ current_target = target.appearance var/mutable_appearance/ma = current_target user.balloon_alert(user, "sculpt target is [ma.name]") -/* Seeing if i can skip the sculpting time and/or if setting target works -/obj/item/modeling_block/attack_self(mob/user) - create_statue(user) +/obj/item/modeling_block/attack_self(mob/user) + if(current_target) + create_statue(user) + else + balloon_alert(user,"No subject to sculpt selected!") +/* Seeing if i can skip the sculpting time and/or if setting target works /// Starts or continues the sculpting action on the carving block material /obj/item/modeling_block/proc/start_sculpting(mob/living/user) user.balloon_alert(user, "sculpting block...") From c44beb2214443a35f7a692289d2ecdece6ce39d6 Mon Sep 17 00:00:00 2001 From: Ed640 Date: Fri, 9 Feb 2024 22:59:52 -0600 Subject: [PATCH 09/13] nearby sculpt targets stop bopping, fix balloontip --- .../code/modules/art/statuettes.dm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/maplestation_modules/code/modules/art/statuettes.dm b/maplestation_modules/code/modules/art/statuettes.dm index 7962a87fe88b..0e0255c4abed 100644 --- a/maplestation_modules/code/modules/art/statuettes.dm +++ b/maplestation_modules/code/modules/art/statuettes.dm @@ -122,6 +122,18 @@ target_appearance_with_filters = null return ..() +// We aim at something nearby to turn into our sculpting target and not bop it +/obj/item/modeling_block/pre_attack(atom/target, mob/user) + . = ..() + + if (!sculpting && ismovable(target)) + set_target(target,user) + /*skip sculpting time + if(current_target != null) + create_statue(user) + */ + return TRUE + // We aim at something to turn into our sculpting target /obj/item/modeling_block/afterattack(atom/target, mob/user, proximity_flag, click_parameters) . = ..() @@ -161,7 +173,7 @@ if(current_target) create_statue(user) else - balloon_alert(user,"No subject to sculpt selected!") + balloon_alert(user,"no subject to sculpt selected") /* Seeing if i can skip the sculpting time and/or if setting target works /// Starts or continues the sculpting action on the carving block material /obj/item/modeling_block/proc/start_sculpting(mob/living/user) From 1085ccbd4248426d557af41b788faac57331bb5f Mon Sep 17 00:00:00 2001 From: Ed640 Date: Sat, 10 Feb 2024 00:01:27 -0600 Subject: [PATCH 10/13] Fixes Layers --- maplestation_modules/code/modules/art/statuettes.dm | 2 -- 1 file changed, 2 deletions(-) diff --git a/maplestation_modules/code/modules/art/statuettes.dm b/maplestation_modules/code/modules/art/statuettes.dm index 0e0255c4abed..577783cab8dc 100644 --- a/maplestation_modules/code/modules/art/statuettes.dm +++ b/maplestation_modules/code/modules/art/statuettes.dm @@ -42,7 +42,6 @@ if(PLANE_TO_TRUE(real.plane) in plane_whitelist) content_ma.overlays -= real real.plane = FLOAT_PLANE - real.layer = FLOAT_LAYER overlays_to_keep += real else content_ma.overlays -= real @@ -55,7 +54,6 @@ if(PLANE_TO_TRUE(real.plane) in plane_whitelist) content_ma.underlays -= real real.plane = FLOAT_PLANE - real.layer = FLOAT_LAYER underlays_to_keep += real else content_ma.underlays -= real From f10a189adb36ddbda7f41cdeb31d47b8eed54912 Mon Sep 17 00:00:00 2001 From: Ed640 Date: Sat, 10 Feb 2024 03:00:59 -0600 Subject: [PATCH 11/13] Simplifies whitelist check --- maplestation_modules/code/modules/art/statuettes.dm | 8 -------- 1 file changed, 8 deletions(-) diff --git a/maplestation_modules/code/modules/art/statuettes.dm b/maplestation_modules/code/modules/art/statuettes.dm index 577783cab8dc..3081be9f94f6 100644 --- a/maplestation_modules/code/modules/art/statuettes.dm +++ b/maplestation_modules/code/modules/art/statuettes.dm @@ -40,11 +40,7 @@ var/mutable_appearance/real = new() real.appearance = special_overlay if(PLANE_TO_TRUE(real.plane) in plane_whitelist) - content_ma.overlays -= real - real.plane = FLOAT_PLANE overlays_to_keep += real - else - content_ma.overlays -= real content_ma.overlays = overlays_to_keep var/list/underlays_to_keep = list() @@ -52,11 +48,7 @@ var/mutable_appearance/real = new() real.appearance = special_underlay if(PLANE_TO_TRUE(real.plane) in plane_whitelist) - content_ma.underlays -= real - real.plane = FLOAT_PLANE underlays_to_keep += real - else - content_ma.underlays -= real content_ma.underlays = underlays_to_keep content_ma.appearance_flags &= ~KEEP_APART //Don't want this From 3f92bcc7924e53c8572250a6ccd6dfc53c0a0b46 Mon Sep 17 00:00:00 2001 From: Ed640 Date: Thu, 22 Feb 2024 16:25:59 -0600 Subject: [PATCH 12/13] Suggestions --- .../code/modules/art/statuettes.dm | 69 ++----------------- 1 file changed, 4 insertions(+), 65 deletions(-) diff --git a/maplestation_modules/code/modules/art/statuettes.dm b/maplestation_modules/code/modules/art/statuettes.dm index 3081be9f94f6..675576ca1561 100644 --- a/maplestation_modules/code/modules/art/statuettes.dm +++ b/maplestation_modules/code/modules/art/statuettes.dm @@ -118,10 +118,6 @@ if (!sculpting && ismovable(target)) set_target(target,user) - /*skip sculpting time - if(current_target != null) - create_statue(user) - */ return TRUE // We aim at something to turn into our sculpting target @@ -130,21 +126,17 @@ if (!sculpting && ismovable(target)) set_target(target,user) - /*skip sculpting time - if(current_target != null) - create_statue(user) - */ return . | AFTERATTACK_PROCESSED_ITEM /obj/item/modeling_block/proc/is_viable_target(mob/living/user, atom/movable/target) //Only things on turfs if(!isturf(target.loc)) - user.balloon_alert(user, "no sculpt target!") + user.balloon_alert(user, "no sculpting subject!") return FALSE //No big icon things var/list/icon_dimensions = get_icon_dimensions(target.icon) if(icon_dimensions["width"] > 2*world.icon_size || icon_dimensions["height"] > 2*world.icon_size) - user.balloon_alert(user, "sculpt target is too big!") + user.balloon_alert(user, "subject is too big!") return FALSE return TRUE @@ -157,66 +149,13 @@ else current_target = target.appearance var/mutable_appearance/ma = current_target - user.balloon_alert(user, "sculpt target is [ma.name]") + user.balloon_alert(user, "sculpting [target.name]") /obj/item/modeling_block/attack_self(mob/user) if(current_target) create_statue(user) else - balloon_alert(user,"no subject to sculpt selected") -/* Seeing if i can skip the sculpting time and/or if setting target works -/// Starts or continues the sculpting action on the carving block material -/obj/item/modeling_block/proc/start_sculpting(mob/living/user) - user.balloon_alert(user, "sculpting block...") - playsound(src, pick(usesound), 75, TRUE) - sculpting = TRUE - //How long whole process takes - var/sculpting_time = 30 SECONDS - //Single interruptible progress period - var/sculpting_period = round(sculpting_time / world.icon_size) //this is just so it reveals pixels line by line for each. - var/interrupted = FALSE - var/remaining_time = sculpting_time - (prepared_block.completion * sculpting_time) - - var/datum/progressbar/total_progress_bar = new(user, sculpting_time, prepared_block) - while(remaining_time > 0 && !interrupted) - if(do_after(user, sculpting_period, target = prepared_block, progress = FALSE)) - var/time_delay = !(remaining_time % SCULPT_SOUND_INCREMENT) - if(time_delay) - playsound(src, 'sound/effects/break_stone.ogg', 50, TRUE) - remaining_time -= sculpting_period - prepared_block.set_completion((sculpting_time - remaining_time)/sculpting_time) - total_progress_bar.update(sculpting_time - remaining_time) - else - interrupted = TRUE - total_progress_bar.end_progress() - if(!interrupted && !QDELETED(prepared_block)) - prepared_block.create_statue() - user.balloon_alert(user, "statue finished") - stop_sculpting(silent = !interrupted) - -/obj/item/modeling_block/dropped(mob/user, silent) - . = ..() - stop_sculpting() - -/// Cancel the sculpting action -/obj/item/modeling_block/proc/stop_sculpting(silent = FALSE) - sculpting = FALSE - if(prepared_block && prepared_block.completion == 0) - prepared_block.reset_target() - prepared_block = null - - if(!silent && tracked_user) - tracked_user.balloon_alert(tracked_user, "sculpting cancelled!") - - if(tracked_user) - UnregisterSignal(tracked_user, COMSIG_MOVABLE_MOVED) - tracked_user = null - -/obj/item/modeling_block/proc/on_moved() - SIGNAL_HANDLER - - stop_sculpting() - */ + balloon_alert(user, "no sculpting subject!") /obj/item/modeling_block/proc/create_statue(mob/user) var/obj/item/statue/custom/new_statue = new(user.loc) From bf82589b57df118be4317dec2b9b109be0e017ae Mon Sep 17 00:00:00 2001 From: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Date: Fri, 23 Feb 2024 13:12:28 -0600 Subject: [PATCH 13/13] Assuming direct control --- maplestation_modules/code/modules/art/statuettes.dm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/maplestation_modules/code/modules/art/statuettes.dm b/maplestation_modules/code/modules/art/statuettes.dm index 675576ca1561..57baa7eae2a8 100644 --- a/maplestation_modules/code/modules/art/statuettes.dm +++ b/maplestation_modules/code/modules/art/statuettes.dm @@ -115,7 +115,8 @@ // We aim at something nearby to turn into our sculpting target and not bop it /obj/item/modeling_block/pre_attack(atom/target, mob/user) . = ..() - + if(.) + return . if (!sculpting && ismovable(target)) set_target(target,user) return TRUE @@ -164,5 +165,5 @@ new_statue.name = "statuette of [ma.name]" new_statue.desc = "A carved statuette depicting [ma.name]." qdel(src) - user.put_in_active_hand(new_statue, TRUE) + user.put_in_active_hand(new_statue)