[MIRROR] Baguette swords make proper sounds and are toggled from left clicking the baguette, not right click [MDB IGNORE] (#16527)

* Baguette swords make proper sounds and are toggled from left clicking the baguette, not right click

* Update code/_onclick/item_attack.dm

Co-authored-by: tralezab <40974010+tralezab@users.noreply.github.com>
Co-authored-by: Tom <8881105+tf-4@users.noreply.github.com>
This commit is contained in:
SkyratBot
2022-09-29 22:45:55 -07:00
committed by GitHub
co-authored by tralezab Tom
parent eb3da61e0a
commit 586b1d4fcb
4 changed files with 17 additions and 8 deletions
+4
View File
@@ -560,6 +560,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define TRAIT_LIVING_HEART "living_heart"
/// Prevents the same person from being chosen multiple times for kidnapping objective
#define TRAIT_HAS_BEEN_KIDNAPPED "has_been_kidnapped"
/// An item still plays its hitsound even if it has 0 force, instead of the tap
#define TRAIT_CUSTOM_TAP_SOUND "no_tap_sound"
//quirk traits
#define TRAIT_ALCOHOL_TOLERANCE "alcohol_tolerance"
@@ -732,6 +734,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define MAFIA_TRAIT "mafia"
/// Trait associated with highlander
#define HIGHLANDER_TRAIT "highlander"
/// Trait given from playing pretend with baguettes
#define SWORDPLAY_TRAIT "swordplay"
///generic atom traits
/// Trait from [/datum/element/rust]. Its rusty and should be applying a special overlay to denote this.
+2 -1
View File
@@ -185,7 +185,8 @@
if(force && HAS_TRAIT(user, TRAIT_PACIFISM))
to_chat(user, span_warning("You don't want to harm other living beings!"))
return
if(!force)
if(!force && !HAS_TRAIT(src, TRAIT_CUSTOM_TAP_SOUND))
playsound(loc, 'sound/weapons/tap.ogg', get_clamped_volume(), TRUE, -1)
else if(hitsound)
playsound(loc, hitsound, get_clamped_volume(), TRUE, extrarange = stealthy_audio ? SILENCED_SOUND_EXTRARANGE : -1, falloff_distance = 0)
+1 -1
View File
@@ -802,7 +802,7 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons
itempush = 0 //too light to push anything
if(isliving(hit_atom)) //Living mobs handle hit sounds differently.
var/volume = get_volume_by_throwforce_and_or_w_class()
if (throwforce > 0)
if (throwforce > 0 || HAS_TRAIT(src, TRAIT_CUSTOM_TAP_SOUND))
if (mob_throw_hit_sound)
playsound(hit_atom, mob_throw_hit_sound, volume, TRUE, -1)
else if(hitsound)
+10 -6
View File
@@ -270,15 +270,15 @@
/obj/item/food/baguette/add_context(atom/source, list/context, obj/item/held_item, mob/user)
. = ..()
if (user.mind?.miming && held_item == src)
context[SCREENTIP_CONTEXT_RMB] = "Toggle Swordplay"
context[SCREENTIP_CONTEXT_LMB] = "Toggle Swordplay"
return CONTEXTUAL_SCREENTIP_SET
/obj/item/food/baguette/examine(mob/user)
var/examine_list = ..()
if(user.mind?.miming)
examine_list += span_notice("You can wield this like a sword by right clicking it.")
examine_list += span_notice("You can wield this like a sword by using it in your hand.")
/obj/item/food/baguette/attack_self_secondary(mob/user, modifiers)
/obj/item/food/baguette/attack_self(mob/user, modifiers)
. = ..()
if(!user.mind?.miming)
return
@@ -292,9 +292,11 @@
span_notice("[user] begins wielding [src] like a sword!"),
span_notice("You begin wielding [src] like a sword, with a firm grip on the bottom as an imaginary handle.")
)
ADD_TRAIT(src, TRAIT_CUSTOM_TAP_SOUND, SWORDPLAY_TRAIT)
attack_verb_continuous = list("slashes", "cuts")
attack_verb_simple = list("slash", "cut")
hitsound = 'sound/weapons/rapierhit.ogg'
fake_swordplay = TRUE
RegisterSignal(src, COMSIG_ITEM_EQUIPPED, .proc/on_sword_equipped)
RegisterSignal(src, COMSIG_ITEM_DROPPED, .proc/on_sword_dropped)
@@ -302,14 +304,16 @@
/obj/item/food/baguette/proc/end_swordplay(mob/user)
UnregisterSignal(src, list(COMSIG_ITEM_EQUIPPED, COMSIG_ITEM_DROPPED))
REMOVE_TRAIT(src, TRAIT_CUSTOM_TAP_SOUND, SWORDPLAY_TRAIT)
attack_verb_continuous = initial(attack_verb_continuous)
attack_verb_simple = initial(attack_verb_simple)
hitsound = initial(hitsound)
fake_swordplay = FALSE
if(user)
visible_message( \
span_notice("[user] no longer holds [src] like a sword!"), \
span_notice("You go back to holding [src] normally.") \
visible_message(
span_notice("[user] no longer holds [src] like a sword!"),
span_notice("You go back to holding [src] normally.")
)
/obj/item/food/baguette/proc/on_sword_dropped(datum/source, mob/user)