Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
warriorstar-orion committed Oct 11, 2024
1 parent 6a29ee0 commit 140b960
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
3 changes: 3 additions & 0 deletions code/__DEFINES/turfs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@

/// Returns a list of around us
#define TURF_NEIGHBORS(turf) (CORNER_BLOCK_OFFSET(turf, 3, 3, -1, -1) - turf)

#define ORE_PREVENT_DIG 0 //! A turf with ore in it should not be changed when mined.
#define ORE_ALLOW_DIG 1 //! A turf with ore in it should be dug out when mined.
12 changes: 6 additions & 6 deletions code/datums/ores.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
var/scan_icon_state = ""

/// Called when the containing turf is "mined", such as with a pickaxe or other digging implement.
/// Returns `TRUE` if the containing turf should be changed to its "dug" state, `FALSE` if it should remain as is.
/// Returns [ORE_ALLOW_DIG] if the containing turf should be changed to its "dug" state, [ORE_PREVENT_DIG] if it should remain as is.
/datum/ore/proc/on_mine(turf/source, mob/user, triggered_by_explosion = FALSE)
var/amount = rand(drop_min, drop_max)

Expand All @@ -22,7 +22,7 @@
else
stack_trace("[source.type] [COORD(source)] had non-ore stack [drop_type]")

return TRUE
return ORE_ALLOW_DIG

/datum/ore/iron
drop_type = /obj/item/stack/ore/iron
Expand Down Expand Up @@ -137,11 +137,11 @@
if(GIBTONITE_UNSTRUCK)
playsound(src,'sound/effects/hit_on_shattered_glass.ogg', 50, TRUE)
explosive_reaction(source, user, triggered_by_explosion)
return FALSE
return ORE_PREVENT_DIG
if(GIBTONITE_ACTIVE)
detonate(source)

return TRUE
return ORE_ALLOW_DIG
if(GIBTONITE_STABLE)
var/obj/item/gibtonite/gibtonite = new(source)
if(remaining_time <= 0)
Expand All @@ -151,9 +151,9 @@
gibtonite.quality = 2
gibtonite.icon_state = "Gibtonite ore 2"

return TRUE
return ORE_ALLOW_DIG

return FALSE
return ORE_PREVENT_DIG

/datum/ore/gibtonite/proc/on_parent_attackby(turf/source, obj/item/attacker, mob/user)
SIGNAL_HANDLER // COMSIG_PARENT_ATTACKBY
Expand Down
5 changes: 4 additions & 1 deletion code/game/turfs/simulated/minerals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
/// Should this be set to the normal rock colour on init?
var/should_reset_color = TRUE

/// The ore type, if any, that should spawn in the wall on Initialize.
/// Expected to be a subtype of [/datum/ore].
var/preset_ore_type
/// The representation of the unmined ore in the wall, if any.
var/datum/ore/ore

/turf/simulated/mineral/Initialize(mapload)
Expand Down Expand Up @@ -96,7 +99,7 @@
return ore.on_mine(src, user, triggered_by_explosion)

/turf/simulated/mineral/proc/gets_drilled(mob/user, triggered_by_explosion = FALSE)
if(!mine_ore(user, triggered_by_explosion))
if(mine_ore(user, triggered_by_explosion) == ORE_PREVENT_DIG)
return

ChangeTurf(turf_type, defer_change)
Expand Down

0 comments on commit 140b960

Please sign in to comment.