Merge pull request #11277 from kevinz000/sword_point

En garde! (nah just sword pointing)
This commit is contained in:
Ghom
2020-03-04 17:11:39 +01:00
committed by GitHub
10 changed files with 72 additions and 56 deletions

View File

@@ -233,6 +233,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)

View File

@@ -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("<span class='notice'>[user] points the tip of [src] at [target].</span>", "<span class='notice'>You point the tip of [src] at [target].</span>")

View File

@@ -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))
@@ -107,8 +106,12 @@
/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)
@@ -267,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("<span class='notice'>[user] points the tip of [src] at [target].</span>", "<span class='notice'>You point the tip of [src] at [target].</span>")
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

View File

@@ -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)

View File

@@ -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, "<span class='notice'>You extend the plastic blade with a quick flick of your wrist.</span>")
playsound(user, 'sound/weapons/saberon.ogg', 20, 1)
to_chat(user, "<span class='notice'>[activation_message]</span>")
playsound(user, activation_sound, transform_volume, 1)
w_class = WEIGHT_CLASS_BULKY
AddElement(/datum/element/sword_point)
else
to_chat(user, "<span class='notice'>[deactivation_message]</span>")
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, "<span class='notice'>You push the plastic blade back down into the handle.</span>")
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, "<span class='warning'>RNBW_ENGAGE</span>")
if(active)
icon_state = "swordrainbow"
update_icon()
user.update_inv_hands()
else
to_chat(user, "<span class='warning'>It's already fabulous!</span>")
@@ -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("<span class='notice'>[user] points the tip of [src] at [target].</span>", "<span class='notice'>You point the tip of [src] at [target].</span>")
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, "<span class='notice'>You activate the holographic blade with a press of a button.</span>")
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, "<span class='notice'>You deactivate the holographic blade with a press of a button.</span>")
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()
. = ..()

View File

@@ -396,6 +396,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)
@@ -405,6 +406,7 @@
hitsound = "swing_hit"
STOP_PROCESSING(SSobj, src)
set_light(0)
RemoveElement(/datum/element/sword_point)
/obj/item/twohanded/dualsaber/process()
if(wielded)
@@ -493,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("<span class='notice'>[user] points the tip of [src] at [target].</span>", "<span class='notice'>You point the tip of [src] at [target].</span>")
return TRUE
/obj/item/twohanded/dualsaber/hypereutactic/update_icon_state()
return
@@ -605,6 +598,8 @@
/obj/item/twohanded/spear/Initialize()
. = ..()
AddComponent(/datum/component/butchering, 100, 70) //decent in a pinch, but pretty bad.
AddComponent(/datum/component/jousting)
AddElement(/datum/element/sword_point)
/obj/item/twohanded/spear/attack_self(mob/user)
if(explosive)
@@ -630,10 +625,6 @@
return BRUTELOSS
return BRUTELOSS
/obj/item/twohanded/spear/Initialize()
. = ..()
AddComponent(/datum/component/jousting)
/obj/item/twohanded/spear/examine(mob/user)
. = ..()
if(explosive)
@@ -818,6 +809,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."
@@ -901,6 +895,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)

View File

@@ -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("<span class='suicide'>[user] is falling on [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")

View File

@@ -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))

View File

@@ -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

View File

@@ -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\update_icon_blocker.dm"
#include "code\datums\elements\update_icon_updates_onmob.dm"
#include "code\datums\elements\wuv.dm"