From 0b2dc275fce91c9a5206fc3fc299fb6541dfbd2e Mon Sep 17 00:00:00 2001 From: TheSmallBlue Date: Mon, 11 Apr 2022 01:43:40 -0300 Subject: [PATCH] Adds a flag that lets mobs be colored with spraycans, and adds said flag to the hygienebot (#65891) --- .../dcs/signals/signals_mob/signals_mob_living.dm | 3 +++ code/__DEFINES/traits.dm | 2 ++ code/game/objects/items/crayons.dm | 13 +++++++++++++ .../mob/living/simple_animal/bot/hygienebot.dm | 4 ++++ 4 files changed, 22 insertions(+) diff --git a/code/__DEFINES/dcs/signals/signals_mob/signals_mob_living.dm b/code/__DEFINES/dcs/signals/signals_mob/signals_mob_living.dm index 2491fbe9264..7a612ee6b3a 100644 --- a/code/__DEFINES/dcs/signals/signals_mob/signals_mob_living.dm +++ b/code/__DEFINES/dcs/signals/signals_mob/signals_mob_living.dm @@ -86,3 +86,6 @@ ///From base of mob/living/ZImpactDamage() (mob/living, levels, turf/t) #define COMSIG_LIVING_Z_IMPACT "living_z_impact" #define NO_Z_IMPACT_DAMAGE (1<<0) + +///From obj/item/toy/crayon/spraycan +#define COMSIG_LIVING_MOB_PAINTED "living_mob_painted" diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index bbd4320f8c8..68e863459ba 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -357,6 +357,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai #define TRAIT_ELITE_CHALLENGER "elite_challenger" /// For living mobs. It signals that the mob shouldn't have their data written in an external json for persistence. #define TRAIT_DONT_WRITE_MEMORY "dont_write_memory" +/// This mob can be painted with the spraycan +#define TRAIT_SPRAY_PAINTABLE "spray_paintable" #define TRAIT_NOBLEED "nobleed" //This carbon doesn't bleed /// This atom can ignore the "is on a turf" check for simple AI datum attacks, allowing them to attack from bags or lockers as long as any other conditions are met diff --git a/code/game/objects/items/crayons.dm b/code/game/objects/items/crayons.dm index 1fbcda5fcc4..def8e017f40 100644 --- a/code/game/objects/items/crayons.dm +++ b/code/game/objects/items/crayons.dm @@ -749,6 +749,19 @@ return + if(ismob(target) && (HAS_TRAIT(target, TRAIT_SPRAY_PAINTABLE))) + if(actually_paints) + target.add_atom_colour(paint_color, WASHABLE_COLOUR_PRIORITY) + SEND_SIGNAL(target, COMSIG_LIVING_MOB_PAINTED) + . = use_charges(user, 2, requires_full = FALSE) + reagents.trans_to(target, ., volume_multiplier, transfered_by = user, methods = VAPOR) + + if(pre_noise || post_noise) + playsound(user.loc, 'sound/effects/spray.ogg', 5, TRUE, 5) + user.visible_message(span_notice("[user] coats [target] with spray paint!"), span_notice("You coat [target] with spray paint.")) + return . + + if(isobj(target) && !(target.flags_1 & UNPAINTABLE_1)) if(actually_paints) var/color_is_dark = is_color_dark(paint_color) diff --git a/code/modules/mob/living/simple_animal/bot/hygienebot.dm b/code/modules/mob/living/simple_animal/bot/hygienebot.dm index 729f3002141..41ef078a6ec 100644 --- a/code/modules/mob/living/simple_animal/bot/hygienebot.dm +++ b/code/modules/mob/living/simple_animal/bot/hygienebot.dm @@ -50,6 +50,8 @@ ) AddElement(/datum/element/connect_loc, loc_connections) + ADD_TRAIT(src, TRAIT_SPRAY_PAINTABLE, INNATE_TRAIT) + /mob/living/simple_animal/bot/hygienebot/explode() new /obj/effect/particle_effect/foam(loc) @@ -92,6 +94,8 @@ if(washing) do_wash(loc) for(var/AM in loc) + if (AM == src) + continue do_wash(AM) if(isopenturf(loc) && !(bot_cover_flags & BOT_COVER_EMAGGED)) var/turf/open/tile = loc