Files
Bubberstation/code/datums/components/diggable.dm
T
38ad81aac6 [MIRROR] [MDB IGNORE] Moves non floor turfs off /floor. You can put lattices on lavaland edition [MDB IGNORE] (#12119)
* [MDB IGNORE] Moves non floor turfs off /floor. You can put lattices on lavaland edition

* 123

* fixes more typepaths

* typepaths

* Update planet_turfs.dm

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: Kat <53862927+KathrinBailey@users.noreply.github.com>
2022-03-18 03:07:00 +00:00

29 lines
1.0 KiB
Plaintext

/// Lets you make hitting a turf with a shovel pop something out, and scrape the turf
/datum/component/diggable
/// Typepath to spawn on hit
var/to_spawn
/// Amount to spawn on hit
var/amount
/// What should we tell the user they did?
var/action_text
/datum/component/diggable/Initialize(to_spawn, amount = 1, action_text)
. = ..()
if(!isturf(parent))
return COMPONENT_INCOMPATIBLE
src.to_spawn = to_spawn
src.amount = amount
src.action_text = action_text
RegisterSignal(parent, COMSIG_PARENT_ATTACKBY, .proc/handle_attack)
/datum/component/diggable/proc/handle_attack(datum/source, obj/item/hit_by, mob/living/bastard, params)
if(!hit_by.tool_behaviour == TOOL_SHOVEL || !params)
return
var/turf/parent_turf = parent
for(var/i in 1 to amount)
new to_spawn(parent_turf)
bastard.visible_message(span_notice("[bastard] digs up [parent_turf]."), span_notice("You [action_text] [parent_turf]."))
playsound(parent_turf, 'sound/effects/shovel_dig.ogg', 50, TRUE)
parent_turf.ScrapeAway(flags = CHANGETURF_INHERIT_AIR)