mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-29 16:18:01 +01:00
[MIRROR] Removes some boilerplate from transforming component [MDB IGNORE] (#21885)
* Removes some boilerplate from transforming component * conflicts --------- Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Co-authored-by: Tom <8881105+tf-4@users.noreply.github.com>
This commit is contained in:
co-authored by
MrMelbert
Tom
parent
bd79490ccf
commit
4a451d4e24
@@ -632,6 +632,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
|
||||
#define TRAIT_APC_SHOCKING "apc_shocking"
|
||||
/// Properly wielded two handed item
|
||||
#define TRAIT_WIELDED "wielded"
|
||||
/// A transforming item that is actively extended / transformed
|
||||
#define TRAIT_TRANSFORM_ACTIVE "active_transform"
|
||||
/// Buckling yourself to objects with this trait won't immobilize you
|
||||
#define TRAIT_NO_IMMOBILIZE "no_immobilize"
|
||||
/// Prevents stripping this equipment
|
||||
|
||||
@@ -20,9 +20,7 @@
|
||||
var/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner/BDM = owner
|
||||
var/obj/item/melee/cleaving_saw/miner/miner_saw = BDM.miner_saw
|
||||
miner_saw.attack_self(owner)
|
||||
if(!miner_saw.is_open)
|
||||
BDM.rapid_melee = 5 // 4 deci cooldown before changes, npcpool subsystem wait is 20, 20/4 = 5
|
||||
else
|
||||
BDM.rapid_melee = 3 // same thing but halved (slightly rounded up)
|
||||
BDM.icon_state = "miner[miner_saw.is_open ? "_transformed":""]"
|
||||
BDM.icon_living = "miner[miner_saw.is_open ? "_transformed":""]"
|
||||
var/saw_open = HAS_TRAIT(miner_saw, TRAIT_TRANSFORM_ACTIVE)
|
||||
BDM.rapid_melee = saw_open ? 3 : 5
|
||||
BDM.icon_state = "miner[saw_open ? "_transformed":""]"
|
||||
BDM.icon_living = "miner[saw_open ? "_transformed":""]"
|
||||
|
||||
@@ -37,24 +37,24 @@
|
||||
/// If we get sharpened with a whetstone, save the bonus here for later use if we un/redeploy
|
||||
var/sharpened_bonus = 0
|
||||
/// Dictate whether we change inhands or not
|
||||
var/inhand_icon_change
|
||||
var/inhand_icon_change = TRUE
|
||||
/// Cooldown in between transforms
|
||||
COOLDOWN_DECLARE(transform_cooldown)
|
||||
|
||||
/datum/component/transforming/Initialize(
|
||||
start_transformed = FALSE,
|
||||
transform_cooldown_time = 0 SECONDS,
|
||||
force_on = 0,
|
||||
throwforce_on = 0,
|
||||
throw_speed_on = 2,
|
||||
sharpness_on = NONE,
|
||||
hitsound_on = 'sound/weapons/blade1.ogg',
|
||||
w_class_on = WEIGHT_CLASS_BULKY,
|
||||
clumsy_check = TRUE,
|
||||
list/attack_verb_continuous_on,
|
||||
list/attack_verb_simple_on,
|
||||
inhand_icon_change = TRUE,
|
||||
)
|
||||
start_transformed = FALSE,
|
||||
transform_cooldown_time = 0 SECONDS,
|
||||
force_on = 0,
|
||||
throwforce_on = 0,
|
||||
throw_speed_on = 2,
|
||||
sharpness_on = NONE,
|
||||
hitsound_on = 'sound/weapons/blade1.ogg',
|
||||
w_class_on = WEIGHT_CLASS_BULKY,
|
||||
clumsy_check = TRUE,
|
||||
list/attack_verb_continuous_on,
|
||||
list/attack_verb_simple_on,
|
||||
inhand_icon_change = TRUE,
|
||||
)
|
||||
|
||||
if(!isitem(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
@@ -120,7 +120,7 @@
|
||||
|
||||
if(do_transform(source, user))
|
||||
clumsy_transform_effect(user)
|
||||
. = COMPONENT_CANCEL_ATTACK_CHAIN
|
||||
return COMPONENT_CANCEL_ATTACK_CHAIN
|
||||
|
||||
/*
|
||||
* Transform the weapon into its alternate form, calling [toggle_active].
|
||||
@@ -153,7 +153,7 @@
|
||||
/datum/component/transforming/proc/default_transform_message(obj/item/source, mob/user)
|
||||
if(user)
|
||||
source.balloon_alert(user, "[active ? "enabled" : "disabled"] [source]")
|
||||
playsound(user ? user : source.loc, 'sound/weapons/batonextend.ogg', 50, TRUE)
|
||||
playsound(source, 'sound/weapons/batonextend.ogg', 50, TRUE)
|
||||
|
||||
/*
|
||||
* Toggle active between true and false, and call
|
||||
@@ -175,6 +175,7 @@
|
||||
* source - the item being transformed / parent
|
||||
*/
|
||||
/datum/component/transforming/proc/set_active(obj/item/source)
|
||||
ADD_TRAIT(source, TRAIT_TRANSFORM_ACTIVE, REF(src))
|
||||
if(sharpness_on)
|
||||
source.sharpness = sharpness_on
|
||||
if(force_on)
|
||||
@@ -203,6 +204,7 @@
|
||||
* source - the item being un-transformed / parent
|
||||
*/
|
||||
/datum/component/transforming/proc/set_inactive(obj/item/source)
|
||||
REMOVE_TRAIT(source, TRAIT_TRANSFORM_ACTIVE, REF(src))
|
||||
if(sharpness_on)
|
||||
source.sharpness = initial(source.sharpness)
|
||||
if(force_on)
|
||||
@@ -245,8 +247,8 @@
|
||||
var/hurt_self_verb_continuous = LAZYLEN(attack_verb_continuous_on) ? pick(attack_verb_continuous_on) : "hits"
|
||||
user.visible_message(
|
||||
span_warning("[user] triggers [parent] while holding it backwards and [hurt_self_verb_continuous] themself, like a doofus!"),
|
||||
span_warning("You trigger [parent] while holding it backwards and [hurt_self_verb_simple] yourself, like a doofus!")
|
||||
)
|
||||
span_warning("You trigger [parent] while holding it backwards and [hurt_self_verb_simple] yourself, like a doofus!"),
|
||||
)
|
||||
user.take_bodypart_damage(10)
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
@@ -13,10 +13,6 @@
|
||||
w_class = WEIGHT_CLASS_SMALL
|
||||
resistance_flags = FIRE_PROOF
|
||||
force = 0
|
||||
var/start_extended = FALSE
|
||||
/// Whether or not the boxcutter has been readied
|
||||
var/on = FALSE
|
||||
var/on_sound = 'sound/items/boxcutter_activate.ogg'
|
||||
/// Used on Initialize, how much time to cut cable restraints and zipties.
|
||||
var/snap_time_weak_handcuffs = 0 SECONDS
|
||||
/// Used on Initialize, how much time to cut real handcuffs. Null means it can't.
|
||||
@@ -30,8 +26,8 @@
|
||||
effectiveness = 100, \
|
||||
)
|
||||
|
||||
AddComponent(/datum/component/transforming, \
|
||||
start_transformed = start_extended, \
|
||||
AddComponent( \
|
||||
/datum/component/transforming, \
|
||||
force_on = 10, \
|
||||
throwforce_on = 4, \
|
||||
throw_speed_on = throw_speed, \
|
||||
@@ -47,8 +43,7 @@
|
||||
/obj/item/boxcutter/proc/on_transform(obj/item/source, mob/user, active)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
on = active
|
||||
playsound(src, on_sound, 50)
|
||||
playsound(src, 'sound/items/boxcutter_activate.ogg', 50)
|
||||
tool_behaviour = (active ? TOOL_KNIFE : NONE)
|
||||
if(active)
|
||||
AddElement(/datum/element/cuffsnapping, snap_time_weak_handcuffs, snap_time_strong_handcuffs)
|
||||
|
||||
@@ -322,13 +322,15 @@
|
||||
|
||||
/obj/item/melee/baton/telescopic/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/transforming, \
|
||||
AddComponent( \
|
||||
/datum/component/transforming, \
|
||||
force_on = active_force, \
|
||||
hitsound_on = hitsound, \
|
||||
w_class_on = WEIGHT_CLASS_NORMAL, \
|
||||
clumsy_check = FALSE, \
|
||||
attack_verb_continuous_on = list("smacks", "strikes", "cracks", "beats"), \
|
||||
attack_verb_simple_on = list("smack", "strike", "crack", "beat"))
|
||||
attack_verb_simple_on = list("smack", "strike", "crack", "beat"), \
|
||||
)
|
||||
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, PROC_REF(on_transform))
|
||||
|
||||
/obj/item/melee/baton/telescopic/suicide_act(mob/living/user)
|
||||
@@ -361,8 +363,9 @@
|
||||
|
||||
src.active = active
|
||||
inhand_icon_state = active ? on_inhand_icon_state : null // When inactive, there is no inhand icon_state.
|
||||
balloon_alert(user, active ? "extended" : "collapsed")
|
||||
playsound(user ? user : src, on_sound, 50, TRUE)
|
||||
if(user)
|
||||
balloon_alert(user, active ? "extended" : "collapsed")
|
||||
playsound(src, on_sound, 50, TRUE)
|
||||
return COMPONENT_NO_DEFAULT_MESSAGE
|
||||
|
||||
/obj/item/melee/baton/telescopic/contractor_baton
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
/// The color of this energy based sword, for use in editing the icon_state.
|
||||
var/sword_color_icon
|
||||
/// Whether our blade is active or not.
|
||||
var/blade_active = FALSE
|
||||
/// Force while active.
|
||||
var/active_force = 30
|
||||
/// Throwforce while active.
|
||||
@@ -48,9 +46,11 @@
|
||||
/obj/item/melee/energy/Initialize(mapload)
|
||||
. = ..()
|
||||
make_transformable()
|
||||
AddComponent(/datum/component/butchering, \
|
||||
speed = 5 SECONDS, \
|
||||
butcher_sound = active_hitsound, \
|
||||
AddElement(/datum/element/update_icon_updates_onmob)
|
||||
AddComponent(
|
||||
/datum/component/butchering, \
|
||||
speed = 5 SECONDS, \
|
||||
butcher_sound = active_hitsound, \
|
||||
)
|
||||
|
||||
/obj/item/melee/energy/Destroy()
|
||||
@@ -61,7 +61,8 @@
|
||||
* Gives our item the transforming component, passing in our various vars.
|
||||
*/
|
||||
/obj/item/melee/energy/proc/make_transformable()
|
||||
AddComponent(/datum/component/transforming, \
|
||||
AddComponent( \
|
||||
/datum/component/transforming, \
|
||||
force_on = active_force, \
|
||||
throwforce_on = active_throwforce, \
|
||||
throw_speed_on = 4, \
|
||||
@@ -70,12 +71,11 @@
|
||||
w_class_on = active_w_class, \
|
||||
attack_verb_continuous_on = list("attacks", "slashes", "stabs", "slices", "tears", "lacerates", "rips", "dices", "cuts"), \
|
||||
attack_verb_simple_on = list("attack", "slash", "stab", "slice", "tear", "lacerate", "rip", "dice", "cut"), \
|
||||
inhand_icon_change = FALSE, \
|
||||
)
|
||||
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, PROC_REF(on_transform))
|
||||
|
||||
/obj/item/melee/energy/suicide_act(mob/living/user)
|
||||
if(!blade_active)
|
||||
if(!HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE))
|
||||
attack_self(user)
|
||||
user.visible_message(span_suicide("[user] is [pick("slitting [user.p_their()] stomach open with", "falling on")] [src]! It looks like [user.p_theyre()] trying to commit seppuku!"))
|
||||
return (BRUTELOSS|FIRELOSS)
|
||||
@@ -85,7 +85,7 @@
|
||||
open_flame()
|
||||
|
||||
/obj/item/melee/energy/ignition_effect(atom/atom, mob/user)
|
||||
if(!heat && !blade_active)
|
||||
if(!heat && !HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE))
|
||||
return ""
|
||||
|
||||
var/in_mouth = ""
|
||||
@@ -97,27 +97,28 @@
|
||||
playsound(loc, hitsound, get_clamped_volume(), TRUE, -1)
|
||||
add_fingerprint(user)
|
||||
|
||||
/*
|
||||
/obj/item/melee/energy/update_icon_state()
|
||||
. = ..()
|
||||
if(!sword_color_icon)
|
||||
return
|
||||
if(HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE))
|
||||
icon_state = "[base_icon_state]_on_[sword_color_icon]" // "esword_on_red"
|
||||
inhand_icon_state = icon_state
|
||||
else
|
||||
icon_state = base_icon_state
|
||||
inhand_icon_state = base_icon_state
|
||||
|
||||
/**
|
||||
* Signal proc for [COMSIG_TRANSFORMING_ON_TRANSFORM].
|
||||
*
|
||||
* Updates our icon to have the correct color,
|
||||
* updates the amount of heat our item gives out,
|
||||
* enables / disables embedding, and
|
||||
* starts / stops processing.
|
||||
* Updates some of the stuff the transforming comp doesn't, such as heat and embedding.
|
||||
*
|
||||
* Also gives feedback to the user and activates or deactives the glow.
|
||||
*/
|
||||
/obj/item/melee/energy/proc/on_transform(obj/item/source, mob/user, active)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
blade_active = active
|
||||
if(active)
|
||||
if(sword_color_icon)
|
||||
icon_state = "[icon_state]_[sword_color_icon]"
|
||||
inhand_icon_state = "[inhand_icon_state]_on_[sword_color_icon]"
|
||||
if(ismob(loc))
|
||||
var/mob/loc_mob = loc
|
||||
loc_mob.update_held_items()
|
||||
if(embedding)
|
||||
updateEmbedding()
|
||||
heat = active_heat
|
||||
@@ -131,8 +132,9 @@
|
||||
tool_behaviour = (active ? TOOL_SAW : NONE) //Lets energy weapons cut trees. Also lets them do bonecutting surgery, which is kinda metal!
|
||||
if(user)
|
||||
balloon_alert(user, "[name] [active ? "enabled":"disabled"]")
|
||||
playsound(user ? user : src, active ? 'sound/weapons/saberon.ogg' : 'sound/weapons/saberoff.ogg', 35, TRUE)
|
||||
playsound(src, active ? 'sound/weapons/saberon.ogg' : 'sound/weapons/saberoff.ogg', 35, TRUE)
|
||||
set_light_on(active)
|
||||
update_appearance(UPDATE_ICON_STATE)
|
||||
return COMPONENT_NO_DEFAULT_MESSAGE
|
||||
|
||||
/// Energy axe - extremely strong.
|
||||
@@ -141,6 +143,7 @@
|
||||
desc = "An energized battle axe."
|
||||
icon_state = "axe"
|
||||
inhand_icon_state = "axe"
|
||||
base_icon_state = "axe"
|
||||
lefthand_file = 'icons/mob/inhands/weapons/axes_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/weapons/axes_righthand.dmi'
|
||||
hitsound = 'sound/weapons/bladeslice.ogg'
|
||||
@@ -161,12 +164,14 @@
|
||||
active_w_class = WEIGHT_CLASS_HUGE
|
||||
|
||||
/obj/item/melee/energy/axe/make_transformable()
|
||||
AddComponent(/datum/component/transforming, \
|
||||
AddComponent( \
|
||||
/datum/component/transforming, \
|
||||
force_on = active_force, \
|
||||
throwforce_on = active_throwforce, \
|
||||
throw_speed_on = throw_speed, \
|
||||
sharpness_on = sharpness, \
|
||||
w_class_on = active_w_class)
|
||||
w_class_on = active_w_class, \
|
||||
)
|
||||
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, PROC_REF(on_transform))
|
||||
|
||||
/obj/item/melee/energy/axe/suicide_act(mob/living/user)
|
||||
@@ -178,6 +183,7 @@
|
||||
name = "energy sword"
|
||||
desc = "May the force be within you."
|
||||
icon_state = "e_sword"
|
||||
base_icon_state = "e_sword"
|
||||
inhand_icon_state = "e_sword"
|
||||
lefthand_file = 'icons/mob/inhands/weapons/swords_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/weapons/swords_righthand.dmi'
|
||||
@@ -192,9 +198,9 @@
|
||||
embedding = list("embed_chance" = 75, "impact_pain_mult" = 10)
|
||||
|
||||
/obj/item/melee/energy/sword/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK, damage_type = BRUTE)
|
||||
if(blade_active)
|
||||
return ..()
|
||||
return FALSE
|
||||
if(!HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE))
|
||||
return FALSE
|
||||
return ..()
|
||||
|
||||
/obj/item/melee/energy/sword/cyborg
|
||||
name = "cyborg energy sword"
|
||||
@@ -207,14 +213,14 @@
|
||||
return
|
||||
|
||||
var/obj/item/stock_parts/cell/our_cell = user.cell
|
||||
if(blade_active && !(our_cell.use(hitcost)))
|
||||
if(HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE) && !(our_cell.use(hitcost)))
|
||||
attack_self(user)
|
||||
to_chat(user, span_notice("It's out of charge!"))
|
||||
return
|
||||
return ..()
|
||||
|
||||
/obj/item/melee/energy/sword/cyborg/cyborg_unequip(mob/user)
|
||||
if(!blade_active)
|
||||
if(!HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE))
|
||||
return
|
||||
attack_self(user)
|
||||
|
||||
@@ -246,7 +252,7 @@
|
||||
"blue" = LIGHT_COLOR_LIGHT_CYAN,
|
||||
"green" = LIGHT_COLOR_GREEN,
|
||||
"purple" = LIGHT_COLOR_LAVENDER,
|
||||
)
|
||||
)
|
||||
/// Whether this saber has been multitooled.
|
||||
var/hacked = FALSE
|
||||
var/hacked_color
|
||||
@@ -261,19 +267,22 @@
|
||||
|
||||
/obj/item/melee/energy/sword/saber/process()
|
||||
. = ..()
|
||||
if(blade_active && hacked)
|
||||
if(!LAZYLEN(possible_sword_colors))
|
||||
possible_sword_colors = list(
|
||||
"red" = COLOR_SOFT_RED,
|
||||
"blue" = LIGHT_COLOR_LIGHT_CYAN,
|
||||
"green" = LIGHT_COLOR_GREEN,
|
||||
"purple" = LIGHT_COLOR_LAVENDER,
|
||||
)
|
||||
possible_sword_colors -= hacked_color
|
||||
hacked_color = pick(possible_sword_colors)
|
||||
set_light_color(possible_sword_colors[hacked_color])
|
||||
if(!HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE) || !hacked)
|
||||
return
|
||||
|
||||
if(!LAZYLEN(possible_sword_colors))
|
||||
possible_sword_colors = list(
|
||||
"red" = COLOR_SOFT_RED,
|
||||
"blue" = LIGHT_COLOR_LIGHT_CYAN,
|
||||
"green" = LIGHT_COLOR_GREEN,
|
||||
"purple" = LIGHT_COLOR_LAVENDER,
|
||||
)
|
||||
possible_sword_colors -= hacked_color
|
||||
|
||||
hacked_color = pick(possible_sword_colors)
|
||||
set_light_color(possible_sword_colors[hacked_color])
|
||||
possible_sword_colors -= hacked_color
|
||||
|
||||
/obj/item/melee/energy/sword/saber/red
|
||||
sword_color_icon = "red"
|
||||
|
||||
@@ -293,16 +302,14 @@
|
||||
hacked = TRUE
|
||||
sword_color_icon = "rainbow"
|
||||
to_chat(user, span_warning("RNBW_ENGAGE"))
|
||||
if(force >= active_force)
|
||||
icon_state = "[initial(icon_state)]_on_rainbow"
|
||||
inhand_icon_state = "[initial(inhand_icon_state)]_on_rainbow"
|
||||
user.update_held_items()
|
||||
update_appearance(UPDATE_ICON_STATE)
|
||||
|
||||
/obj/item/melee/energy/sword/pirate
|
||||
name = "energy cutlass"
|
||||
desc = "Arrrr matey."
|
||||
icon_state = "e_cutlass"
|
||||
inhand_icon_state = "e_cutlass"
|
||||
base_icon_state = "e_cutlass"
|
||||
lefthand_file = 'icons/mob/inhands/weapons/swords_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/weapons/swords_righthand.dmi'
|
||||
light_color = COLOR_RED
|
||||
@@ -312,6 +319,7 @@
|
||||
name = "energy blade"
|
||||
desc = "A concentrated beam of energy in the shape of a blade. Very stylish... and lethal."
|
||||
icon_state = "blade"
|
||||
base_icon_state = "blade"
|
||||
lefthand_file = 'icons/mob/inhands/weapons/swords_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/weapons/swords_righthand.dmi'
|
||||
hitsound = 'sound/weapons/blade1.ogg'
|
||||
@@ -324,7 +332,6 @@
|
||||
sharpness = SHARP_EDGED
|
||||
heat = 3500
|
||||
w_class = WEIGHT_CLASS_BULKY
|
||||
blade_active = TRUE
|
||||
/// Our linked spark system that emits from our sword.
|
||||
var/datum/effect_system/spark_spread/spark_system
|
||||
|
||||
@@ -335,6 +342,7 @@
|
||||
spark_system.set_up(5, 0, src)
|
||||
spark_system.attach(src)
|
||||
START_PROCESSING(SSobj, src)
|
||||
ADD_TRAIT(src, TRAIT_TRANSFORM_ACTIVE, INNATE_TRAIT) // Functions as an extended esword
|
||||
|
||||
/obj/item/melee/energy/blade/Destroy()
|
||||
QDEL_NULL(spark_system)
|
||||
@@ -348,3 +356,4 @@
|
||||
desc = "An extremely sharp blade made out of hard light. Packs quite a punch."
|
||||
icon_state = "lightblade"
|
||||
inhand_icon_state = "lightblade"
|
||||
base_icon_state = "lightblade"
|
||||
|
||||
@@ -355,14 +355,13 @@
|
||||
var/static/list/ovens
|
||||
/// The beam that links to the oven we use
|
||||
var/datum/beam/beam
|
||||
/// Whether or stick is extended and can recieve sausage
|
||||
var/extended = FALSE
|
||||
|
||||
/obj/item/melee/roastingstick/Initialize(mapload)
|
||||
. = ..()
|
||||
if (!ovens)
|
||||
ovens = typecacheof(list(/obj/singularity, /obj/energy_ball, /obj/machinery/power/supermatter_crystal, /obj/structure/bonfire))
|
||||
AddComponent(/datum/component/transforming, \
|
||||
AddComponent( \
|
||||
/datum/component/transforming, \
|
||||
hitsound_on = hitsound, \
|
||||
clumsy_check = FALSE, \
|
||||
inhand_icon_change = FALSE, \
|
||||
@@ -390,16 +389,16 @@
|
||||
/obj/item/melee/roastingstick/proc/on_transform(obj/item/source, mob/user, active)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
extended = active
|
||||
inhand_icon_state = active ? "nullrod" : null
|
||||
balloon_alert(user, "[active ? "extended" : "collapsed"] [src]")
|
||||
playsound(user ? user : src, 'sound/weapons/batonextend.ogg', 50, TRUE)
|
||||
if(user)
|
||||
balloon_alert(user, "[active ? "extended" : "collapsed"] [src]")
|
||||
playsound(src, 'sound/weapons/batonextend.ogg', 50, TRUE)
|
||||
return COMPONENT_NO_DEFAULT_MESSAGE
|
||||
|
||||
/obj/item/melee/roastingstick/attackby(atom/target, mob/user)
|
||||
..()
|
||||
if (istype(target, /obj/item/food/sausage))
|
||||
if (!extended)
|
||||
if (!HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE))
|
||||
to_chat(user, span_warning("You must extend [src] to attach anything to it!"))
|
||||
return
|
||||
if (held_sausage)
|
||||
@@ -430,7 +429,7 @@
|
||||
|
||||
/obj/item/melee/roastingstick/afterattack(atom/target, mob/user, proximity)
|
||||
. = ..()
|
||||
if (!extended)
|
||||
if (!HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE))
|
||||
return
|
||||
if (!is_type_in_typecache(target, ovens))
|
||||
return
|
||||
|
||||
@@ -244,8 +244,6 @@
|
||||
throw_speed = 3
|
||||
breakable_by_damage = FALSE
|
||||
block_sound = 'sound/weapons/block_blade.ogg'
|
||||
/// Whether the shield is currently extended and protecting the user.
|
||||
var/enabled = FALSE
|
||||
/// Force of the shield when active.
|
||||
var/active_force = 10
|
||||
/// Throwforce of the shield when active.
|
||||
@@ -257,19 +255,21 @@
|
||||
|
||||
/obj/item/shield/energy/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/transforming, \
|
||||
AddComponent( \
|
||||
/datum/component/transforming, \
|
||||
force_on = active_force, \
|
||||
throwforce_on = active_throwforce, \
|
||||
throw_speed_on = active_throw_speed, \
|
||||
hitsound_on = hitsound, \
|
||||
clumsy_check = !can_clumsy_use)
|
||||
clumsy_check = !can_clumsy_use, \
|
||||
)
|
||||
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, PROC_REF(on_transform))
|
||||
|
||||
/obj/item/shield/energy/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK, damage_type = BRUTE)
|
||||
return FALSE
|
||||
|
||||
/obj/item/shield/energy/IsReflect()
|
||||
return enabled
|
||||
return HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE)
|
||||
|
||||
/*
|
||||
* Signal proc for [COMSIG_TRANSFORMING_ON_TRANSFORM].
|
||||
@@ -277,10 +277,9 @@
|
||||
/obj/item/shield/energy/proc/on_transform(obj/item/source, mob/user, active)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
enabled = active
|
||||
|
||||
balloon_alert(user, "[active ? "activated":"deactivated"]")
|
||||
playsound(user ? user : src, active ? 'sound/weapons/saberon.ogg' : 'sound/weapons/saberoff.ogg', 35, TRUE)
|
||||
if(user)
|
||||
balloon_alert(user, active ? "activated" : "deactivated")
|
||||
playsound(src, active ? 'sound/weapons/saberon.ogg' : 'sound/weapons/saberoff.ogg', 35, TRUE)
|
||||
return COMPONENT_NO_DEFAULT_MESSAGE
|
||||
|
||||
/obj/item/shield/riot/tele
|
||||
@@ -296,27 +295,28 @@
|
||||
throw_speed = 3
|
||||
throw_range = 4
|
||||
w_class = WEIGHT_CLASS_NORMAL
|
||||
/// Whether the shield is extended and protecting the user..
|
||||
var/extended = FALSE
|
||||
|
||||
/obj/item/shield/riot/tele/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/transforming, \
|
||||
AddComponent( \
|
||||
/datum/component/transforming, \
|
||||
force_on = 8, \
|
||||
throwforce_on = 5, \
|
||||
throw_speed_on = 2, \
|
||||
hitsound_on = hitsound, \
|
||||
w_class_on = WEIGHT_CLASS_BULKY, \
|
||||
attack_verb_continuous_on = list("smacks", "strikes", "cracks", "beats"), \
|
||||
attack_verb_simple_on = list("smack", "strike", "crack", "beat"))
|
||||
attack_verb_simple_on = list("smack", "strike", "crack", "beat"), \
|
||||
)
|
||||
|
||||
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, PROC_REF(on_transform))
|
||||
|
||||
/obj/item/shield/riot/tele/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK, damage_type = BRUTE)
|
||||
if(extended)
|
||||
if(HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE))
|
||||
return ..()
|
||||
return FALSE
|
||||
|
||||
/*
|
||||
/**
|
||||
* Signal proc for [COMSIG_TRANSFORMING_ON_TRANSFORM].
|
||||
*
|
||||
* Allows it to be placed on back slot when active.
|
||||
@@ -324,10 +324,10 @@
|
||||
/obj/item/shield/riot/tele/proc/on_transform(obj/item/source, mob/user, active)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
extended = active
|
||||
slot_flags = active ? ITEM_SLOT_BACK : null
|
||||
playsound(user ? user : src, 'sound/weapons/batonextend.ogg', 50, TRUE)
|
||||
balloon_alert(user, "[active ? "extended" : "collapsed"]")
|
||||
if(user)
|
||||
balloon_alert(user, active ? "extended" : "collapsed")
|
||||
playsound(src, 'sound/weapons/batonextend.ogg', 50, TRUE)
|
||||
return COMPONENT_NO_DEFAULT_MESSAGE
|
||||
|
||||
#undef BATON_BASH_COOLDOWN
|
||||
|
||||
@@ -109,7 +109,8 @@
|
||||
|
||||
/obj/item/crowbar/power/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/transforming, \
|
||||
AddComponent( \
|
||||
/datum/component/transforming, \
|
||||
force_on = force, \
|
||||
throwforce_on = throwforce, \
|
||||
hitsound_on = hitsound, \
|
||||
@@ -128,8 +129,9 @@
|
||||
SIGNAL_HANDLER
|
||||
|
||||
tool_behaviour = (active ? TOOL_WIRECUTTER : TOOL_CROWBAR)
|
||||
balloon_alert(user, "attached [active ? "cutting" : "prying"]")
|
||||
playsound(user ? user : src, 'sound/items/change_jaws.ogg', 50, TRUE)
|
||||
if(user)
|
||||
balloon_alert(user, "attached [active ? "cutting" : "prying"]")
|
||||
playsound(src, 'sound/items/change_jaws.ogg', 50, TRUE)
|
||||
if(tool_behaviour == TOOL_CROWBAR)
|
||||
RemoveElement(/datum/element/cuffsnapping, snap_time_weak_handcuffs, snap_time_strong_handcuffs)
|
||||
else
|
||||
|
||||
@@ -103,7 +103,8 @@
|
||||
|
||||
/obj/item/screwdriver/power/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/transforming, \
|
||||
AddComponent( \
|
||||
/datum/component/transforming, \
|
||||
force_on = force, \
|
||||
throwforce_on = throwforce, \
|
||||
hitsound_on = hitsound, \
|
||||
@@ -122,8 +123,9 @@
|
||||
SIGNAL_HANDLER
|
||||
|
||||
tool_behaviour = (active ? TOOL_WRENCH : TOOL_SCREWDRIVER)
|
||||
balloon_alert(user, "attached [active ? "bolt bit" : "screw bit"]")
|
||||
playsound(user ? user : src, 'sound/items/change_drill.ogg', 50, TRUE)
|
||||
if(user)
|
||||
balloon_alert(user, "attached [active ? "bolt bit" : "screw bit"]")
|
||||
playsound(src, 'sound/items/change_drill.ogg', 50, TRUE)
|
||||
return COMPONENT_NO_DEFAULT_MESSAGE
|
||||
|
||||
/obj/item/screwdriver/power/examine()
|
||||
|
||||
@@ -103,12 +103,14 @@
|
||||
|
||||
/obj/item/wrench/combat/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/transforming, \
|
||||
AddComponent( \
|
||||
/datum/component/transforming, \
|
||||
force_on = 6, \
|
||||
throwforce_on = 8, \
|
||||
hitsound_on = hitsound, \
|
||||
w_class_on = WEIGHT_CLASS_NORMAL, \
|
||||
clumsy_check = FALSE)
|
||||
clumsy_check = FALSE, \
|
||||
)
|
||||
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, PROC_REF(on_transform))
|
||||
|
||||
/*
|
||||
@@ -119,15 +121,10 @@
|
||||
/obj/item/wrench/combat/proc/on_transform(obj/item/source, mob/user, active)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if(active)
|
||||
tool_behaviour = TOOL_WRENCH
|
||||
toolspeed = 1
|
||||
else
|
||||
tool_behaviour = initial(tool_behaviour)
|
||||
toolspeed = initial(toolspeed)
|
||||
|
||||
balloon_alert(user, "[name] [active ? "active, woe!":"restrained"]")
|
||||
playsound(user ? user : src, active ? 'sound/weapons/saberon.ogg' : 'sound/weapons/saberoff.ogg', 5, TRUE)
|
||||
tool_behaviour = active ? TOOL_WRENCH : initial(tool_behaviour)
|
||||
if(user)
|
||||
balloon_alert(user, "[name] [active ? "active, woe!":"restrained"]")
|
||||
playsound(src, active ? 'sound/weapons/saberon.ogg' : 'sound/weapons/saberoff.ogg', 5, TRUE)
|
||||
return COMPONENT_NO_DEFAULT_MESSAGE
|
||||
|
||||
/obj/item/wrench/bolter
|
||||
|
||||
@@ -409,7 +409,8 @@
|
||||
|
||||
/obj/item/toy/sword/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/transforming, \
|
||||
AddComponent( \
|
||||
/datum/component/transforming, \
|
||||
throw_speed_on = throw_speed, \
|
||||
hitsound_on = hitsound, \
|
||||
clumsy_check = FALSE, \
|
||||
@@ -432,8 +433,11 @@
|
||||
*/
|
||||
/obj/item/toy/sword/proc/on_transform(obj/item/source, mob/user, active)
|
||||
SIGNAL_HANDLER
|
||||
balloon_alert(user, "[active ? "flicked out":"pushed in"] [src]")
|
||||
playsound(user ? user : src, active ? 'sound/weapons/saberon.ogg' : 'sound/weapons/saberoff.ogg', 20, TRUE)
|
||||
|
||||
if(user)
|
||||
balloon_alert(user, "[active ? "flicked out":"pushed in"] [src]")
|
||||
|
||||
playsound(src, active ? 'sound/weapons/saberon.ogg' : 'sound/weapons/saberoff.ogg', 20, TRUE)
|
||||
update_appearance(UPDATE_ICON)
|
||||
return COMPONENT_NO_DEFAULT_MESSAGE
|
||||
|
||||
@@ -464,9 +468,7 @@
|
||||
|
||||
/obj/item/toy/sword/update_icon_state()
|
||||
. = ..()
|
||||
var/datum/component/transforming/transforming_comp = GetComponent(/datum/component/transforming)
|
||||
var/active = transforming_comp?.active
|
||||
var/last_part = active ? "_on[saber_color ? "_[saber_color]" : null]" : null
|
||||
var/last_part = HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE) ? "_on[saber_color ? "_[saber_color]" : null]" : null
|
||||
icon_state = "[initial(icon_state)][last_part]"
|
||||
inhand_icon_state = "[initial(inhand_icon_state)][last_part]"
|
||||
|
||||
|
||||
@@ -428,7 +428,8 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301
|
||||
effectiveness = 100, \
|
||||
)
|
||||
|
||||
AddComponent(/datum/component/transforming, \
|
||||
AddComponent( \
|
||||
/datum/component/transforming, \
|
||||
start_transformed = start_extended, \
|
||||
force_on = 20, \
|
||||
throwforce_on = 23, \
|
||||
@@ -503,13 +504,15 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301
|
||||
|
||||
/obj/item/cane/white/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/transforming, \
|
||||
AddComponent( \
|
||||
/datum/component/transforming, \
|
||||
force_on = 7, \
|
||||
hitsound_on = hitsound, \
|
||||
w_class_on = WEIGHT_CLASS_BULKY, \
|
||||
clumsy_check = FALSE, \
|
||||
attack_verb_continuous_on = list("smacks", "strikes", "cracks", "beats"), \
|
||||
attack_verb_simple_on = list("smack", "strike", "crack", "beat"))
|
||||
attack_verb_simple_on = list("smack", "strike", "crack", "beat"), \
|
||||
)
|
||||
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, PROC_REF(on_transform))
|
||||
ADD_TRAIT(src, TRAIT_BLIND_TOOL, INNATE_TRAIT)
|
||||
|
||||
@@ -521,8 +524,9 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301
|
||||
/obj/item/cane/white/proc/on_transform(obj/item/source, mob/user, active)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
balloon_alert(user, active ? "extended" : "collapsed")
|
||||
playsound(user ? user : src, 'sound/weapons/batonextend.ogg', 50, TRUE)
|
||||
if(user)
|
||||
balloon_alert(user, active ? "extended" : "collapsed")
|
||||
playsound(src, 'sound/weapons/batonextend.ogg', 50, TRUE)
|
||||
return COMPONENT_NO_DEFAULT_MESSAGE
|
||||
|
||||
/obj/item/staff
|
||||
|
||||
@@ -99,11 +99,13 @@
|
||||
COOLDOWN_DECLARE(next_trombone_allowed)
|
||||
|
||||
/obj/item/melee/energy/sword/bananium/make_transformable()
|
||||
AddComponent(/datum/component/transforming, \
|
||||
AddComponent( \
|
||||
/datum/component/transforming, \
|
||||
throw_speed_on = 4, \
|
||||
attack_verb_continuous_on = list("slips"), \
|
||||
attack_verb_simple_on = list("slip"), \
|
||||
clumsy_check = FALSE)
|
||||
clumsy_check = FALSE, \
|
||||
)
|
||||
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, PROC_REF(on_transform))
|
||||
|
||||
/obj/item/melee/energy/sword/bananium/on_transform(obj/item/source, mob/user, active)
|
||||
@@ -114,20 +116,20 @@
|
||||
* Adds or removes a slippery component, depending on whether the sword is active or not.
|
||||
*/
|
||||
/obj/item/melee/energy/sword/bananium/proc/adjust_slipperiness()
|
||||
if(blade_active)
|
||||
if(HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE))
|
||||
AddComponent(/datum/component/slippery, 60, GALOSHES_DONT_HELP)
|
||||
else
|
||||
qdel(GetComponent(/datum/component/slippery))
|
||||
|
||||
/obj/item/melee/energy/sword/bananium/attack(mob/living/M, mob/living/user)
|
||||
. = ..()
|
||||
if(blade_active)
|
||||
if(HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE))
|
||||
var/datum/component/slippery/slipper = GetComponent(/datum/component/slippery)
|
||||
slipper.Slip(src, M)
|
||||
|
||||
/obj/item/melee/energy/sword/bananium/throw_impact(atom/hit_atom, throwingdatum)
|
||||
. = ..()
|
||||
if(blade_active)
|
||||
if(HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE))
|
||||
var/datum/component/slippery/slipper = GetComponent(/datum/component/slippery)
|
||||
slipper.Slip(src, hit_atom)
|
||||
|
||||
@@ -140,7 +142,7 @@
|
||||
return ..()
|
||||
|
||||
/obj/item/melee/energy/sword/bananium/suicide_act(mob/living/user)
|
||||
if(!blade_active)
|
||||
if(!HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE))
|
||||
attack_self(user)
|
||||
user.visible_message(span_suicide("[user] is [pick("slitting [user.p_their()] stomach open with", "falling on")] [src]! It looks like [user.p_theyre()] trying to commit seppuku, but the blade slips off of [user.p_them()] harmlessly!"))
|
||||
var/datum/component/slippery/slipper = GetComponent(/datum/component/slippery)
|
||||
@@ -172,7 +174,7 @@
|
||||
* Adds or removes a slippery and boomerang component, depending on whether the shield is active or not.
|
||||
*/
|
||||
/obj/item/shield/energy/bananium/proc/adjust_comedy()
|
||||
if(enabled)
|
||||
if(HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE))
|
||||
AddComponent(/datum/component/slippery, 60, GALOSHES_DONT_HELP)
|
||||
AddComponent(/datum/component/boomerang, throw_range+2, TRUE)
|
||||
else
|
||||
@@ -180,7 +182,7 @@
|
||||
qdel(GetComponent(/datum/component/boomerang))
|
||||
|
||||
/obj/item/shield/energy/bananium/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum)
|
||||
if(enabled)
|
||||
if(HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE))
|
||||
var/caught = hit_atom.hitby(src, FALSE, FALSE, throwingdatum=throwingdatum)
|
||||
if(iscarbon(hit_atom) && !caught)//if they are a carbon and they didn't catch it
|
||||
var/datum/component/slippery/slipper = GetComponent(/datum/component/slippery)
|
||||
|
||||
@@ -848,8 +848,6 @@
|
||||
hitsound = 'sound/weapons/bladeslice.ogg'
|
||||
w_class = WEIGHT_CLASS_BULKY
|
||||
sharpness = SHARP_EDGED
|
||||
/// Whether the saw is open or not
|
||||
var/is_open = FALSE
|
||||
/// List of factions we deal bonus damage to
|
||||
var/list/nemesis_factions = list(FACTION_MINING, FACTION_BOSS)
|
||||
/// Amount of damage we deal to the above factions
|
||||
@@ -865,7 +863,8 @@
|
||||
|
||||
/obj/item/melee/cleaving_saw/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/transforming, \
|
||||
AddComponent( \
|
||||
/datum/component/transforming, \
|
||||
transform_cooldown_time = (CLICK_CD_MELEE * 0.25), \
|
||||
force_on = open_force, \
|
||||
throwforce_on = open_throwforce, \
|
||||
@@ -873,26 +872,28 @@
|
||||
hitsound_on = hitsound, \
|
||||
w_class_on = w_class, \
|
||||
attack_verb_continuous_on = list("cleaves", "swipes", "slashes", "chops"), \
|
||||
attack_verb_simple_on = list("cleave", "swipe", "slash", "chop"))
|
||||
attack_verb_simple_on = list("cleave", "swipe", "slash", "chop"), \
|
||||
)
|
||||
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, PROC_REF(on_transform))
|
||||
|
||||
/obj/item/melee/cleaving_saw/examine(mob/user)
|
||||
. = ..()
|
||||
. += span_notice("It is [is_open ? "open, will cleave enemies in a wide arc and deal additional damage to fauna":"closed, and can be used for rapid consecutive attacks that cause fauna to bleed"].")
|
||||
. += span_notice("It is [HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE) ? "open, will cleave enemies in a wide arc and deal additional damage to fauna":"closed, and can be used for rapid consecutive attacks that cause fauna to bleed"].")
|
||||
. += span_notice("Both modes will build up existing bleed effects, doing a burst of high damage if the bleed is built up high enough.")
|
||||
. += span_notice("Transforming it immediately after an attack causes the next attack to come out faster.")
|
||||
|
||||
/obj/item/melee/cleaving_saw/suicide_act(mob/living/user)
|
||||
user.visible_message(span_suicide("[user] is [is_open ? "closing [src] on [user.p_their()] neck" : "opening [src] into [user.p_their()] chest"]! It looks like [user.p_theyre()] trying to commit suicide!"))
|
||||
user.visible_message(span_suicide("[user] is [HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE) ? "closing [src] on [user.p_their()] neck" : "opening [src] into [user.p_their()] chest"]! It looks like [user.p_theyre()] trying to commit suicide!"))
|
||||
attack_self(user)
|
||||
return BRUTELOSS
|
||||
|
||||
/obj/item/melee/cleaving_saw/melee_attack_chain(mob/user, atom/target, params)
|
||||
. = ..()
|
||||
if(!is_open)
|
||||
if(!HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE))
|
||||
user.changeNext_move(CLICK_CD_MELEE * 0.5) //when closed, it attacks very rapidly
|
||||
|
||||
/obj/item/melee/cleaving_saw/attack(mob/living/target, mob/living/carbon/human/user)
|
||||
var/is_open = HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE)
|
||||
if(!is_open || swiping || !target.density || get_turf(target) == get_turf(user))
|
||||
if(!is_open)
|
||||
faction_bonus_force = 0
|
||||
@@ -943,11 +944,10 @@
|
||||
/obj/item/melee/cleaving_saw/proc/on_transform(obj/item/source, mob/user, active)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
is_open = active
|
||||
user.changeNext_move(CLICK_CD_MELEE * 0.25)
|
||||
|
||||
balloon_alert(user, "[active ? "opened":"closed"] [src]")
|
||||
playsound(user ? user : src, 'sound/magic/clockwork/fellowship_armory.ogg', 35, TRUE, frequency = 90000 - (is_open * 30000))
|
||||
if(user)
|
||||
balloon_alert(user, "[active ? "opened" : "closed"] [src]")
|
||||
playsound(src, 'sound/magic/clockwork/fellowship_armory.ogg', 35, TRUE, frequency = 90000 - (active * 30000))
|
||||
return COMPONENT_NO_DEFAULT_MESSAGE
|
||||
|
||||
//Legion: Staff of Storms
|
||||
|
||||
@@ -268,8 +268,6 @@
|
||||
var/hidden_desc = "It's a normal black ink pe- Wait. That's a thing used to stab people!"
|
||||
/// The real icons used when extended.
|
||||
var/hidden_icon = "edagger"
|
||||
/// Whether or pen is extended
|
||||
var/extended = FALSE
|
||||
|
||||
/obj/item/pen/edagger/Initialize(mapload)
|
||||
. = ..()
|
||||
@@ -277,7 +275,8 @@
|
||||
speed = 6 SECONDS, \
|
||||
butcher_sound = 'sound/weapons/blade1.ogg', \
|
||||
)
|
||||
AddComponent(/datum/component/transforming, \
|
||||
AddComponent( \
|
||||
/datum/component/transforming, \
|
||||
force_on = 18, \
|
||||
throwforce_on = 35, \
|
||||
throw_speed_on = 4, \
|
||||
@@ -289,7 +288,7 @@
|
||||
RegisterSignal(src, COMSIG_DETECTIVE_SCANNED, PROC_REF(on_scan))
|
||||
|
||||
/obj/item/pen/edagger/suicide_act(mob/living/user)
|
||||
if(extended)
|
||||
if(HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE))
|
||||
user.visible_message(span_suicide("[user] forcefully rams the pen into their mouth!"))
|
||||
else
|
||||
user.visible_message(span_suicide("[user] is holding a pen up to their mouth! It looks like [user.p_theyre()] trying to commit suicide!"))
|
||||
@@ -305,7 +304,6 @@
|
||||
/obj/item/pen/edagger/proc/on_transform(obj/item/source, mob/user, active)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
extended = active
|
||||
if(active)
|
||||
name = hidden_name
|
||||
desc = hidden_desc
|
||||
@@ -324,8 +322,9 @@
|
||||
embedding = list(embed_chance = EMBED_CHANCE)
|
||||
|
||||
updateEmbedding()
|
||||
balloon_alert(user, "[hidden_name] [active ? "active":"concealed"]")
|
||||
playsound(user ? user : src, active ? 'sound/weapons/saberon.ogg' : 'sound/weapons/saberoff.ogg', 5, TRUE)
|
||||
if(user)
|
||||
balloon_alert(user, "[hidden_name] [active ? "active" : "concealed"]")
|
||||
playsound(src, active ? 'sound/weapons/saberon.ogg' : 'sound/weapons/saberoff.ogg', 5, TRUE)
|
||||
set_light_on(active)
|
||||
return COMPONENT_NO_DEFAULT_MESSAGE
|
||||
|
||||
@@ -363,12 +362,11 @@
|
||||
desc = "A pen with an extendable screwdriver tip. This one has a yellow cap."
|
||||
icon_state = "pendriver"
|
||||
toolspeed = 1.2 // gotta have some downside
|
||||
/// whether the pen is extended
|
||||
var/extended = FALSE
|
||||
|
||||
/obj/item/pen/screwdriver/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/transforming, \
|
||||
AddComponent( \
|
||||
/datum/component/transforming, \
|
||||
throwforce_on = 5, \
|
||||
w_class_on = WEIGHT_CLASS_SMALL, \
|
||||
sharpness_on = TRUE, \
|
||||
@@ -378,24 +376,14 @@
|
||||
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, PROC_REF(toggle_screwdriver))
|
||||
AddElement(/datum/element/update_icon_updates_onmob)
|
||||
|
||||
|
||||
/obj/item/pen/screwdriver/vv_edit_var(var_name, var_value)
|
||||
if(var_name == NAMEOF(src, extended))
|
||||
if(var_value != extended)
|
||||
var/datum/component/transforming/transforming_comp = GetComponent(/datum/component/transforming)
|
||||
transforming_comp.on_attack_self(src)
|
||||
datum_flags |= DF_VAR_EDITED
|
||||
return
|
||||
return ..()
|
||||
|
||||
/obj/item/pen/screwdriver/proc/toggle_screwdriver(obj/item/source, mob/user, active)
|
||||
SIGNAL_HANDLER
|
||||
extended = active
|
||||
|
||||
if(user)
|
||||
balloon_alert(user, "[extended ? "extended" : "retracted"]")
|
||||
balloon_alert(user, active ? "extended" : "retracted")
|
||||
playsound(src, 'sound/weapons/batonextend.ogg', 50, TRUE)
|
||||
|
||||
if(!extended)
|
||||
if(!active)
|
||||
tool_behaviour = initial(tool_behaviour)
|
||||
RemoveElement(/datum/element/eyestab)
|
||||
else
|
||||
@@ -407,5 +395,5 @@
|
||||
|
||||
/obj/item/pen/screwdriver/update_icon_state()
|
||||
. = ..()
|
||||
icon_state = "[initial(icon_state)][extended ? "_out":null]"
|
||||
icon_state = "[initial(icon_state)][HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE) ? "_out" : null]"
|
||||
inhand_icon_state = initial(inhand_icon_state) //since transforming component switches the icon.
|
||||
|
||||
@@ -193,7 +193,7 @@
|
||||
|
||||
else if(istype(item, /obj/item/boxcutter))
|
||||
var/obj/item/boxcutter/boxcutter_item = item
|
||||
if(boxcutter_item.on)
|
||||
if(HAS_TRAIT(boxcutter_item, TRAIT_TRANSFORM_ACTIVE))
|
||||
if(!attempt_pre_unwrap_contents(user, time = 0.5 SECONDS))
|
||||
return
|
||||
unwrap_contents()
|
||||
|
||||
@@ -82,12 +82,14 @@
|
||||
|
||||
/obj/item/cautery/advanced/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/transforming, \
|
||||
AddComponent( \
|
||||
/datum/component/transforming, \
|
||||
force_on = force, \
|
||||
throwforce_on = throwforce, \
|
||||
hitsound_on = hitsound, \
|
||||
w_class_on = w_class, \
|
||||
clumsy_check = FALSE)
|
||||
clumsy_check = FALSE, \
|
||||
)
|
||||
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, PROC_REF(on_transform))
|
||||
|
||||
/*
|
||||
@@ -331,14 +333,16 @@
|
||||
|
||||
/obj/item/scalpel/advanced/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/transforming, \
|
||||
AddComponent( \
|
||||
/datum/component/transforming, \
|
||||
force_on = force + 1, \
|
||||
throwforce_on = throwforce, \
|
||||
throw_speed_on = throw_speed, \
|
||||
sharpness_on = sharpness, \
|
||||
hitsound_on = hitsound, \
|
||||
w_class_on = w_class, \
|
||||
clumsy_check = FALSE)
|
||||
clumsy_check = FALSE, \
|
||||
)
|
||||
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, PROC_REF(on_transform))
|
||||
|
||||
/*
|
||||
@@ -378,12 +382,14 @@
|
||||
|
||||
/obj/item/retractor/advanced/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/transforming, \
|
||||
AddComponent( \
|
||||
/datum/component/transforming, \
|
||||
force_on = force, \
|
||||
throwforce_on = throwforce, \
|
||||
hitsound_on = hitsound, \
|
||||
w_class_on = w_class, \
|
||||
clumsy_check = FALSE)
|
||||
clumsy_check = FALSE, \
|
||||
)
|
||||
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, PROC_REF(on_transform))
|
||||
|
||||
/*
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 23 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 26 KiB |
Reference in New Issue
Block a user