Skip to content

Commit

Permalink
add: Colorful buckets and Cleanbots (ss220-space#3597)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladisvell authored Oct 4, 2023
1 parent ad415db commit c225f0c
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 24 deletions.
4 changes: 4 additions & 0 deletions code/modules/mob/living/carbon/human/update_icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,8 @@ GLOBAL_LIST_EMPTY(damage_icon_parts)
else
standing = mutable_appearance(r_hand.righthand_file, "[t_state]", layer = -R_HAND_LAYER)
standing = center_image(standing, r_hand.inhand_x_dimension, r_hand.inhand_y_dimension)
standing.color = r_hand.color
standing.alpha = r_hand.alpha
overlays_standing[R_HAND_LAYER] = standing
apply_overlay(R_HAND_LAYER)

Expand All @@ -1091,6 +1093,8 @@ GLOBAL_LIST_EMPTY(damage_icon_parts)
else
standing = mutable_appearance(l_hand.lefthand_file, "[t_state]", layer = -L_HAND_LAYER)
standing = center_image(standing, l_hand.inhand_x_dimension, l_hand.inhand_y_dimension)
standing.color = l_hand.color
standing.alpha = l_hand.alpha
overlays_standing[L_HAND_LAYER] = standing
apply_overlay(L_HAND_LAYER)

Expand Down
54 changes: 30 additions & 24 deletions code/modules/mob/living/simple_animal/bot/cleanbot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
name = "\improper Cleanbot"
desc = "A little cleaning robot, he looks so excited!"
icon = 'icons/obj/aibots.dmi'
icon_state = "cleanbot0"
icon_state = "cleanbot"
density = 0
anchored = 0
health = 25
Expand All @@ -19,7 +19,8 @@
pass_flags = PASSMOB
path_image_color = "#993299"


///Mask color defines what color cleanbot's chassis will be. Format: "#RRGGBB"
var/mask_color = null
var/blood = 1
var/list/target_types = list()
var/obj/effect/decal/cleanable/target
Expand All @@ -34,19 +35,30 @@
/mob/living/simple_animal/bot/cleanbot/New()
..()
get_targets()
icon_state = "cleanbot[on]"

var/datum/job/janitor/J = new/datum/job/janitor
access_card.access += J.get_access()
prev_access = access_card.access

/mob/living/simple_animal/bot/cleanbot/turn_on()
..()
icon_state = "cleanbot[on]"

/mob/living/simple_animal/bot/cleanbot/turn_off()
..()
icon_state = "cleanbot[on]"
update_icon()

/mob/living/simple_animal/bot/cleanbot/update_icon()
overlays.Cut()
var/overlay_state
switch(mode)
if(BOT_CLEANING)
overlay_state = "-c"
if(BOT_IDLE)
overlay_state = "[on]"

var/mutable_appearance/state_appearance = mutable_appearance(icon, "[icon_state][overlay_state]")
state_appearance.appearance_flags |= RESET_COLOR
overlays += state_appearance

if(mask_color)
var/mutable_appearance/casing_mask = mutable_appearance(icon, "cleanbot_mask")
casing_mask.appearance_flags |= RESET_COLOR
casing_mask.color = mask_color
overlays += casing_mask

/mob/living/simple_animal/bot/cleanbot/bot_reset()
..()
Expand All @@ -60,17 +72,11 @@
text_dehack_fail = "[name] does not seem to respond to your repair code!"

/mob/living/simple_animal/bot/cleanbot/attackby(obj/item/W, mob/user, params)
if(W.GetID() || ispda(W))
if(bot_core.allowed(user) && !open && !emagged)
locked = !locked
to_chat(user, "<span class='notice'>You [ locked ? "lock" : "unlock"] \the [src] behaviour controls.</span>")
else
if(emagged)
to_chat(user, "<span class='warning'>ERROR</span>")
if(open)
to_chat(user, "<span class='warning'>Please close the access panel before locking it.</span>")
else
to_chat(user, "<span class='notice'>\The [src] doesn't seem to respect your authority.</span>")
if(istype(W, /obj/item/toy/crayon/spraycan))
var/obj/item/toy/crayon/spraycan/can = W
if(!can.capped && Adjacent(user))
src.mask_color = can.colour
update_icon()
else
return ..()

Expand Down Expand Up @@ -165,15 +171,15 @@

/mob/living/simple_animal/bot/cleanbot/proc/clean(obj/effect/decal/cleanable/target)
anchored = 1
icon_state = "cleanbot-c"
visible_message("<span class='notice'>[src] begins to clean up [target]</span>")
mode = BOT_CLEANING
update_icon()
spawn(50)
if(mode == BOT_CLEANING)
QDEL_NULL(target)
anchored = 0
mode = BOT_IDLE
icon_state = "cleanbot[on]"
update_icon()

/mob/living/simple_animal/bot/cleanbot/explode()
on = 0
Expand Down
29 changes: 29 additions & 0 deletions code/modules/reagents/reagent_containers/glass_containers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,30 @@
slot_flags = SLOT_HEAD
resistance_flags = NONE
container_type = OPENCONTAINER
var/paintable = TRUE

/obj/item/reagent_containers/glass/bucket/Initialize(mapload)
. = ..()
update_icon() //in case bucket's color has been changed in editor or by some deriving buckets

/obj/item/reagent_containers/glass/bucket/attackby(obj/D, mob/user, params)
. = ..()
if(paintable && istype(D, /obj/item/toy/crayon/spraycan))
var/obj/item/toy/crayon/spraycan/can = D
if(!can.capped && Adjacent(can, 1))
color = can.colour
update_icon()

/obj/item/reagent_containers/glass/bucket/update_icon()
. = ..()
overlays.Cut()
if(color)
var/mutable_appearance/bucket_mask = mutable_appearance(icon='icons/obj/janitor.dmi', icon_state = "bucket_mask")
overlays += bucket_mask

var/mutable_appearance/bucket_hand = mutable_appearance(icon='icons/obj/janitor.dmi', icon_state = "bucket_hand")
bucket_hand.appearance_flags |= RESET_COLOR
overlays += bucket_hand

/obj/item/reagent_containers/glass/bucket/wooden
name = "wooden bucket"
Expand All @@ -320,6 +344,11 @@
materials = null
armor = list("melee" = 10, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 0, "acid" = 50)
resistance_flags = FLAMMABLE
paintable = FALSE

/obj/item/reagent_containers/glass/bucket/wooden/update_icon()
. = ..()
overlays.Cut()

/obj/item/reagent_containers/glass/bucket/equipped(mob/user, slot, initial)
. = ..()
Expand Down
Binary file modified icons/mob/clothing/head.dmi
Binary file not shown.
Binary file modified icons/mob/inhands/items_lefthand.dmi
Binary file not shown.
Binary file modified icons/mob/inhands/items_righthand.dmi
Binary file not shown.
Binary file modified icons/obj/aibots.dmi
Binary file not shown.
Binary file modified icons/obj/janitor.dmi
Binary file not shown.

0 comments on commit c225f0c

Please sign in to comment.