From a2fe9f0d238db3ed47b1861583e53e66c19c4d85 Mon Sep 17 00:00:00 2001
From: Ghom <42542238+Ghommie@users.noreply.github.com>
Date: Wed, 4 Mar 2020 17:03:26 +0100
Subject: [PATCH] Update toys.dm
---
code/game/objects/items/toys.dm | 69 ++++++++++++++++-----------------
1 file changed, 34 insertions(+), 35 deletions(-)
diff --git a/code/game/objects/items/toys.dm b/code/game/objects/items/toys.dm
index 1a5f97c4e0..8f683b8c1c 100644
--- a/code/game/objects/items/toys.dm
+++ b/code/game/objects/items/toys.dm
@@ -228,26 +228,39 @@
var/hacked = FALSE
total_mass = 0.4
var/total_mass_on = TOTAL_MASS_TOY_SWORD
+ var/activation_sound = 'sound/weapons/saberon.ogg'
+ var/deactivation_sound = 'sound/weapons/saberoff.ogg'
+ var/activation_message = "You extend the plastic blade with a quick flick of your wrist."
+ var/deactivation_message = "You push the plastic blade back down into the handle."
+ var/transform_volume = 20
/obj/item/toy/sword/attack_self(mob/user)
- active = !( active )
+ active = !active
if (active)
- to_chat(user, "You extend the plastic blade with a quick flick of your wrist.")
- playsound(user, 'sound/weapons/saberon.ogg', 20, 1)
+ to_chat(user, "[activation_message]")
+ playsound(user, activation_sound, transform_volume, 1)
+ w_class = WEIGHT_CLASS_BULKY
+ AddElement(/datum/element/sword_point)
+ else
+ to_chat(user, "[deactivation_message]")
+ playsound(user, deactivation_sound, transform_volume, 1)
+ w_class = WEIGHT_CLASS_SMALL
+ RemoveElement(/datum/element/sword_point)
+
+ update_icon()
+ add_fingerprint(user)
+
+/obj/item/toy/sword/update_icon_state()
+ if(active)
if(hacked)
icon_state = "swordrainbow"
item_state = "swordrainbow"
else
icon_state = "swordblue"
item_state = "swordblue"
- w_class = WEIGHT_CLASS_BULKY
else
- to_chat(user, "You push the plastic blade back down into the handle.")
- playsound(user, 'sound/weapons/saberoff.ogg', 20, 1)
icon_state = "sword0"
item_state = "sword0"
- w_class = WEIGHT_CLASS_SMALL
- add_fingerprint(user)
// Copied from /obj/item/melee/transforming/energy/sword/attackby
/obj/item/toy/sword/attackby(obj/item/W, mob/living/user, params)
@@ -270,7 +283,7 @@
to_chat(user, "RNBW_ENGAGE")
if(active)
- icon_state = "swordrainbow"
+ update_icon()
user.update_inv_hands()
else
to_chat(user, "It's already fabulous!")
@@ -290,38 +303,24 @@
w_class = WEIGHT_CLASS_SMALL
attack_verb = list("poked", "jabbed", "hit")
light_color = "#37FFF7"
+ activation_sound = 'sound/weapons/nebon.ogg'
+ deactivation_sound = 'sound/weapons/neboff.ogg'
+ transform_volume = 50
+ activation_message = "You activate the holographic blade with a press of a button."
+ deactivation_message = "You deactivate the holographic blade with a press of a button."
var/light_brightness = 3
actions_types = list()
-/obj/item/toy/sword/cx/alt_pre_attack(atom/A, mob/living/user, params) //checks if it can do right click memes
- altafterattack(A, user, TRUE, params)
- return TRUE
-
-/obj/item/toy/sword/cx/altafterattack(atom/target, mob/living/carbon/user, proximity_flag, click_parameters) //does right click memes
- if(istype(user))
- user.visible_message("[user] points the tip of [src] at [target].", "You point the tip of [src] at [target].")
- return TRUE
+/obj/item/toy/sword/cx/ComponentInitialize()
+ . = ..()
+ AddElement(/datum/element/update_icon_updates_onmob)
/obj/item/toy/sword/cx/attack_self(mob/user)
- active = !( active )
+ . = ..()
+ set_light(active ? light_brightness : 0)
- if (active)
- to_chat(user, "You activate the holographic blade with a press of a button.")
- playsound(user, 'sound/weapons/nebon.ogg', 50, 1)
- w_class = WEIGHT_CLASS_BULKY
- attack_verb = list("slashed", "stabbed", "ravaged")
- set_light(light_brightness)
- update_icon()
-
- else
- to_chat(user, "You deactivate the holographic blade with a press of a button.")
- playsound(user, 'sound/weapons/neboff.ogg', 50, 1)
- w_class = WEIGHT_CLASS_SMALL
- attack_verb = list("poked", "jabbed", "hit")
- set_light(0)
- update_icon()
-
- add_fingerprint(user)
+/obj/item/toy/sword/cx/update_icon_state()
+ return
/obj/item/toy/sword/cx/update_overlays()
. = ..()