From 8ef68fa36b2fc220c44752d8e007584739e2fb27 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Fri, 28 Feb 2020 13:35:41 -0700 Subject: [PATCH 1/8] En garde! --- code/__DEFINES/components.dm | 1 + code/datums/elements/sword_point.dm | 18 ++++++++++++++ code/game/objects/items/melee/energy.dm | 5 +++- code/game/objects/items/melee/misc.dm | 1 + code/game/objects/items/twohanded.dm | 25 ++++++++++---------- code/game/objects/items/weaponry.dm | 1 + code/modules/antagonists/cult/cult_items.dm | 1 + modular_citadel/code/_onclick/item_attack.dm | 1 + tgstation.dme | 3 ++- 9 files changed, 41 insertions(+), 15 deletions(-) create mode 100644 code/datums/elements/sword_point.dm diff --git a/code/__DEFINES/components.dm b/code/__DEFINES/components.dm index 78cc872c62..1f83477b72 100644 --- a/code/__DEFINES/components.dm +++ b/code/__DEFINES/components.dm @@ -232,6 +232,7 @@ #define COMSIG_ITEM_PRE_ATTACK "item_pre_attack" //from base of obj/item/pre_attack(): (atom/target, mob/user, params) #define COMPONENT_NO_ATTACK 1 #define COMSIG_ITEM_AFTERATTACK "item_afterattack" //from base of obj/item/afterattack(): (atom/target, mob/user, params) +#define COMSIG_ITEM_ALT_AFTERATTACK "item_alt_afterattack" //from base of obj/item/altafterattack(): (atom/target, mob/user, proximity, params) #define COMSIG_ITEM_EQUIPPED "item_equip" //from base of obj/item/equipped(): (/mob/equipper, slot) #define COMSIG_ITEM_DROPPED "item_drop" //from base of obj/item/dropped(): (mob/user) #define COMSIG_ITEM_PICKUP "item_pickup" //from base of obj/item/pickup(): (/mob/taker) diff --git a/code/datums/elements/sword_point.dm b/code/datums/elements/sword_point.dm new file mode 100644 index 0000000000..29da3781ae --- /dev/null +++ b/code/datums/elements/sword_point.dm @@ -0,0 +1,18 @@ +/datum/element/sword_point + element_flags = ELEMENT_DETACH + +/datum/element/sword_point/Attach(datum/target) + . = ..() + if(. == ELEMENT_INCOMPATIBLE) + return + if(!istype(target)) + return ELEMENT_INCOMPATIBLE + RegisterSignal(target, COMSIG_ITEM_ALT_AFTERATTACK, .proc/point) + +/datum/element/sword_point/Detach(datum/source) + . = ..() + UnregisterSignal(source, COMSIG_ITEM_ALT_AFTERATTACK) + +/datum/element/sword_point/proc/point(datum/source, atom/target, mob/user, proximity_flag, params) + if(!proximity_flag && ismob(target)) + user.visible_message("[user] points the tip of [source] at [target]!") diff --git a/code/game/objects/items/melee/energy.dm b/code/game/objects/items/melee/energy.dm index 3ca489542f..9861304960 100644 --- a/code/game/objects/items/melee/energy.dm +++ b/code/game/objects/items/melee/energy.dm @@ -7,7 +7,6 @@ var/brightness_on = 3 total_mass = 0.4 //Survival flashlights typically weigh around 5 ounces. - /obj/item/melee/transforming/energy/Initialize() . = ..() total_mass_on = (total_mass_on ? total_mass_on : (w_class_on * 0.75)) @@ -105,6 +104,10 @@ armour_penetration = 35 block_chance = 50 +/obj/item/melee/transforming/energy/sword/Initialize(mapload) + . = ..() + AddElement(/datum/element/sword_point) + /obj/item/melee/transforming/energy/sword/transform_weapon(mob/living/user, supress_message_text) . = ..() if(. && active && item_color) diff --git a/code/game/objects/items/melee/misc.dm b/code/game/objects/items/melee/misc.dm index a71e82d865..9724ed7818 100644 --- a/code/game/objects/items/melee/misc.dm +++ b/code/game/objects/items/melee/misc.dm @@ -73,6 +73,7 @@ /obj/item/melee/sabre/Initialize() . = ..() AddComponent(/datum/component/butchering, 30, 95, 5) //fast and effective, but as a sword, it might damage the results. + AddElement(/datum/element/sword_point) /obj/item/melee/sabre/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) if(attack_type == PROJECTILE_ATTACK) diff --git a/code/game/objects/items/twohanded.dm b/code/game/objects/items/twohanded.dm index 06b81a424d..3fc8e69593 100644 --- a/code/game/objects/items/twohanded.dm +++ b/code/game/objects/items/twohanded.dm @@ -399,6 +399,7 @@ hitsound = 'sound/weapons/blade1.ogg' START_PROCESSING(SSobj, src) set_light(brightness_on) + AddElement(/datum/element/sword_point) /obj/item/twohanded/dualsaber/unwield() //Specific unwield () to switch hitsounds. sharpness = initial(sharpness) @@ -408,6 +409,7 @@ hitsound = "swing_hit" STOP_PROCESSING(SSobj, src) set_light(0) + RemoveElement(/datum/element/sword_point) /obj/item/twohanded/dualsaber/process() if(wielded) @@ -492,6 +494,10 @@ spinnable = FALSE total_mass_on = 4 +/obj/item/twohanded/dualsaber/hypereutactic/Initialize(mapload) + . = ..() + AddElement(/datum/element/sword_point) + /obj/item/twohanded/dualsaber/hypereutactic/chaplain name = "\improper divine lightblade" desc = "A giant blade of bright and holy light, said to cut down the wicked with ease." @@ -510,15 +516,6 @@ /obj/item/twohanded/dualsaber/hypereutactic/chaplain/IsReflect() return FALSE -/obj/item/twohanded/dualsaber/hypereutactic/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/twohanded/dualsaber/hypereutactic/altafterattack(atom/target, mob/living/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/twohanded/dualsaber/hypereutactic/update_icon() var/mutable_appearance/blade_overlay = mutable_appearance(icon, "hypereutactic_blade") var/mutable_appearance/gem_overlay = mutable_appearance(icon, "hypereutactic_gem") @@ -605,6 +602,8 @@ /obj/item/twohanded/spear/Initialize() . = ..() AddComponent(/datum/component/butchering, 100, 70) //decent in a pinch, but pretty bad. + AddComponent(/datum/component/josuting) + AddElement(/datum/element/sword_point) /obj/item/twohanded/spear/attack_self(mob/user) if(explosive) @@ -630,10 +629,6 @@ return BRUTELOSS return BRUTELOSS -/obj/item/twohanded/spear/Initialize() - . = ..() - AddComponent(/datum/component/jousting) - /obj/item/twohanded/spear/examine(mob/user) . = ..() if(explosive) @@ -820,6 +815,9 @@ armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 100, "acid" = 30) resistance_flags = FIRE_PROOF +/obj/item/twohanded/pitchfork/Initialize(mapload) + AddElement(/datum/element/sword_point) + /obj/item/twohanded/pitchfork/demonic name = "demonic pitchfork" desc = "A red pitchfork, it looks like the work of the devil." @@ -903,6 +901,7 @@ /obj/item/twohanded/vibro_weapon/Initialize() . = ..() AddComponent(/datum/component/butchering, 20, 105) + AddElement(/datum/element/sword_point) /obj/item/twohanded/vibro_weapon/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) if(wielded) diff --git a/code/game/objects/items/weaponry.dm b/code/game/objects/items/weaponry.dm index 7499d9de09..7c3a2734b1 100644 --- a/code/game/objects/items/weaponry.dm +++ b/code/game/objects/items/weaponry.dm @@ -74,6 +74,7 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301 /obj/item/claymore/Initialize() . = ..() AddComponent(/datum/component/butchering, 40, 105) + AddElement(/datum/element/sword_point) /obj/item/claymore/suicide_act(mob/user) user.visible_message("[user] is falling on [src]! It looks like [user.p_theyre()] trying to commit suicide!") diff --git a/code/modules/antagonists/cult/cult_items.dm b/code/modules/antagonists/cult/cult_items.dm index f14aeede9a..743d3cfc9a 100644 --- a/code/modules/antagonists/cult/cult_items.dm +++ b/code/modules/antagonists/cult/cult_items.dm @@ -46,6 +46,7 @@ /obj/item/melee/cultblade/Initialize() . = ..() AddComponent(/datum/component/butchering, 40, 100) + AddElement(/datum/element/sword_point) /obj/item/melee/cultblade/attack(mob/living/target, mob/living/carbon/human/user) if(!iscultist(user)) diff --git a/modular_citadel/code/_onclick/item_attack.dm b/modular_citadel/code/_onclick/item_attack.dm index d87b2be661..bba3b14e2e 100644 --- a/modular_citadel/code/_onclick/item_attack.dm +++ b/modular_citadel/code/_onclick/item_attack.dm @@ -16,4 +16,5 @@ return FALSE /obj/item/proc/altafterattack(atom/target, mob/user, proximity_flag, click_parameters) + SEND_SIGNAL(src, COMSIG_ITEM_ALT_AFTERATTACK, target, user, proximity_flag, click_parameters) return FALSE diff --git a/tgstation.dme b/tgstation.dme index 9ecf1ddd5e..b1060ef084 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -79,8 +79,8 @@ #include "code\__DEFINES\obj_flags.dm" #include "code\__DEFINES\pinpointers.dm" #include "code\__DEFINES\pipe_construction.dm" -#include "code\__DEFINES\power.dm" #include "code\__DEFINES\pool.dm" +#include "code\__DEFINES\power.dm" #include "code\__DEFINES\preferences.dm" #include "code\__DEFINES\procpath.dm" #include "code\__DEFINES\profile.dm" @@ -502,6 +502,7 @@ #include "code\datums\elements\ghost_role_eligibility.dm" #include "code\datums\elements\mob_holder.dm" #include "code\datums\elements\swimming.dm" +#include "code\datums\elements\sword_point.dm" #include "code\datums\elements\wuv.dm" #include "code\datums\helper_datums\events.dm" #include "code\datums\helper_datums\getrev.dm" From ba55351e4af3fb851a338a179781aebd8fceaed3 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Fri, 28 Feb 2020 13:43:11 -0700 Subject: [PATCH 2/8] Update twohanded.dm --- code/game/objects/items/twohanded.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/objects/items/twohanded.dm b/code/game/objects/items/twohanded.dm index 2691168d64..a7da5c0210 100644 --- a/code/game/objects/items/twohanded.dm +++ b/code/game/objects/items/twohanded.dm @@ -608,7 +608,7 @@ /obj/item/twohanded/spear/Initialize() . = ..() AddComponent(/datum/component/butchering, 100, 70) //decent in a pinch, but pretty bad. - AddComponent(/datum/component/josuting) + AddComponent(/datum/component/jousting) AddElement(/datum/element/sword_point) /obj/item/twohanded/spear/attack_self(mob/user) From cbf2355f19235e2d1d679561a8cb50835cc9403f Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Tue, 3 Mar 2020 21:06:05 -0700 Subject: [PATCH 3/8] Update code/datums/elements/sword_point.dm Co-Authored-By: Ghom <42542238+Ghommie@users.noreply.github.com> --- code/datums/elements/sword_point.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/elements/sword_point.dm b/code/datums/elements/sword_point.dm index 29da3781ae..5eaa9eaa70 100644 --- a/code/datums/elements/sword_point.dm +++ b/code/datums/elements/sword_point.dm @@ -15,4 +15,4 @@ /datum/element/sword_point/proc/point(datum/source, atom/target, mob/user, proximity_flag, params) if(!proximity_flag && ismob(target)) - user.visible_message("[user] points the tip of [source] at [target]!") + user.visible_message("[user] points the tip of [src] at [target].", "You point the tip of [src] at [target].") From 0cf7f2e8826f784b9f8bc76affc66822c13e344e Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Tue, 3 Mar 2020 21:07:24 -0700 Subject: [PATCH 4/8] Update energy.dm --- code/game/objects/items/melee/energy.dm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/code/game/objects/items/melee/energy.dm b/code/game/objects/items/melee/energy.dm index 94898a3a25..86cbc83891 100644 --- a/code/game/objects/items/melee/energy.dm +++ b/code/game/objects/items/melee/energy.dm @@ -104,14 +104,14 @@ armour_penetration = 35 block_chance = 50 -/obj/item/melee/transforming/energy/sword/Initialize(mapload) - . = ..() - AddElement(/datum/element/sword_point) - /obj/item/melee/transforming/energy/sword/transform_weapon(mob/living/user, supress_message_text) . = ..() - if(. && active && item_color) - icon_state = "sword[item_color]" + if(active) + if(. && item_color) + icon_state = "sword[item_color]" + AddElement(/datum/element/sword_point) + else + RemoveElement(/datum/element/sword_point) /obj/item/melee/transforming/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) if(active) From 18bdb753d3235744dbd1d7a64263ec271c1d6a7e Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Tue, 3 Mar 2020 21:13:59 -0700 Subject: [PATCH 5/8] bet --- code/game/objects/items/twohanded.dm | 1 - 1 file changed, 1 deletion(-) diff --git a/code/game/objects/items/twohanded.dm b/code/game/objects/items/twohanded.dm index a7da5c0210..8cf6ce3090 100644 --- a/code/game/objects/items/twohanded.dm +++ b/code/game/objects/items/twohanded.dm @@ -494,7 +494,6 @@ /obj/item/twohanded/dualsaber/hypereutactic/ComponentInitialize() . = ..() AddElement(/datum/element/update_icon_updates_onmob) - AddElement(/datum/element/sword_point) /obj/item/twohanded/dualsaber/hypereutactic/alt_pre_attack(atom/A, mob/living/user, params) //checks if it can do right click memes altafterattack(A, user, TRUE, params) From 7c8b490cb313623cd6c9eb5a930619849c8e6a85 Mon Sep 17 00:00:00 2001 From: Ghom <42542238+Ghommie@users.noreply.github.com> Date: Wed, 4 Mar 2020 16:40:28 +0100 Subject: [PATCH 6/8] Update energy.dm --- code/game/objects/items/melee/energy.dm | 5 ----- 1 file changed, 5 deletions(-) diff --git a/code/game/objects/items/melee/energy.dm b/code/game/objects/items/melee/energy.dm index 86cbc83891..aba07c9120 100644 --- a/code/game/objects/items/melee/energy.dm +++ b/code/game/objects/items/melee/energy.dm @@ -270,11 +270,6 @@ altafterattack(A, user, TRUE, params) return TRUE -/obj/item/melee/transforming/energy/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/melee/transforming/energy/sword/cx/transform_weapon(mob/living/user, supress_message_text) active = !active //I'd use a ..() here but it'd inherit from the regular esword's proc instead, so SPAGHETTI CODE if(active) //also I'd need to rip out the iconstate changing bits From 0b74bc9da37991b318680bb77365bf4bd84b9205 Mon Sep 17 00:00:00 2001 From: Ghom <42542238+Ghommie@users.noreply.github.com> Date: Wed, 4 Mar 2020 16:43:57 +0100 Subject: [PATCH 7/8] Update twohanded.dm --- code/game/objects/items/twohanded.dm | 9 --------- 1 file changed, 9 deletions(-) diff --git a/code/game/objects/items/twohanded.dm b/code/game/objects/items/twohanded.dm index 8cf6ce3090..d5dbef1c46 100644 --- a/code/game/objects/items/twohanded.dm +++ b/code/game/objects/items/twohanded.dm @@ -495,15 +495,6 @@ . = ..() AddElement(/datum/element/update_icon_updates_onmob) -/obj/item/twohanded/dualsaber/hypereutactic/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/twohanded/dualsaber/hypereutactic/altafterattack(atom/target, mob/living/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/twohanded/dualsaber/hypereutactic/update_icon_state() return 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 8/8] 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() . = ..()