Skip to content

Commit

Permalink
Merge pull request #2477 from Tenebrosity/Branch_Branch_attacksounds
Browse files Browse the repository at this point in the history
Attack sounds for all melee weapons
  • Loading branch information
Cheridan committed Feb 2, 2014
2 parents b24ee27 + 5233990 commit 1d54687
Show file tree
Hide file tree
Showing 34 changed files with 114 additions and 65 deletions.
34 changes: 21 additions & 13 deletions code/_onclick/item_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,21 @@
/obj/item/proc/afterattack(atom/target, mob/user, proximity_flag, click_parameters)
return

obj/item/proc/get_clamped_volume()
if(src.force && src.w_class)
return Clamp((src.force + src.w_class) * 4, 30, 100)// Add the item's force to its weight class and multiply by 4, then clamp the value between 30 and 100
else if(!src.force && src.w_class)
return Clamp(src.w_class * 6, 10, 100) // Multiply the item's weight class by 6, then clamp the value between 10 and 100

/obj/item/proc/attack(mob/living/M as mob, mob/living/user as mob, def_zone)

if (!istype(M)) // not sure if this is the right thing...
return
var/messagesource = M

if (istype(M,/mob/living/carbon/brain))
messagesource = M:container
if (hitsound)
playsound(loc, hitsound, 50, 1, -1)
if (hitsound && force > 0) //If an item's hitsound is defined and the item's force is greater than zero...
playsound(loc, hitsound, get_clamped_volume(), 1, -1) //...play the item's hitsound at get_clamped_volume() with varying frequency and -1 extra range.
else if (force == 0)//Otherwise, if the item's force is zero...
playsound(loc, 'sound/weapons/tap.ogg', get_clamped_volume(), 1, -1)//...play tap.ogg at get_clamped_volume()
/////////////////////////
user.lastattacked = M
M.lastattacker = user
Expand Down Expand Up @@ -119,15 +123,19 @@

var/showname = "."
if(user)
showname = " by [user]."
showname = " by [user]!"
if(!(user in viewers(M, null)))
showname = "."

for(var/mob/O in viewers(messagesource, null))
if(attack_verb.len)
O.show_message("\red <B>[M] has been [pick(attack_verb)] with [src][showname] </B>", 1)
else
O.show_message("\red <B>[M] has been attacked with [src][showname] </B>", 1)
if(attack_verb && attack_verb.len)
M.visible_message("<span class='danger'>[M] has been [pick(attack_verb)] with [src][showname]</span>",
"<span class='userdanger'>[M] has been [pick(attack_verb)] with [src][showname]!</span>")
else if(force == 0)
M.visible_message("<span class='danger'>[M] has been [pick("tapped","patted")] with [src][showname]</span>",
"<span class='userdanger'>[M] has been [pick("tapped","patted")] with [src][showname]</span>")
else
M.visible_message("<span class='danger'>[M] has been attacked with [src][showname]</span>",
"<span class='userdanger'>[M] has been attacked with [src][showname]</span>")

if(!showname && user)
if(user.client)
Expand All @@ -146,7 +154,7 @@
else

M.take_organ_damage(power)
if (prob(33)) // Added blood for whacking non-humans too
if (prob(33) && src.force) // Added blood for whacking non-humans too
var/turf/location = M.loc
if (istype(location, /turf/simulated))
location.add_blood_floor(M)
Expand All @@ -156,4 +164,4 @@
M << "Aargh it burns!"
M.updatehealth()
add_fingerprint(user)
return 1
return 1
11 changes: 6 additions & 5 deletions code/defines/obj/weapon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,17 @@
icon = 'icons/obj/items.dmi'
icon_state = "bike_horn"
item_state = "bike_horn"
hitsound = 'sound/items/bikehorn.ogg'
throwforce = 3
hitsound = null //To prevent tap.ogg playing, as the item lacks of force
w_class = 1.0
throw_speed = 3
throw_range = 15
attack_verb = list("HONKED")
var/spam_flag = 0

/obj/item/weapon/bikehorn/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob)
playsound(loc, 'sound/items/bikehorn.ogg', 50, 1, -1) //plays instead of tap.ogg!
return ..()

/obj/item/weapon/c_tube
name = "cardboard tube"
Expand Down Expand Up @@ -371,10 +374,7 @@
m_amt = 15000
origin_tech = "materials=2;combat=1"
attack_verb = list("chopped", "torn", "cut")

