From ed1e8c4221c244ef0513a99bbd695e8233c19d86 Mon Sep 17 00:00:00 2001
From: timothyteakettle <59849408+timothyteakettle@users.noreply.github.com>
Date: Wed, 22 Jul 2020 15:43:58 +0100
Subject: [PATCH] support for masks
---
code/datums/beepsky_fashion.dm | 14 ++++-
code/modules/clothing/head/_head.dm | 2 +-
code/modules/clothing/masks/_masks.dm | 1 +
.../mob/living/simple_animal/bot/secbot.dm | 52 ++++++++++--------
...secbot_head.dmi => secbot_accessories.dmi} | Bin
5 files changed, 43 insertions(+), 26 deletions(-)
rename icons/mob/{secbot_head.dmi => secbot_accessories.dmi} (100%)
diff --git a/code/datums/beepsky_fashion.dm b/code/datums/beepsky_fashion.dm
index a6e0a81dcd..058a005aa8 100644
--- a/code/datums/beepsky_fashion.dm
+++ b/code/datums/beepsky_fashion.dm
@@ -3,7 +3,7 @@
var/name //not setting the name and desc makes them go to the default
var/desc
- var/icon_file = 'icons/mob/secbot_head.dmi'
+ var/icon_file = 'icons/mob/secbot_accessories.dmi' //we sell secbots and secbot accessories
var/obj_icon_state
var/obj_alpha
var/obj_color
@@ -246,3 +246,15 @@
obj_icon_state = "sombrero"
name = "Sombrerosky"
desc = "A secbot wearing a sombrero. Truly, a hombre to all."
+
+/datum/beepsky_fashion/santa
+ obj_icon_state = "santa"
+ name = "Saint Beepsky"
+ desc = "Have you been a level 7 infraction this holiday season?"
+ capture_one = "BOT is tying CRIMINAL up with fairy lights!"
+ capture_two = "BOT is tying you up with fairy lights!"
+ infraction = "Level THREAT_LEVEL threat to holiday cheer spotted!"
+ attack_one = "BOT crushes CRIMINAL with their holiday spirit!"
+ attack_two = "BOT crushes you with their holiday spirit!"
+ arrest_emote = "ARREST_TYPE level THREAT_LEVEL threat to holiday cheer in LOCATION"
+
diff --git a/code/modules/clothing/head/_head.dm b/code/modules/clothing/head/_head.dm
index 0854d9c270..49ffa27214 100644
--- a/code/modules/clothing/head/_head.dm
+++ b/code/modules/clothing/head/_head.dm
@@ -8,7 +8,7 @@
var/blockTracking = 0 //For AI tracking
var/can_toggle = null
dynamic_hair_suffix = "+generic"
- var/datum/beepsky_fashion/beepsky_fashion //the associated datum for applying this hat to a secbot
+ var/datum/beepsky_fashion/beepsky_fashion //the associated datum for applying this to a secbot
/obj/item/clothing/head/Initialize()
. = ..()
diff --git a/code/modules/clothing/masks/_masks.dm b/code/modules/clothing/masks/_masks.dm
index 7df38661e5..55b14e2d5f 100644
--- a/code/modules/clothing/masks/_masks.dm
+++ b/code/modules/clothing/masks/_masks.dm
@@ -8,6 +8,7 @@
var/modifies_speech = FALSE
var/mask_adjusted = 0
var/adjusted_flags = null
+ var/datum/beepsky_fashion/beepsky_fashion //the associated datum for applying this to a secbot
/obj/item/clothing/mask/attack_self(mob/user)
if(CHECK_BITFIELD(clothing_flags, VOICEBOX_TOGGLABLE))
diff --git a/code/modules/mob/living/simple_animal/bot/secbot.dm b/code/modules/mob/living/simple_animal/bot/secbot.dm
index de811cc644..cec25f50c0 100644
--- a/code/modules/mob/living/simple_animal/bot/secbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/secbot.dm
@@ -33,7 +33,7 @@
var/check_records = TRUE //Does it check security records?
var/arrest_type = FALSE //If true, don't handcuff
- var/obj/item/clothing/head/bot_hat
+ var/obj/item/clothing/head/bot_accessory
var/datum/beepsky_fashion/stored_fashion
//emotes (BOT is replaced with bot name, CRIMINAL with criminal name, THREAT_LEVEL with threat level)
@@ -226,9 +226,9 @@ Auto Patrol: []"},
retaliate(H)
if(special_retaliate_after_attack(H))
return
- if(H.a_intent == INTENT_HELP && bot_hat)
- to_chat(H, "You knock [bot_hat] off of [src]'s head!")
- bot_hat.forceMove(get_turf(src))
+ if(H.a_intent == INTENT_HELP && bot_accessory)
+ to_chat(H, "You knock [bot_accessory] off of [src]'s head!")
+ bot_accessory.forceMove(get_turf(src))
//reset all emotes/sounds
death_emote = initial(death_emote)
capture_one = initial(capture_one)
@@ -240,7 +240,7 @@ Auto Patrol: []"},
arrest_texts = initial(arrest_texts)
arrest_emote = initial(arrest_emote)
patrol_emote = initial(patrol_emote)
- bot_hat = null
+ bot_accessory = null
qdel(stored_fashion)
return
@@ -250,7 +250,7 @@ Auto Patrol: []"},
..()
if(istype(W, /obj/item/weldingtool) && user.a_intent != INTENT_HARM) // Any intent but harm will heal, so we shouldn't get angry.
return
- if(istype(W, /obj/item/clothing/head))
+ if(istype(W, /obj/item/clothing/head) || istype(W, /obj/item/clothing/mask))
attempt_place_on_head(user, W)
return
if(!istype(W, /obj/item/screwdriver) && (W.force) && (!target) && (W.damtype != STAMINA) ) // Added check for welding tool to fix #2432. Welding tool behavior is handled in superclass.
@@ -258,39 +258,43 @@ Auto Patrol: []"},
if(special_retaliate_after_attack(user))
return
-/mob/living/simple_animal/bot/secbot/proc/attempt_place_on_head(mob/user, obj/item/clothing/head/H)
+/mob/living/simple_animal/bot/secbot/proc/attempt_place_on_head(mob/user, obj/item/I)
if(user && !user.temporarilyRemoveItemFromInventory(H))
to_chat(user, "\The [H] is stuck to your hand, you cannot put it on [src]'s head!")
return
- if(bot_hat)
- to_chat("\[src] already has a hat, and the laws of physics disallow him from wearing a second!")
- if(H.beepsky_fashion)
- to_chat(user, "You set [H] on [src]'s head.")
- bot_hat = H
+ if(bot_accessory)
+ to_chat("\[src] already has an accessory, and the laws of physics disallow him from wearing a second!")
+ return
+ if(istype(I, /obj/item/clothing/head)
+ var/obj/item/clothing/head/H = I
+ if(H.beepsky_fashion)
+ stored_fashion = new H.beepsky_fashion
+ else
+ //it must be a mask
+ var/obj/item/clothing/mask/M = I
+ if(M.beepsky_fashion)
+ stored_fashion = new M.beepsky_fashion
+ if(stored_fashion)
+ to_chat(user, "You set [I] on [src].")
+ bot_accessory = H
H.forceMove(src)
- update_beepsky_fluff()
+ stored_fashion.apply(src)
regenerate_icons()
else
to_chat(user, "You set [H] on [src]'s head, but it falls off!")
H.forceMove(drop_location())
-/mob/living/simple_animal/bot/secbot/proc/update_beepsky_fluff()
- var/datum/beepsky_fashion/BF = new bot_hat.beepsky_fashion
- stored_fashion = BF
- if(BF)
- BF.apply(src)
-
/mob/living/simple_animal/bot/secbot/regenerate_icons()
..()
- if(bot_hat)
+ if(bot_accessory)
if(!stored_fashion)
- stored_fashion = new bot_hat.beepsky_fashion
+ stored_fashion = new bot_accessory.beepsky_fashion
if(!stored_fashion.obj_icon_state)
- stored_fashion.obj_icon_state = bot_hat.icon_state
+ stored_fashion.obj_icon_state = bot_accessory.icon_state
if(!stored_fashion.obj_alpha)
- stored_fashion.obj_alpha = bot_hat.alpha
+ stored_fashion.obj_alpha = bot_accessory.alpha
if(!stored_fashion.obj_color)
- stored_fashion.obj_color = bot_hat.color
+ stored_fashion.obj_color = bot_accessory.color
add_overlay(stored_fashion.get_overlay())
/mob/living/simple_animal/bot/secbot/emag_act(mob/user)
diff --git a/icons/mob/secbot_head.dmi b/icons/mob/secbot_accessories.dmi
similarity index 100%
rename from icons/mob/secbot_head.dmi
rename to icons/mob/secbot_accessories.dmi