mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 05:30:05 +01:00
[MIRROR] Adds proper sound effects to attacks against flora [MDB IGNORE] (#12305)
* Adds proper sound effects to attacks against flora (#65508) * Adds proper sound effects to attacking flora * Normalises all the sounds to make them as loud as possible and the same volume * named arguments * Adds proper sound effects to attacks against flora Co-authored-by: cacogen <25089914+cacogen@users.noreply.github.com>
This commit is contained in:
@@ -2,6 +2,22 @@
|
||||
resistance_flags = FLAMMABLE
|
||||
max_integrity = 150
|
||||
anchored = TRUE
|
||||
/// Play a foliage rustling sound when attacking it?
|
||||
var/herbage = FALSE
|
||||
/// Play a wooden chop sound when attacking it?
|
||||
var/wood = FALSE
|
||||
/// Play a rock tap sound when attacking it?
|
||||
var/rock = FALSE
|
||||
|
||||
/obj/structure/flora/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0)
|
||||
if(!wood && !herbage && !rock)
|
||||
return ..() //play generic metal thunk, tap or welder sound instead
|
||||
if(herbage)
|
||||
playsound(src, SFX_CRUNCHY_BUSH_WHACK, 50, vary = FALSE)
|
||||
if(wood)
|
||||
playsound(src, SFX_TREE_CHOP, 50, vary = FALSE)
|
||||
if(rock)
|
||||
playsound(src, SFX_ROCK_TAP, 50, vary = FALSE)
|
||||
|
||||
//trees
|
||||
/obj/structure/flora/tree
|
||||
@@ -12,24 +28,28 @@
|
||||
layer = FLY_LAYER
|
||||
plane = ABOVE_GAME_PLANE
|
||||
var/log_amount = 10
|
||||
herbage = TRUE
|
||||
wood = TRUE
|
||||
|
||||
/obj/structure/flora/tree/attackby(obj/item/W, mob/user, params)
|
||||
if(log_amount && (!(flags_1 & NODECONSTRUCT_1)))
|
||||
if(W.get_sharpness() && W.force > 0)
|
||||
if(W.hitsound)
|
||||
playsound(get_turf(src), W.hitsound, 100, FALSE, FALSE)
|
||||
user.visible_message(span_notice("[user] begins to cut down [src] with [W]."),span_notice("You begin to cut down [src] with [W]."), span_hear("You hear the sound of sawing."))
|
||||
if(do_after(user, 1000/W.force, target = src)) //5 seconds with 20 force, 8 seconds with a hatchet, 20 seconds with a shard.
|
||||
user.visible_message(span_notice("[user] fells [src] with the [W]."),span_notice("You fell [src] with the [W]."), span_hear("You hear the sound of a tree falling."))
|
||||
playsound(get_turf(src), 'sound/effects/meteorimpact.ogg', 100 , FALSE, FALSE)
|
||||
user.log_message("cut down [src] at [AREACOORD(src)]", LOG_ATTACK)
|
||||
for(var/i=1 to log_amount)
|
||||
new /obj/item/grown/log/tree(get_turf(src))
|
||||
var/obj/structure/flora/stump/S = new(loc)
|
||||
S.name = "[name] stump"
|
||||
qdel(src)
|
||||
else
|
||||
/obj/structure/flora/tree/attackby(obj/item/attacking_item, mob/user, params)
|
||||
if(!log_amount || flags_1 & NODECONSTRUCT_1)
|
||||
return ..()
|
||||
if(!attacking_item.get_sharpness() || attacking_item.force <= 0)
|
||||
return ..()
|
||||
var/my_turf = get_turf(src)
|
||||
if(attacking_item.hitsound)
|
||||
playsound(my_turf, attacking_item.hitsound, 100, FALSE, FALSE)
|
||||
user.visible_message(span_notice("[user] begins to cut down [src] with [attacking_item]."),span_notice("You begin to cut down [src] with [attacking_item]."), span_hear("You hear sawing."))
|
||||
if(!do_after(user, 1000/attacking_item.force, target = src)) //5 seconds with 20 force, 8 seconds with a hatchet, 20 seconds with a shard.
|
||||
return
|
||||
user.visible_message(span_notice("[user] fells [src] with [attacking_item]."),span_notice("You fell [src] with [attacking_item]."), span_hear("You hear the sound of a tree falling."))
|
||||
playsound(my_turf, 'sound/effects/meteorimpact.ogg', 100 , FALSE, FALSE)
|
||||
user.log_message("cut down [src] at [AREACOORD(src)]", LOG_ATTACK)
|
||||
for(var/i=1 to log_amount)
|
||||
new /obj/item/grown/log/tree(drop_location())
|
||||
var/obj/structure/flora/stump/new_stump = new(my_turf)
|
||||
new_stump.name = "[name] stump"
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/flora/stump
|
||||
name = "stump"
|
||||
@@ -38,6 +58,7 @@
|
||||
icon_state = "tree_stump"
|
||||
density = FALSE
|
||||
pixel_x = -16
|
||||
wood = TRUE
|
||||
|
||||
/obj/structure/flora/tree/pine
|
||||
name = "pine tree"
|
||||
@@ -97,6 +118,11 @@
|
||||
icon = 'icons/obj/flora/deadtrees.dmi'
|
||||
desc = "A dead tree. How it died, you know not."
|
||||
icon_state = "tree_1"
|
||||
herbage = FALSE
|
||||
|
||||
/obj/structure/flora/tree/dead/Initialize(mapload)
|
||||
icon_state = "tree_[rand(1, 6)]"
|
||||
return ..()
|
||||
|
||||
/obj/structure/flora/tree/palm
|
||||
icon = 'icons/misc/beach2.dmi'
|
||||
@@ -120,10 +146,6 @@
|
||||
icon_state = "anchored_rod"
|
||||
anchored = TRUE
|
||||
|
||||
/obj/structure/flora/tree/dead/Initialize(mapload)
|
||||
icon_state = "tree_[rand(1, 6)]"
|
||||
. = ..()
|
||||
|
||||
/obj/structure/flora/tree/jungle
|
||||
name = "tree"
|
||||
icon_state = "tree"
|
||||
@@ -147,6 +169,7 @@
|
||||
desc = "A patch of overgrown grass."
|
||||
icon = 'icons/obj/flora/snowflora.dmi'
|
||||
gender = PLURAL //"this is grass" not "this is a grass"
|
||||
herbage = TRUE
|
||||
|
||||
/obj/structure/flora/grass/brown
|
||||
icon_state = "snowgrass1bb"
|
||||
@@ -178,6 +201,7 @@
|
||||
icon = 'icons/obj/flora/snowflora.dmi'
|
||||
icon_state = "snowbush1"
|
||||
anchored = TRUE
|
||||
herbage = TRUE
|
||||
|
||||
/obj/structure/flora/bush/Initialize(mapload)
|
||||
icon_state = "snowbush[rand(1, 6)]"
|
||||
@@ -190,6 +214,7 @@
|
||||
desc = "Some kind of plant."
|
||||
icon = 'icons/obj/flora/ausflora.dmi'
|
||||
icon_state = "firstbush_1"
|
||||
herbage = TRUE
|
||||
|
||||
/obj/structure/flora/ausbushes/Initialize(mapload)
|
||||
if(icon_state == "firstbush_1")
|
||||
@@ -422,23 +447,25 @@
|
||||
var/obj/item/stack/mineResult = /obj/item/stack/ore/glass/basalt
|
||||
/// Amount of the itemstack to drop
|
||||
var/mineAmount = 20
|
||||
rock = TRUE
|
||||
|
||||
/obj/structure/flora/rock/Initialize(mapload)
|
||||
. = ..()
|
||||
icon_state = "[icon_state][rand(1,3)]"
|
||||
|
||||
/obj/structure/flora/rock/attackby(obj/item/W, mob/user, params)
|
||||
if(!mineResult || W.tool_behaviour != TOOL_MINING)
|
||||
/obj/structure/flora/rock/attackby(obj/item/attacking_item, mob/user, params)
|
||||
if(!mineResult || attacking_item.tool_behaviour != TOOL_MINING)
|
||||
return ..()
|
||||
if(flags_1 & NODECONSTRUCT_1)
|
||||
return ..()
|
||||
to_chat(user, span_notice("You start mining..."))
|
||||
if(W.use_tool(src, user, 40, volume=50))
|
||||
to_chat(user, span_notice("You finish mining the rock."))
|
||||
if(mineResult && mineAmount)
|
||||
new mineResult(loc, mineAmount)
|
||||
SSblackbox.record_feedback("tally", "pick_used_mining", 1, W.type)
|
||||
qdel(src)
|
||||
if(!attacking_item.use_tool(src, user, 40, volume=50))
|
||||
return
|
||||
to_chat(user, span_notice("You finish mining the rock."))
|
||||
if(mineResult && mineAmount)
|
||||
new mineResult(loc, mineAmount)
|
||||
SSblackbox.record_feedback("tally", "pick_used_mining", 1, attacking_item.type)
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/flora/rock/pile
|
||||
icon_state = "lavarocks"
|
||||
@@ -481,6 +508,7 @@
|
||||
desc = "A wild plant that is found in jungles."
|
||||
icon = 'icons/obj/flora/jungleflora.dmi'
|
||||
icon_state = "busha"
|
||||
herbage = TRUE
|
||||
|
||||
/obj/structure/flora/junglebush/Initialize(mapload)
|
||||
icon_state = "[icon_state][rand(1, 3)]"
|
||||
|
||||
Reference in New Issue
Block a user