/obj/item/weapon/hatchet/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob)
playsound(loc, 'sound/weapons/bladeslice.ogg', 50, 1, -1)
return ..()
hitsound = 'sound/weapons/bladeslice.ogg'

/obj/item/weapon/scythe
icon_state = "scythe0"
Expand All @@ -389,6 +389,7 @@
slot_flags = SLOT_BACK
origin_tech = "materials=2;combat=2"
attack_verb = list("chopped", "sliced", "cut", "reaped")
hitsound = 'sound/weapons/bladeslice.ogg'

/obj/item/weapon/scythe/afterattack(atom/A, mob/user as mob, proximity)
if(!proximity) return
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/cult/cult_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
w_class = 4
force = 30
throwforce = 10
hitsound = 'sound/weapons/bladeslice.ogg'
attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")


/obj/item/weapon/melee/cultblade/attack(mob/living/target as mob, mob/living/carbon/human/user as mob)
if(iscultist(user))
playsound(loc, 'sound/weapons/bladeslice.ogg', 50, 1, -1)
return ..()
else
user.Paralyse(5)
Expand Down
1 change: 1 addition & 0 deletions code/game/gamemodes/wizard/artefact.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
throwforce = 10
w_class = 3
var/charged = 1
hitsound = 'sound/weapons/bladeslice.ogg'

/obj/effect/rend
name = "tear in the fabric of reality"
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/computer/HolodeckControl.dm
Original file line number Diff line number Diff line change
Expand Up @@ -399,13 +399,13 @@
force = 30
icon_state = "sword[item_color]"
w_class = 4
playsound(user, 'sound/weapons/saberon.ogg', 50, 1)
playsound(user, 'sound/weapons/saberon.ogg', 20, 1)
user << "\blue [src] is now active."
else
force = 3
icon_state = "sword0"
w_class = 2
playsound(user, 'sound/weapons/saberoff.ogg', 50, 1)
playsound(user, 'sound/weapons/saberoff.ogg', 20, 1)
user << "\blue [src] can now be concealed."
add_fingerprint(user)
return
Expand Down
1 change: 0 additions & 1 deletion code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
var/slot_flags = 0 //This is used to determine on which slots an item can fit.
pass_flags = PASSTABLE
pressure_resistance = 5
// causeerrorheresoifixthis
var/obj/item/master = null

var/heat_protection = 0 //flags which determine which body parts are protected from heat. Use the HEAD, CHEST, GROIN, etc. flags. See setup.dm
Expand Down
7 changes: 1 addition & 6 deletions code/game/objects/items/stacks/sheets/glass.dm
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
item_state = "shard-glass"
g_amt = 3750
attack_verb = list("stabbed", "slashed", "sliced", "cut")
hitsound = 'sound/weapons/bladeslice.ogg'

