From 2c2fb4a0714773fe1d934a2495e7be7689189309 Mon Sep 17 00:00:00 2001 From: Lucy Date: Fri, 21 Jun 2024 03:05:59 -0400 Subject: [PATCH 01/14] Cleaner slimes are now far more intelligent --- code/__DEFINES/~monkestation/traits.dm | 2 + code/__HELPERS/atoms.dm | 2 +- .../code/datums/elements/trash_if_empty.dm | 66 +++++++++++++++++++ .../code/game/objects/items/cigs_lighters.dm | 3 + .../code/game/objects/items/food/frozen.dm | 3 + .../code/game/objects/items/food/misc.dm | 4 ++ .../code/game/objects/items/food/snacks.dm | 3 + .../code/game/objects/items/storage/fancy.dm | 3 + monkestation/code/game/objects/items/trash.dm | 3 + .../modules/mob/living/basic/vermin/mouse.dm | 4 ++ .../modules/power/lighting/light_items.dm | 7 ++ .../projectiles/ammunition/_ammunition.dm | 25 +++++++ .../reagents/reagent_containers/condiment.dm | 3 + .../reagents/reagent_containers/cups/_cup.dm | 3 + .../reagent_containers/cups/glassbottle.dm | 3 + .../vending_machines/vending_packages.dm | 4 ++ .../ai_controller/behaviours/clean_target.dm | 12 ++-- .../modules/slimecore/slime_traits/cleaner.dm | 5 +- tgstation.dme | 11 ++++ 19 files changed, 160 insertions(+), 6 deletions(-) create mode 100644 monkestation/code/datums/elements/trash_if_empty.dm create mode 100644 monkestation/code/game/objects/items/cigs_lighters.dm create mode 100644 monkestation/code/game/objects/items/food/frozen.dm create mode 100644 monkestation/code/game/objects/items/food/snacks.dm create mode 100644 monkestation/code/game/objects/items/storage/fancy.dm create mode 100644 monkestation/code/game/objects/items/trash.dm create mode 100644 monkestation/code/modules/power/lighting/light_items.dm create mode 100644 monkestation/code/modules/projectiles/ammunition/_ammunition.dm create mode 100644 monkestation/code/modules/reagents/reagent_containers/condiment.dm create mode 100644 monkestation/code/modules/reagents/reagent_containers/cups/_cup.dm create mode 100644 monkestation/code/modules/reagents/reagent_containers/cups/glassbottle.dm diff --git a/code/__DEFINES/~monkestation/traits.dm b/code/__DEFINES/~monkestation/traits.dm index 514976c9580f..7ddeaf0f7d30 100644 --- a/code/__DEFINES/~monkestation/traits.dm +++ b/code/__DEFINES/~monkestation/traits.dm @@ -33,6 +33,8 @@ // /obj/item /// Whether a storage item can be compressed by the bluespace compression kit, without the usual storage limitation. #define TRAIT_BYPASS_COMPRESS_CHECK "can_compress_anyways" +/// This item is considered "trash" (and will be eaten by cleaner slimes) +#define TRAIT_TRASH_ITEM "trash_item" #define ABDUCTOR_GLAND_VENTCRAWLING_TRAIT "abductor_gland_ventcrawling" #define TRAIT_BETTER_CYBERCONNECTOR "better_cyberconnector_hacking" diff --git a/code/__HELPERS/atoms.dm b/code/__HELPERS/atoms.dm index 6b0ca8cbe475..dc19ee445754 100644 --- a/code/__HELPERS/atoms.dm +++ b/code/__HELPERS/atoms.dm @@ -248,7 +248,7 @@ rough example of the "cone" made by the 3 dirs checked var/closest_atom var/closest_distance for(var/atom in atom_list) - if(!istype(atom, type)) + if(!type || !istype(atom, type)) // monkestation edit: allow null type, for pre-filtered lists continue var/distance = get_dist(source, atom) if(!closest_atom) diff --git a/monkestation/code/datums/elements/trash_if_empty.dm b/monkestation/code/datums/elements/trash_if_empty.dm new file mode 100644 index 000000000000..4e5c6197dd27 --- /dev/null +++ b/monkestation/code/datums/elements/trash_if_empty.dm @@ -0,0 +1,66 @@ +/datum/element/trash_if_empty + var/attach_type = /obj + var/static/list/update_signals = list( + COMSIG_ATOM_ENTERED, + COMSIG_ATOM_EXITED + ) + +/datum/element/trash_if_empty/Attach(datum/source) + . = ..() + if(!istype(source, attach_type)) + return ELEMENT_INCOMPATIBLE + register_signals(source) + +/datum/element/trash_if_empty/Detach(datum/source) + unregister_signals(source) + REMOVE_TRAIT(source, TRAIT_TRASH_ITEM, ELEMENT_TRAIT(type)) + return ..() + +/datum/element/trash_if_empty/proc/register_signals(datum/source) + RegisterSignals(source, update_signals, PROC_REF(update_trash_trait)) + +/datum/element/trash_if_empty/proc/unregister_signals(datum/source) + UnregisterSignal(source, update_signals) + +/datum/element/trash_if_empty/proc/update_trash_trait(obj/source) + SIGNAL_HANDLER + if(is_empty_or_trash(source)) + ADD_TRAIT(source, TRAIT_TRASH_ITEM, ELEMENT_TRAIT(type)) + else + REMOVE_TRAIT(source, TRAIT_TRASH_ITEM, ELEMENT_TRAIT(type)) + +/datum/element/trash_if_empty/proc/is_empty_or_trash(obj/source) + . = TRUE + if(!length(source.contents)) + return TRUE + for(var/obj/item/stored_obj in source.contents) + if(!QDELING(stored_obj) && !HAS_TRAIT(stored_obj, TRAIT_TRASH_ITEM)) + return FALSE + +// Variant for reagent containers +/datum/element/trash_if_empty/reagent_container + attach_type = /obj/item/reagent_containers + var/static/list/reagent_signals = list( + COMSIG_REAGENTS_NEW_REAGENT, + COMSIG_REAGENTS_ADD_REAGENT, + COMSIG_REAGENTS_DEL_REAGENT, + COMSIG_REAGENTS_REM_REAGENT + ) + +/datum/element/trash_if_empty/reagent_container/register_signals(obj/item/reagent_containers/source) + RegisterSignal(source.reagents, reagent_signals, PROC_REF(update_trash_trait)) + +/datum/element/trash_if_empty/reagent_container/unregister_signals(obj/item/reagent_containers/source) + UnregisterSignal(source.reagents, reagent_signals) + +/datum/element/trash_if_empty/reagent_container/is_empty_or_trash(datum/reagents/source) + return !source?.total_volume + +/// Variant that never considers non-prefilled containers as empty +/datum/element/trash_if_empty/reagent_container/if_prefilled + +/datum/element/trash_if_empty/reagent_container/if_prefilled/is_empty_or_trash(datum/reagents/source) + var/obj/item/reagent_containers/container = source?.my_atom + if(!container.list_reagents) + return FALSE + return ..() diff --git a/monkestation/code/game/objects/items/cigs_lighters.dm b/monkestation/code/game/objects/items/cigs_lighters.dm new file mode 100644 index 000000000000..d141bfaec731 --- /dev/null +++ b/monkestation/code/game/objects/items/cigs_lighters.dm @@ -0,0 +1,3 @@ +/obj/item/cigbutt/Initialize(mapload) + . = ..() + ADD_TRAIT(src, TRAIT_TRASH_ITEM, INNATE_TRAIT) diff --git a/monkestation/code/game/objects/items/food/frozen.dm b/monkestation/code/game/objects/items/food/frozen.dm new file mode 100644 index 000000000000..316ce65a4754 --- /dev/null +++ b/monkestation/code/game/objects/items/food/frozen.dm @@ -0,0 +1,3 @@ +/obj/item/popsicle_stick/Initialize(mapload) + . = ..() + ADD_TRAIT(src, TRAIT_TRASH_ITEM, INNATE_TRAIT) diff --git a/monkestation/code/game/objects/items/food/misc.dm b/monkestation/code/game/objects/items/food/misc.dm index ebffd34bc3a0..9d8bdf4de6a0 100644 --- a/monkestation/code/game/objects/items/food/misc.dm +++ b/monkestation/code/game/objects/items/food/misc.dm @@ -11,3 +11,7 @@ foodtypes = FRUIT food_flags = FOOD_FINGER_FOOD w_class = WEIGHT_CLASS_SMALL + +/obj/item/food/badrecipe/Initialize(mapload) + . = ..() + ADD_TRAIT(src, TRAIT_TRASH_ITEM, INNATE_TRAIT) diff --git a/monkestation/code/game/objects/items/food/snacks.dm b/monkestation/code/game/objects/items/food/snacks.dm new file mode 100644 index 000000000000..2918ba7a7a2d --- /dev/null +++ b/monkestation/code/game/objects/items/food/snacks.dm @@ -0,0 +1,3 @@ +/obj/item/food/candy_trash/Initialize(mapload) + . = ..() + ADD_TRAIT(src, TRAIT_TRASH_ITEM, INNATE_TRAIT) diff --git a/monkestation/code/game/objects/items/storage/fancy.dm b/monkestation/code/game/objects/items/storage/fancy.dm new file mode 100644 index 000000000000..6017403c3f98 --- /dev/null +++ b/monkestation/code/game/objects/items/storage/fancy.dm @@ -0,0 +1,3 @@ +/obj/item/storage/fancy/cigarettes/Initialize(mapload) + . = ..() + AddElement(/datum/element/trash_if_empty) diff --git a/monkestation/code/game/objects/items/trash.dm b/monkestation/code/game/objects/items/trash.dm new file mode 100644 index 000000000000..6a7697a5a251 --- /dev/null +++ b/monkestation/code/game/objects/items/trash.dm @@ -0,0 +1,3 @@ +/obj/item/trash/Initialize(mapload) + . = ..() + ADD_TRAIT(src, TRAIT_TRASH_ITEM, INNATE_TRAIT) diff --git a/monkestation/code/modules/mob/living/basic/vermin/mouse.dm b/monkestation/code/modules/mob/living/basic/vermin/mouse.dm index 27d0eabcc6a6..60803cfb84c9 100644 --- a/monkestation/code/modules/mob/living/basic/vermin/mouse.dm +++ b/monkestation/code/modules/mob/living/basic/vermin/mouse.dm @@ -1,3 +1,7 @@ +/obj/item/food/deadmouse/Initialize(mapload, mob/living/basic/mouse/dead_critter) + . = ..() + ADD_TRAIT(src, TRAIT_TRASH_ITEM, INNATE_TRAIT) + /obj/item/food/deadmouse/extrapolator_act(mob/user, obj/item/extrapolator/E, scan = TRUE) if(!ratdisease.len) return FALSE diff --git a/monkestation/code/modules/power/lighting/light_items.dm b/monkestation/code/modules/power/lighting/light_items.dm new file mode 100644 index 000000000000..8e1ff3c42065 --- /dev/null +++ b/monkestation/code/modules/power/lighting/light_items.dm @@ -0,0 +1,7 @@ +/obj/item/light/tube/broken/Initialize(mapload) + . = ..() + ADD_TRAIT(src, TRAIT_TRASH_ITEM, INNATE_TRAIT) + +/obj/item/light/bulb/broken/Initialize(mapload) + . = ..() + ADD_TRAIT(src, TRAIT_TRASH_ITEM, INNATE_TRAIT) diff --git a/monkestation/code/modules/projectiles/ammunition/_ammunition.dm b/monkestation/code/modules/projectiles/ammunition/_ammunition.dm new file mode 100644 index 000000000000..6681d8a19058 --- /dev/null +++ b/monkestation/code/modules/projectiles/ammunition/_ammunition.dm @@ -0,0 +1,25 @@ +/obj/item/ammo_casing/Initialize(mapload) + . = ..() + update_trash_trait() + +/obj/item/ammo_casing/newshot() + . = ..() + update_trash_trait() + +/obj/item/ammo_casing/on_accidental_consumption(mob/living/carbon/victim, mob/living/carbon/user, obj/item/source_item, discover_after = TRUE) + . = ..() + update_trash_trait() + +/obj/item/ammo_casing/throw_proj(atom/target, turf/targloc, mob/living/user, params, spread, atom/fired_from) + . = ..() + update_trash_trait() + +/obj/item/ammo_casing/refresh_shot() + . = ..() + update_trash_trait() + +/obj/item/ammo_casing/proc/update_trash_trait() + if(QDELETED(loaded_projectile)) + REMOVE_TRAIT(src, TRAIT_TRASH_ITEM, TRAIT_GENERIC) + else + ADD_TRAIT(src, TRAIT_TRASH_ITEM, TRAIT_GENERIC) diff --git a/monkestation/code/modules/reagents/reagent_containers/condiment.dm b/monkestation/code/modules/reagents/reagent_containers/condiment.dm new file mode 100644 index 000000000000..cfa1e61caf8b --- /dev/null +++ b/monkestation/code/modules/reagents/reagent_containers/condiment.dm @@ -0,0 +1,3 @@ +/obj/item/reagent_containers/condiment/pack/Initialize(mapload, vol) + . = ..() + AddElement(/datum/element/trash_if_empty/reagent_container) diff --git a/monkestation/code/modules/reagents/reagent_containers/cups/_cup.dm b/monkestation/code/modules/reagents/reagent_containers/cups/_cup.dm new file mode 100644 index 000000000000..3bc971bab5c3 --- /dev/null +++ b/monkestation/code/modules/reagents/reagent_containers/cups/_cup.dm @@ -0,0 +1,3 @@ +/obj/item/reagent_containers/cup/Initialize(mapload, vol) + . = ..() + AddElement(/datum/element/trash_if_empty/reagent_container/if_prefilled) diff --git a/monkestation/code/modules/reagents/reagent_containers/cups/glassbottle.dm b/monkestation/code/modules/reagents/reagent_containers/cups/glassbottle.dm new file mode 100644 index 000000000000..6f99fdfcb976 --- /dev/null +++ b/monkestation/code/modules/reagents/reagent_containers/cups/glassbottle.dm @@ -0,0 +1,3 @@ +/obj/item/broken_bottle/Initialize(mapload) + . = ..() + ADD_TRAIT(src, TRAIT_TRASH_ITEM, INNATE_TRAIT) diff --git a/monkestation/code/modules/skyrat_snipes/vending_machines/vending_packages.dm b/monkestation/code/modules/skyrat_snipes/vending_machines/vending_packages.dm index 852f4a2ce164..d06fc2ac9753 100644 --- a/monkestation/code/modules/skyrat_snipes/vending_machines/vending_packages.dm +++ b/monkestation/code/modules/skyrat_snipes/vending_machines/vending_packages.dm @@ -12,6 +12,10 @@ ///What kind of condiment pack should we give the package var/condiment_pack = /obj/item/reagent_containers/condiment/pack/ketchup +/obj/item/storage/box/foodpack/Initialize(mapload) + . = ..() + AddElement(/datum/element/trash_if_empty) + /obj/item/storage/box/foodpack/PopulateContents() . = ..() new main_course(src) diff --git a/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm b/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm index 13cf33e8046f..6c7484bbd4e0 100644 --- a/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm +++ b/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm @@ -17,7 +17,8 @@ finish_action(controller, FALSE, target_key) return - living_pawn.visible_message(span_notice("[living_pawn] dissolves the [target].")) + living_pawn.balloon_alert_to_viewers("cleaned") + living_pawn.visible_message(span_notice("[living_pawn] dissolves \the [target].")) SEND_SIGNAL(living_pawn, COMSIG_MOB_FEED, target, 20) qdel(target) // Sent to the shadow realm to never be seen again finish_action(controller, TRUE, target_key) @@ -36,7 +37,10 @@ action_cooldown = 2 SECONDS /datum/ai_behavior/find_and_set/in_list/clean_targets_slime/search_tactic(datum/ai_controller/controller, locate_paths, search_range) - var/list/found = typecache_filter_list(oview(search_range, controller.pawn), locate_paths) - if(length(found)) - return pick(found) + var/list/found + for(var/obj/item as anything in spiral_range(search_range, controller.pawn, TRUE)) + if(QDELETED(item)) + continue + if(is_type_in_typecache(item, locate_paths) || HAS_TRAIT(item, TRAIT_TRASH_ITEM)) + return item diff --git a/monkestation/code/modules/slimecore/slime_traits/cleaner.dm b/monkestation/code/modules/slimecore/slime_traits/cleaner.dm index 0d69b726a340..5d6e17d24718 100644 --- a/monkestation/code/modules/slimecore/slime_traits/cleaner.dm +++ b/monkestation/code/modules/slimecore/slime_traits/cleaner.dm @@ -7,8 +7,8 @@ ///decals we can clean var/static/list/cleanable_decals = typecacheof(list( /obj/effect/decal/cleanable/ants, - /obj/effect/decal/cleanable/ash, /obj/effect/decal/cleanable/confetti, + /obj/effect/decal/cleanable/ash, /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/fuel_pool, /obj/effect/decal/cleanable/generic, @@ -45,6 +45,9 @@ /obj/item/food/candy_trash, /obj/item/cigbutt, /obj/item/food/breadslice/moldy, + /obj/item/food/pizzaslice/moldy, + /obj/item/food/badrecipe, + /obj/item/food/egg/rotten, /obj/item/light/tube/broken, /obj/item/light/bulb/broken, /obj/item/popsicle_stick, diff --git a/tgstation.dme b/tgstation.dme index 1e62f8ac5628..5147f2df02b8 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -5749,6 +5749,7 @@ #include "monkestation\code\datums\components\uplink.dm" #include "monkestation\code\datums\diseases\advance\symptoms\clockwork.dm" #include "monkestation\code\datums\elements\area_locked.dm" +#include "monkestation\code\datums\elements\trash_if_empty.dm" #include "monkestation\code\datums\elements\uncompressed_storage.dm" #include "monkestation\code\datums\ert\moff_inspectors.dm" #include "monkestation\code\datums\keybinding\carbon.dm" @@ -5794,6 +5795,7 @@ #include "monkestation\code\game\objects\effects\spawners\random\fishing.dm" #include "monkestation\code\game\objects\items\caneswords.dm" #include "monkestation\code\game\objects\items\choice_beacon.dm" +#include "monkestation\code\game\objects\items\cigs_lighters.dm" #include "monkestation\code\game\objects\items\cirno_plush.dm" #include "monkestation\code\game\objects\items\gravity_gun.dm" #include "monkestation\code\game\objects\items\jukebox_beacon.dm" @@ -5805,6 +5807,7 @@ #include "monkestation\code\game\objects\items\spraycan_gun.dm" #include "monkestation\code\game\objects\items\stickers.dm" #include "monkestation\code\game\objects\items\superglue.dm" +#include "monkestation\code\game\objects\items\trash.dm" #include "monkestation\code\game\objects\items\venom_knife.dm" #include "monkestation\code\game\objects\items\AI_modules\monke_lawsets.dm" #include "monkestation\code\game\objects\items\circuitboards\computer_circuitboards.dm" @@ -5822,7 +5825,9 @@ #include "monkestation\code\game\objects\items\effects\nugget.dm" #include "monkestation\code\game\objects\items\effects\washing_machine.dm" #include "monkestation\code\game\objects\items\food\corndog.dm" +#include "monkestation\code\game\objects\items\food\frozen.dm" #include "monkestation\code\game\objects\items\food\misc.dm" +#include "monkestation\code\game\objects\items\food\snacks.dm" #include "monkestation\code\game\objects\items\food\spaghetti.dm" #include "monkestation\code\game\objects\items\granters\elance.dm" #include "monkestation\code\game\objects\items\grenades\monkey_barrel.dm" @@ -5836,6 +5841,7 @@ #include "monkestation\code\game\objects\items\storage\book.dm" #include "monkestation\code\game\objects\items\storage\boxes.dm" #include "monkestation\code\game\objects\items\storage\crate.dm" +#include "monkestation\code\game\objects\items\storage\fancy.dm" #include "monkestation\code\game\objects\items\storage\uplink_kits.dm" #include "monkestation\code\game\objects\structures\tables_racks.dm" #include "monkestation\code\game\objects\structures\beds_chairs\chair.dm" @@ -6855,6 +6861,7 @@ #include "monkestation\code\modules\possession\possessed_hud.dm" #include "monkestation\code\modules\power\cables.dm" #include "monkestation\code\modules\power\lighting\floor_light.dm" +#include "monkestation\code\modules\power\lighting\light_items.dm" #include "monkestation\code\modules\power\lighting\neon_lining.dm" #include "monkestation\code\modules\power\power_transmission_laser\code\announcement.dm" #include "monkestation\code\modules\power\power_transmission_laser\code\beam.dm" @@ -6865,6 +6872,7 @@ #include "monkestation\code\modules\power\singularity\particle_accelerator\particle_accelerator.dm" #include "monkestation\code\modules\power\singularity\particle_accelerator\particle_controller.dm" #include "monkestation\code\modules\power\singularity\particle_accelerator\particle_emitter.dm" +#include "monkestation\code\modules\projectiles\ammunition\_ammunition.dm" #include "monkestation\code\modules\projectiles\guns\ballistic\revolver.dm" #include "monkestation\code\modules\projectiles\guns\ballistic\ryanecorp_whispering_jester.dm" #include "monkestation\code\modules\projectiles\guns\special\meat_hook.dm" @@ -6957,9 +6965,12 @@ #include "monkestation\code\modules\reagents\fun\liquid_justice.dm" #include "monkestation\code\modules\reagents\fun\shakeium.dm" #include "monkestation\code\modules\reagents\reagent_containers\blood_pack.dm" +#include "monkestation\code\modules\reagents\reagent_containers\condiment.dm" #include "monkestation\code\modules\reagents\reagent_containers\drinks.dm" #include "monkestation\code\modules\reagents\reagent_containers\sunsetglass.dm" +#include "monkestation\code\modules\reagents\reagent_containers\cups\_cup.dm" #include "monkestation\code\modules\reagents\reagent_containers\cups\bottle.dm" +#include "monkestation\code\modules\reagents\reagent_containers\cups\glassbottle.dm" #include "monkestation\code\modules\reagents\recipes\fun.dm" #include "monkestation\code\modules\reagents\recipes\medical.dm" #include "monkestation\code\modules\replays\hooks\generic_hooks.dm" From 54a4b62ea77a2b377bda528c332de2b36a4e6d0a Mon Sep 17 00:00:00 2001 From: Lucy Date: Fri, 21 Jun 2024 22:46:23 -0400 Subject: [PATCH 02/14] fixups --- monkestation/code/datums/elements/trash_if_empty.dm | 2 +- .../slimecore/mobs/ai_controller/behaviours/clean_target.dm | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/monkestation/code/datums/elements/trash_if_empty.dm b/monkestation/code/datums/elements/trash_if_empty.dm index 4e5c6197dd27..30ed136a4544 100644 --- a/monkestation/code/datums/elements/trash_if_empty.dm +++ b/monkestation/code/datums/elements/trash_if_empty.dm @@ -48,7 +48,7 @@ ) /datum/element/trash_if_empty/reagent_container/register_signals(obj/item/reagent_containers/source) - RegisterSignal(source.reagents, reagent_signals, PROC_REF(update_trash_trait)) + RegisterSignals(source.reagents, reagent_signals, PROC_REF(update_trash_trait)) /datum/element/trash_if_empty/reagent_container/unregister_signals(obj/item/reagent_containers/source) UnregisterSignal(source.reagents, reagent_signals) diff --git a/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm b/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm index 6c7484bbd4e0..2ce61f5117ec 100644 --- a/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm +++ b/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm @@ -37,7 +37,6 @@ action_cooldown = 2 SECONDS /datum/ai_behavior/find_and_set/in_list/clean_targets_slime/search_tactic(datum/ai_controller/controller, locate_paths, search_range) - var/list/found for(var/obj/item as anything in spiral_range(search_range, controller.pawn, TRUE)) if(QDELETED(item)) continue From 2e235d266aafdad428291dce734b97bc760acd1c Mon Sep 17 00:00:00 2001 From: Lucy Date: Fri, 21 Jun 2024 23:20:15 -0400 Subject: [PATCH 03/14] bweh why no worky?? --- code/modules/reagents/chemistry/items.dm | 2 +- .../slimecore/mobs/ai_controller/behaviours/clean_target.dm | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/code/modules/reagents/chemistry/items.dm b/code/modules/reagents/chemistry/items.dm index b2e29e3c5d61..69c13a18b19e 100644 --- a/code/modules/reagents/chemistry/items.dm +++ b/code/modules/reagents/chemistry/items.dm @@ -152,7 +152,7 @@ var/lit = FALSE ///total reagent volume var/max_volume = 50 - ///What the creation reagent is + ///What the creation reagent is var/reagent_type = /datum/reagent/consumable/ethanol /obj/item/burner/Initialize(mapload) diff --git a/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm b/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm index 2ce61f5117ec..6b0ceebca4ef 100644 --- a/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm +++ b/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm @@ -40,6 +40,8 @@ for(var/obj/item as anything in spiral_range(search_range, controller.pawn, TRUE)) if(QDELETED(item)) continue - if(is_type_in_typecache(item, locate_paths) || HAS_TRAIT(item, TRAIT_TRASH_ITEM)) + if(!is_type_in_typecache(item, locate_paths) || !HAS_TRAIT(item, TRAIT_TRASH_ITEM)) + continue + if(length(get_path_to(controller.pawn, item, max_distance = search_range, simulated_only = FALSE))) return item From 91fddfb71b812062fb2e8d3404d3844ec38745dc Mon Sep 17 00:00:00 2001 From: Lucy Date: Fri, 21 Jun 2024 23:21:48 -0400 Subject: [PATCH 04/14] whoopsie --- .../slimecore/mobs/ai_controller/behaviours/clean_target.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm b/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm index 6b0ceebca4ef..9875a32670ba 100644 --- a/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm +++ b/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm @@ -40,7 +40,7 @@ for(var/obj/item as anything in spiral_range(search_range, controller.pawn, TRUE)) if(QDELETED(item)) continue - if(!is_type_in_typecache(item, locate_paths) || !HAS_TRAIT(item, TRAIT_TRASH_ITEM)) + if(!is_type_in_typecache(item, locate_paths) && !HAS_TRAIT(item, TRAIT_TRASH_ITEM)) continue if(length(get_path_to(controller.pawn, item, max_distance = search_range, simulated_only = FALSE))) return item From 0bb3828fe26f97a5aff9522a941c6ece04671be1 Mon Sep 17 00:00:00 2001 From: Lucy Date: Mon, 24 Jun 2024 02:25:22 -0400 Subject: [PATCH 05/14] wheee it all works now! --- .../slimecore/items/mutation_syringe.dm | 2 ++ .../modules/slimecore/mobs/_base_slime.dm | 14 ++++++++--- .../ai_controller/behaviours/clean_target.dm | 23 +++++++++++++------ 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/monkestation/code/modules/slimecore/items/mutation_syringe.dm b/monkestation/code/modules/slimecore/items/mutation_syringe.dm index 61bb1184fbac..2138446e39a6 100644 --- a/monkestation/code/modules/slimecore/items/mutation_syringe.dm +++ b/monkestation/code/modules/slimecore/items/mutation_syringe.dm @@ -38,6 +38,8 @@ user.balloon_alert_to_viewers("injected mutator") to_chat(user, span_notice("You inject [target] with [src].")) on_inject(slime) + if(uses <= 0) + ADD_TRAIT(src, TRAIT_TRASH_ITEM, INNATE_TRAIT) /obj/item/slime_mutation_syringe/proc/on_inject(mob/living/basic/slime/target) diff --git a/monkestation/code/modules/slimecore/mobs/_base_slime.dm b/monkestation/code/modules/slimecore/mobs/_base_slime.dm index 921e8efd20dd..13c45f7a51b4 100644 --- a/monkestation/code/modules/slimecore/mobs/_base_slime.dm +++ b/monkestation/code/modules/slimecore/mobs/_base_slime.dm @@ -57,7 +57,7 @@ ///our list of slime traits var/list/slime_traits = list() ///used to help our name changes so we don't rename named slimes - var/static/regex/slime_name_regex = new("\\w+ (baby|adult) slime \\(\\d+\\)") + var/static/regex/slime_name_regex = new("\\w+ (baby|adult) (cleaner )?(cat)?slime \\(\\d+\\)") ///our number var/number @@ -308,6 +308,7 @@ var/datum/slime_trait/new_trait = new added_trait new_trait.on_add(src) slime_traits += new_trait + update_name() return TRUE ///unlike add trait this uses a type and is checked against the list don't pass the created one pass the type @@ -317,6 +318,7 @@ continue slime_traits -= trait qdel(trait) + update_name() return ///unlike add trait this uses a type and is checked against the list don't pass the created one pass the type @@ -331,10 +333,16 @@ if(slime_name_regex.Find(name)) if(!number) number = rand(1, 1000) + var/slime_variant = "slime" + if(has_slime_trait(/datum/slime_trait/visual/cat)) + slime_variant = "catslime" + if(slime_flags & CLEANER_SLIME) + slime_variant = "cleaner [slime_variant]" + if(overriding_name_prefix) - name = "[overriding_name_prefix] [current_color.name] [(slime_flags & ADULT_SLIME) ? "adult" : "baby"] slime ([number])" + name = "[overriding_name_prefix] [current_color.name] [(slime_flags & ADULT_SLIME) ? "adult" : "baby"] [slime_variant] ([number])" else - name = "[current_color.name] [(slime_flags & ADULT_SLIME) ? "adult" : "baby"] slime ([number])" + name = "[current_color.name] [(slime_flags & ADULT_SLIME) ? "adult" : "baby"] [slime_variant] ([number])" real_name = name update_name_tag() return ..() diff --git a/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm b/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm index 9875a32670ba..f9e79d19fdf2 100644 --- a/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm +++ b/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm @@ -34,14 +34,23 @@ controller.clear_blackboard_key(target_key) /datum/ai_behavior/find_and_set/in_list/clean_targets_slime - action_cooldown = 2 SECONDS + action_cooldown = 1.2 SECONDS /datum/ai_behavior/find_and_set/in_list/clean_targets_slime/search_tactic(datum/ai_controller/controller, locate_paths, search_range) - for(var/obj/item as anything in spiral_range(search_range, controller.pawn, TRUE)) - if(QDELETED(item)) + var/obj/closest + var/closest_path + for(var/obj/trash as anything in view(search_range, controller.pawn)) + if(QDELETED(trash)) continue - if(!is_type_in_typecache(item, locate_paths) && !HAS_TRAIT(item, TRAIT_TRASH_ITEM)) + if(!is_type_in_typecache(trash, locate_paths) && !HAS_TRAIT(trash, TRAIT_TRASH_ITEM)) continue - if(length(get_path_to(controller.pawn, item, max_distance = search_range, simulated_only = FALSE))) - return item - + if(trash.loc == controller.pawn.loc) + return trash + // hopefully get_swarm_path_to will be better, as these things tend to breed like rabbits and you'll have 5 bajillion cleaner slimes before you know it + var/list/path_dist = length(get_swarm_path_to(controller.pawn, trash, age = MAP_REUSE_FAST)) + if(!path_dist) + continue + if(!closest || path_dist < closest_path) + closest = trash + closest_path = path_dist + return closest From 0ae21138d447b8ffcbd17041805fcc304d5d0a61 Mon Sep 17 00:00:00 2001 From: Lucy Date: Mon, 24 Jun 2024 02:32:11 -0400 Subject: [PATCH 06/14] Remove unused changes --- code/__HELPERS/atoms.dm | 2 +- code/modules/reagents/chemistry/items.dm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/__HELPERS/atoms.dm b/code/__HELPERS/atoms.dm index dc19ee445754..6b0ca8cbe475 100644 --- a/code/__HELPERS/atoms.dm +++ b/code/__HELPERS/atoms.dm @@ -248,7 +248,7 @@ rough example of the "cone" made by the 3 dirs checked var/closest_atom var/closest_distance for(var/atom in atom_list) - if(!type || !istype(atom, type)) // monkestation edit: allow null type, for pre-filtered lists + if(!istype(atom, type)) continue var/distance = get_dist(source, atom) if(!closest_atom) diff --git a/code/modules/reagents/chemistry/items.dm b/code/modules/reagents/chemistry/items.dm index 69c13a18b19e..b2e29e3c5d61 100644 --- a/code/modules/reagents/chemistry/items.dm +++ b/code/modules/reagents/chemistry/items.dm @@ -152,7 +152,7 @@ var/lit = FALSE ///total reagent volume var/max_volume = 50 - ///What the creation reagent is + ///What the creation reagent is var/reagent_type = /datum/reagent/consumable/ethanol /obj/item/burner/Initialize(mapload) From 6372a1bcadaf496883f6234771af7feb3c012e33 Mon Sep 17 00:00:00 2001 From: Lucy Date: Mon, 24 Jun 2024 21:17:02 -0400 Subject: [PATCH 07/14] used dna mutators are now trash --- code/game/objects/items/dna_injector.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/game/objects/items/dna_injector.dm b/code/game/objects/items/dna_injector.dm index f71adada7595..9bf31fa4158b 100644 --- a/code/game/objects/items/dna_injector.dm +++ b/code/game/objects/items/dna_injector.dm @@ -96,6 +96,7 @@ to_chat(user, span_notice("It appears that [target] does not have compatible DNA.")) used = TRUE + ADD_TRAIT(src, TRAIT_TRASH_ITEM, INNATE_TRAIT) // monkestation edit: trash item trait update_appearance() /obj/item/dnainjector/timed From 216b14526d7e1096e2b44eeaf83bb6c7afd4d951 Mon Sep 17 00:00:00 2001 From: Lucy Date: Tue, 25 Jun 2024 12:58:46 -0400 Subject: [PATCH 08/14] glue can now be trash too --- monkestation/code/game/objects/items/superglue.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/monkestation/code/game/objects/items/superglue.dm b/monkestation/code/game/objects/items/superglue.dm index a3aa6b7a65e9..536de67f8904 100644 --- a/monkestation/code/game/objects/items/superglue.dm +++ b/monkestation/code/game/objects/items/superglue.dm @@ -29,4 +29,5 @@ if(uses == 0) icon_state = "glue_used" name = "empty bottle of super glue" + ADD_TRAIT(src, TRAIT_TRASH_ITEM, INNATE_TRAIT) return From b14380ee127a67b3b1b7fed6a89e97dac7fa8fde Mon Sep 17 00:00:00 2001 From: Lucy Date: Sun, 30 Jun 2024 04:06:58 -0400 Subject: [PATCH 09/14] Optimize cleaner slime targeting --- .../ai_controller/behaviours/clean_target.dm | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm b/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm index f9e79d19fdf2..9c99aa107d06 100644 --- a/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm +++ b/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm @@ -38,6 +38,7 @@ /datum/ai_behavior/find_and_set/in_list/clean_targets_slime/search_tactic(datum/ai_controller/controller, locate_paths, search_range) var/obj/closest + var/closest_dist var/closest_path for(var/obj/trash as anything in view(search_range, controller.pawn)) if(QDELETED(trash)) @@ -46,11 +47,17 @@ continue if(trash.loc == controller.pawn.loc) return trash - // hopefully get_swarm_path_to will be better, as these things tend to breed like rabbits and you'll have 5 bajillion cleaner slimes before you know it - var/list/path_dist = length(get_swarm_path_to(controller.pawn, trash, age = MAP_REUSE_FAST)) - if(!path_dist) - continue - if(!closest || path_dist < closest_path) - closest = trash - closest_path = path_dist + var/dist = get_dist_euclidean(get_turf(controller.pawn), get_turf(trash)) + var/path_length + if(!QDELETED(closest)) + if(dist > closest_dist) + continue + var/path_length = length(get_swarm_path_to(controller.pawn, trash, age = MAP_REUSE_FAST)) + if(closest_path <= path_length) + continue + else + path_length = length(get_swarm_path_to(controller.pawn, trash, age = MAP_REUSE_FAST)) + closest = trash + closest_dist = dist + closest_path = path_length return closest From d4be533bd51856b1205b0f742bed76b77db32dba Mon Sep 17 00:00:00 2001 From: Lucy Date: Sun, 30 Jun 2024 04:13:17 -0400 Subject: [PATCH 10/14] hmmm --- .../slimecore/mobs/ai_controller/behaviours/clean_target.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm b/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm index 9c99aa107d06..a4441eff8a62 100644 --- a/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm +++ b/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm @@ -50,7 +50,7 @@ var/dist = get_dist_euclidean(get_turf(controller.pawn), get_turf(trash)) var/path_length if(!QDELETED(closest)) - if(dist > closest_dist) + if(dist > (closest_dist + 2)) // leeway to try to avoid "shorter dist but longer path" targets continue var/path_length = length(get_swarm_path_to(controller.pawn, trash, age = MAP_REUSE_FAST)) if(closest_path <= path_length) From bbb1caa0f5643f0f91811b5b16e5209210d75a5f Mon Sep 17 00:00:00 2001 From: Lucy Date: Sun, 30 Jun 2024 04:30:31 -0400 Subject: [PATCH 11/14] bweh --- .../slimecore/mobs/ai_controller/behaviours/clean_target.dm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm b/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm index a4441eff8a62..9c7c50c7e3e4 100644 --- a/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm +++ b/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm @@ -47,16 +47,16 @@ continue if(trash.loc == controller.pawn.loc) return trash - var/dist = get_dist_euclidean(get_turf(controller.pawn), get_turf(trash)) + var/dist = get_dist(get_turf(controller.pawn), get_turf(trash)) var/path_length if(!QDELETED(closest)) if(dist > (closest_dist + 2)) // leeway to try to avoid "shorter dist but longer path" targets continue - var/path_length = length(get_swarm_path_to(controller.pawn, trash, age = MAP_REUSE_FAST)) + var/path_length = length(get_path_to(controller.pawn, trash)) if(closest_path <= path_length) continue else - path_length = length(get_swarm_path_to(controller.pawn, trash, age = MAP_REUSE_FAST)) + path_length = length(get_path_to(controller.pawn, trash)) closest = trash closest_dist = dist closest_path = path_length From 5c546074f9fdc6198e8651383ac1cd0eaf6df898 Mon Sep 17 00:00:00 2001 From: Lucy Date: Sun, 30 Jun 2024 08:20:27 -0400 Subject: [PATCH 12/14] bweh --- .../slimecore/mobs/ai_controller/behaviours/clean_target.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm b/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm index 9c7c50c7e3e4..98efcd5f8d30 100644 --- a/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm +++ b/monkestation/code/modules/slimecore/mobs/ai_controller/behaviours/clean_target.dm @@ -52,7 +52,7 @@ if(!QDELETED(closest)) if(dist > (closest_dist + 2)) // leeway to try to avoid "shorter dist but longer path" targets continue - var/path_length = length(get_path_to(controller.pawn, trash)) + path_length = length(get_path_to(controller.pawn, trash)) if(closest_path <= path_length) continue else From e5d5b4ef2cb40ea6cf79bf9ca51629dc1f3e8a9a Mon Sep 17 00:00:00 2001 From: Lucy Date: Thu, 4 Jul 2024 20:46:30 -0400 Subject: [PATCH 13/14] byeah --- monkestation/code/game/objects/items/cigs_lighters.dm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/monkestation/code/game/objects/items/cigs_lighters.dm b/monkestation/code/game/objects/items/cigs_lighters.dm index d141bfaec731..594bbe811672 100644 --- a/monkestation/code/game/objects/items/cigs_lighters.dm +++ b/monkestation/code/game/objects/items/cigs_lighters.dm @@ -1,3 +1,9 @@ /obj/item/cigbutt/Initialize(mapload) . = ..() ADD_TRAIT(src, TRAIT_TRASH_ITEM, INNATE_TRAIT) + +/obj/item/match/matchburnout() + if(!lit) + return + . = ..() + ADD_TRAIT(src, TRAIT_TRASH_ITEM, INNATE_TRAIT) From e30e00a72e6c0dd3dce3ae14344ae504ded792af Mon Sep 17 00:00:00 2001 From: Lucy Date: Fri, 5 Jul 2024 21:59:02 -0400 Subject: [PATCH 14/14] fix inverted logic --- .../code/modules/projectiles/ammunition/_ammunition.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/monkestation/code/modules/projectiles/ammunition/_ammunition.dm b/monkestation/code/modules/projectiles/ammunition/_ammunition.dm index 6681d8a19058..2efb1e68fa8c 100644 --- a/monkestation/code/modules/projectiles/ammunition/_ammunition.dm +++ b/monkestation/code/modules/projectiles/ammunition/_ammunition.dm @@ -20,6 +20,6 @@ /obj/item/ammo_casing/proc/update_trash_trait() if(QDELETED(loaded_projectile)) - REMOVE_TRAIT(src, TRAIT_TRASH_ITEM, TRAIT_GENERIC) - else ADD_TRAIT(src, TRAIT_TRASH_ITEM, TRAIT_GENERIC) + else + REMOVE_TRAIT(src, TRAIT_TRASH_ITEM, TRAIT_GENERIC)