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"