suicide_act(mob/user)
viewers(user) << pick("<span class='suicide'>[user] is slitting \his wrists with the shard of glass! It looks like \he's trying to commit suicide.</span>", \
Expand All @@ -268,12 +269,6 @@
pixel_x = rand(-5, 5)
pixel_y = rand(-5, 5)


/obj/item/weapon/shard/attack(mob/M, mob/user)
playsound(loc, 'sound/weapons/bladeslice.ogg', 50, 1, -1)
..()


/obj/item/weapon/shard/afterattack(atom/A as mob|obj, mob/user, proximity)
if(!proximity || !(src in user)) return
if(isturf(A))
Expand Down
5 changes: 3 additions & 2 deletions code/game/objects/items/toys.dm
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@
active = !( active )
if (active)
user << "\blue You extend the plastic blade with a quick flick of your wrist."
playsound(user, 'sound/weapons/saberon.ogg', 50, 1)
playsound(user, 'sound/weapons/saberon.ogg', 20, 1)
if(hacked)
icon_state = "swordrainbow"
item_state = "swordrainbow"
Expand All @@ -324,7 +324,7 @@
w_class = 4
else
user << "\blue You push the plastic blade back down into the handle."
playsound(user, 'sound/weapons/saberoff.ogg', 50, 1)
playsound(user, 'sound/weapons/saberoff.ogg', 20, 1)
icon_state = "sword0"
item_state = "sword0"
w_class = 2
Expand Down Expand Up @@ -399,6 +399,7 @@
throwforce = 5
w_class = 3
attack_verb = list("attacked", "slashed", "stabbed", "sliced")
hitsound = 'sound/weapons/bladeslice.ogg'

/*
* Crayons
Expand Down
32 changes: 25 additions & 7 deletions code/game/objects/items/weapons/cigs_lighters.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,20 @@ CIGARETTE PACKETS ARE IN FANCY.DM
var/smoketime = 5
w_class = 1.0
origin_tech = "materials=1"
attack_verb = list("burnt", "singed")
attack_verb = null

/obj/item/weapon/match/process()
var/turf/location = get_turf(src)
smoketime--
if(smoketime < 1)
icon_state = "match_burnt"
lit = -1
damtype = "brute"
force = 0
icon_state = "match_burnt"
item_state = "cigoff"
name = "burnt match"
desc = "A match. This one has seen better days."
attack_verb = null
processing_objects.Remove(src)
return
if(location)
Expand All @@ -46,6 +52,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
item_state = "cigoff"
name = "burnt match"
desc = "A match. This one has seen better days."
attack_verb = null
return ..()

//////////////////
Expand All @@ -59,7 +66,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
item_state = "cigoff"
w_class = 1
body_parts_covered = null
attack_verb = list("burnt", "singed")
attack_verb = null
var/lit = 0
var/icon_on = "cigon" //Note - these are in masks.dmi not in cigarette.dmi
var/icon_off = "cigoff"
Expand Down Expand Up @@ -96,7 +103,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM

else if(istype(W, /obj/item/weapon/match))
var/obj/item/weapon/match/M = W
if(M.lit)
if(M.lit == 1) //checking for lit = 1 instead of just lit prevents cigarettes being lit by used matches
light("<span class='notice'>[user] lights their [name] with [W].</span>")

else if(istype(W, /obj/item/weapon/melee/energy/sword))
Expand Down Expand Up @@ -134,7 +141,12 @@ CIGARETTE PACKETS ARE IN FANCY.DM
/obj/item/clothing/mask/cigarette/proc/light(var/flavor_text = "[usr] lights the [name].")
if(!src.lit)
src.lit = 1
damtype = "fire"
name = "lit [name]"
if(!istype(src, /obj/item/clothing/mask/cigarette/pipe)) //can't burn people with pipes
attack_verb = list("burnt", "singed")
hitsound = 'sound/items/welder.ogg'
damtype = "fire"
force = 4
if(reagents.get_reagent_amount("plasma")) // the plasma explodes when exposed to fire
var/datum/effect/effect/system/reagents_explosion/e = new()
e.set_up(round(reagents.get_reagent_amount("plasma") / 2.5, 1), get_turf(src), 0, 0)
Expand Down Expand Up @@ -215,7 +227,6 @@ CIGARETTE PACKETS ARE IN FANCY.DM
/obj/item/clothing/mask/cigarette/attack(mob/living/carbon/M, mob/living/carbon/user)
if(!istype(M))
return ..()

if(istype(M.wear_mask, /obj/item/clothing/mask/cigarette) && user.zone_sel && user.zone_sel.selecting == "mouth" && lit)
var/obj/item/clothing/mask/cigarette/cig = M.wear_mask
if(M == user)
Expand Down Expand Up @@ -403,7 +414,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
throwforce = 4
flags = CONDUCT
slot_flags = SLOT_BELT
attack_verb = list("burnt", "singed")
attack_verb = null
var/lit = 0

/obj/item/weapon/lighter/zippo
Expand All @@ -427,6 +438,10 @@ CIGARETTE PACKETS ARE IN FANCY.DM
lit = 1
icon_state = icon_on
item_state = icon_on
force = 5
damtype = "fire"
hitsound = 'sound/items/welder.ogg'
attack_verb = list("burnt", "singed")
if(istype(src, /obj/item/weapon/lighter/zippo) )
user.visible_message("<span class='rose'>Without even breaking stride, [user] flips open and lights [src] in one smooth movement.</span>")
else
Expand All @@ -443,6 +458,9 @@ CIGARETTE PACKETS ARE IN FANCY.DM
lit = 0
icon_state = icon_off
item_state = icon_off
hitsound = "swing_hit"
force = 0
attack_verb = null //human_defense.dm takes care of it
if(istype(src, /obj/item/weapon/lighter/zippo) )
user.visible_message("<span class='rose'>You hear a quiet click, as [user] shuts off [src] without even looking at what they're doing. Wow.")
else
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/weapons/kitchen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
flags = CONDUCT
origin_tech = "materials=1"
attack_verb = list("attacked", "stabbed", "poked")
hitsound = 'sound/weapons/bladeslice.ogg'

/obj/item/weapon/kitchen/utensil/New()
if (prob(60))
Expand Down
Loading

0 comments on commit 1d54687

Please sign in to comment.