[READY] Nukes archeology component and icon_plating and environment_type in favor of base_icon_state. Dig behaviour code improvement (#55819)

* aa

* Removes archeology component. Nukes icon_plating and environment_type in favor of base_icon_state

* Actually maybe lets not use a proc for updating asteroid icon state when its dugged up

* Update plating.dm
This commit is contained in:
Azarak
2021-01-10 21:17:35 +01:00
committed by GitHub
parent 56a01e8d82
commit ecde1f52b2
8 changed files with 29 additions and 135 deletions
-101
View File
@@ -1,101 +0,0 @@
/datum/component/archaeology
dupe_mode = COMPONENT_DUPE_UNIQUE
var/list/archdrops = list(/obj/item/bikehorn = list(ARCH_PROB = 100, ARCH_MAXDROP = 1)) // honk~
var/prob2drop
var/dug
var/datum/callback/callback
/datum/component/archaeology/Initialize(list/_archdrops = list(), datum/callback/_callback)
archdrops = _archdrops
for(var/i in archdrops)
if(isnull(archdrops[i][ARCH_MAXDROP]))
archdrops[i][ARCH_MAXDROP] = 1
stack_trace("ARCHAEOLOGY WARNING: [parent] contained a null max_drop value in [i].")
if(isnull(archdrops[i][ARCH_PROB]))
archdrops[i][ARCH_PROB] = 100
stack_trace("ARCHAEOLOGY WARNING: [parent] contained a null probability value in [i].")
callback = _callback
RegisterSignal(parent, COMSIG_PARENT_ATTACKBY,.proc/Dig)
RegisterSignal(parent, COMSIG_ATOM_EX_ACT, .proc/BombDig)
RegisterSignal(parent, COMSIG_ATOM_SING_PULL, .proc/SingDig)
/datum/component/archaeology/InheritComponent(datum/component/archaeology/A, i_am_original)
var/list/other_archdrops = A.archdrops
var/list/_archdrops = archdrops
for(var/I in other_archdrops)
_archdrops[I] += other_archdrops[I]
/datum/component/archaeology/proc/Dig(datum/source, obj/item/I, mob/living/user)
SIGNAL_HANDLER
if(dug)
to_chat(user, "<span class='warning'>Looks like someone has dug here already!</span>")
return
if(!isturf(user.loc))
return
if(I.tool_behaviour == TOOL_SHOVEL || I.tool_behaviour == TOOL_MINING)
to_chat(user, "<span class='notice'>You start digging...</span>")
if(I.use_tool(parent, user, 40, volume=50))
to_chat(user, "<span class='notice'>You dig a hole.</span>")
gets_dug()
dug = TRUE
SSblackbox.record_feedback("tally", "pick_used_mining", 1, I.type)
return COMPONENT_NO_AFTERATTACK
/datum/component/archaeology/proc/gets_dug()
if(dug)
return
else
var/turf/open/OT = get_turf(parent)
for(var/thing in archdrops)
var/maxtodrop = archdrops[thing][ARCH_MAXDROP]
for(var/i in 1 to maxtodrop)
if(prob(archdrops[thing][ARCH_PROB])) // can't win them all!
new thing(OT)
if(isopenturf(OT))
if(OT.postdig_icon_change)
if(istype(OT, /turf/open/floor/plating/asteroid/) && !OT.postdig_icon)
var/turf/open/floor/plating/asteroid/AOT = parent
AOT.icon_plating = "[AOT.environment_type]_dug"
AOT.icon_state = "[AOT.environment_type]_dug"
else
if(isplatingturf(OT))
var/turf/open/floor/plating/POT = parent
POT.icon_plating = "[POT.postdig_icon]"
POT.icon_state = "[OT.postdig_icon]"
if(OT.slowdown) //Things like snow slow you down until you dig them.
OT.slowdown = 0
dug = TRUE
if(callback)
callback.Invoke()
/datum/component/archaeology/proc/SingDig(datum/source, S, current_size)
SIGNAL_HANDLER
switch(current_size)
if(STAGE_THREE)
if(prob(30))
gets_dug()
if(STAGE_FOUR)
if(prob(50))
gets_dug()
else
if(current_size >= STAGE_FIVE && prob(70))
gets_dug()
/datum/component/archaeology/proc/BombDig(datum/source, severity, target)
SIGNAL_HANDLER
switch(severity)
if(3)
return
if(2)
if(prob(20))
gets_dug()
if(1)
gets_dug()
-3
View File
@@ -2,9 +2,6 @@
plane = FLOOR_PLANE
var/slowdown = 0 //negative for faster, positive for slower
var/postdig_icon_change = FALSE
var/postdig_icon
var/footstep = null
var/barefootstep = null
var/clawfootstep = null
-1
View File
@@ -20,7 +20,6 @@
intact = TRUE
tiled_dirt = TRUE
var/icon_plating = "plating"
var/broken = FALSE
var/burnt = FALSE
var/floor_tile = null //tile that this floor drops
+3 -12
View File
@@ -10,6 +10,7 @@
/turf/open/floor/plating
name = "plating"
icon_state = "plating"
base_icon_state = "plating"
intact = FALSE
baseturfs = /turf/baseturf_bottom
footstep = FOOTSTEP_PLATING
@@ -35,16 +36,6 @@
if (!burnt_states)
burnt_states = list("panelscorched")
. = ..()
if(!attachment_holes || (!broken && !burnt))
icon_plating = icon_state
else
icon_plating = initial(icon_state)
/turf/open/floor/plating/update_icon()
if(!..())
return
if(!broken && !burnt)
icon_state = icon_plating //Because asteroids are 'platings' too.
/turf/open/floor/plating/attackby(obj/item/C, mob/user, params)
if(..())
@@ -97,7 +88,7 @@
else if(istype(C, /obj/item/cautery/prt)) //plating repair tool
if((broken || burnt) && C.use_tool(src, user, 0, volume=80))
to_chat(user, "<span class='danger'>You fix some dents on the broken plating.</span>")
icon_state = icon_plating
icon_state = base_icon_state
burnt = FALSE
broken = FALSE
@@ -106,7 +97,7 @@
..()
if((broken || burnt) && I.use_tool(src, user, 0, volume=80))
to_chat(user, "<span class='danger'>You fix some dents on the broken plating.</span>")
icon_state = icon_plating
icon_state = base_icon_state
burnt = FALSE
broken = FALSE
+9 -15
View File
@@ -7,14 +7,11 @@
baseturfs = /turf/open/floor/plating/asteroid
icon = 'icons/turf/floors.dmi'
icon_state = "asteroid"
icon_plating = "asteroid"
postdig_icon_change = TRUE
base_icon_state = "asteroid"
footstep = FOOTSTEP_SAND
barefootstep = FOOTSTEP_SAND
clawfootstep = FOOTSTEP_SAND
heavyfootstep = FOOTSTEP_GENERIC_HEAVY
/// Environment type for the turf
var/environment_type = "asteroid"
/// Base turf type to be created by the tunnel
var/turf_type = /turf/open/floor/plating/asteroid
/// Probability floor has a different icon state
@@ -24,22 +21,22 @@
var/obj/item/stack/digResult = /obj/item/stack/ore/glass/basalt
/// Whether the turf has been dug or not
var/dug
/// Whether to change the turf's icon_state to "[base_icon_state]_dug" when its dugged up
var/postdig_icon_change = TRUE
/turf/open/floor/plating/asteroid/Initialize()
var/proper_name = name
. = ..()
name = proper_name
if(prob(floor_variance))
icon_state = "[environment_type][rand(0,12)]"
icon_state = "[base_icon_state][rand(0,12)]"
/// Drops itemstack when dug and changes icon
/turf/open/floor/plating/asteroid/proc/getDug()
dug = TRUE
new digResult(src, 5)
if(postdig_icon_change)
if(!postdig_icon)
icon_plating = "[environment_type]_dug"
icon_state = "[environment_type]_dug"
dug = TRUE
icon_state = "[base_icon_state]_dug"
/// If the user can dig the turf
/turf/open/floor/plating/asteroid/proc/can_dig(mob/user)
@@ -98,8 +95,7 @@
baseturfs = /turf/open/floor/plating/asteroid/basalt
icon = 'icons/turf/floors.dmi'
icon_state = "basalt"
icon_plating = "basalt"
environment_type = "basalt"
base_icon_state = "basalt"
floor_variance = 15
digResult = /obj/item/stack/ore/glass/basalt
@@ -148,10 +144,9 @@
icon = 'icons/turf/snow.dmi'
baseturfs = /turf/open/floor/plating/asteroid/snow
icon_state = "snow"
icon_plating = "snow"
base_icon_state = "snow"
initial_gas_mix = FROZEN_ATMOS
slowdown = 2
environment_type = "snow"
flags_1 = NONE
planetary_atmos = TRUE
broken_states = list("snow_dug")
@@ -186,8 +181,7 @@
initial_gas_mix = "o2=0;n2=82;plasma=24;TEMP=120"
floor_variance = 0
icon_state = "snow-ice"
icon_plating = "snow-ice"
environment_type = "snow_cavern"
base_icon_state = "snow-ice"
footstep = FOOTSTEP_FLOOR
barefootstep = FOOTSTEP_HARD_BAREFOOT
clawfootstep = FOOTSTEP_HARD_CLAW
@@ -1,6 +1,5 @@
/turf/open/floor/plating/airless
icon_state = "plating"
initial_gas_mix = AIRLESS_ATMOS
/turf/open/floor/plating/lowpressure
@@ -14,6 +13,7 @@
/turf/open/floor/plating/abductor
name = "alien floor"
icon_state = "alienpod1"
base_icon_state = "alienpod1"
tiled_dirt = FALSE
/turf/open/floor/plating/abductor/Initialize()
@@ -24,6 +24,7 @@
/turf/open/floor/plating/abductor2
name = "alien plating"
icon_state = "alienplating"
base_icon_state = "alienplating"
tiled_dirt = FALSE
/turf/open/floor/plating/abductor2/break_tile()
@@ -99,6 +100,7 @@
name = "wet rocky ground"
smoothing_flags = NONE
icon_state = "wateryrock"
base_icon_state = "wateryrock"
slowdown = 2
footstep = FOOTSTEP_FLOOR
barefootstep = FOOTSTEP_HARD_BAREFOOT
@@ -132,17 +134,20 @@
name = "sand"
desc = "Surf's up."
icon_state = "sand"
base_icon_state = "sand"
baseturfs = /turf/open/floor/plating/beach/sand
/turf/open/floor/plating/beach/coastline_t
name = "coastline"
desc = "Tide's high tonight. Charge your batons."
icon_state = "sandwater_t"
base_icon_state = "sandwater_t"
baseturfs = /turf/open/floor/plating/beach/coastline_t
/turf/open/floor/plating/beach/coastline_b //need to make this water subtype.
name = "coastline"
icon_state = "sandwater_b"
base_icon_state = "sandwater_b"
baseturfs = /turf/open/floor/plating/beach/coastline_b
footstep = FOOTSTEP_LAVA
barefootstep = FOOTSTEP_LAVA
@@ -154,6 +159,7 @@
name = "water"
desc = "You get the feeling that nobody's bothered to actually make this water functional..."
icon_state = "water"
base_icon_state = "water"
baseturfs = /turf/open/floor/plating/beach/water
footstep = FOOTSTEP_LAVA //placeholder, kinda.
barefootstep = FOOTSTEP_LAVA
@@ -169,6 +175,7 @@
name = "iron sand"
desc = "Like sand, but more <i>metal</i>."
icon_state = "ironsand1"
base_icon_state = "ironsand1"
footstep = FOOTSTEP_SAND
barefootstep = FOOTSTEP_SAND
clawfootstep = FOOTSTEP_SAND
@@ -189,6 +196,7 @@
desc = "A sheet of solid ice. Looks slippery."
icon = 'icons/turf/floors/ice_turf.dmi'
icon_state = "ice_turf-0"
base_icon_state = "ice_turf-0"
initial_gas_mix = FROZEN_ATMOS
temperature = 180
planetary_atmos = TRUE
@@ -230,6 +238,7 @@
desc = "A section of heated plating, helps keep the snow from stacking up too high."
icon = 'icons/turf/snow.dmi'
icon_state = "snowplating"
base_icon_state = "snowplating"
initial_gas_mix = FROZEN_ATMOS
temperature = 180
attachment_holes = FALSE
@@ -294,6 +303,7 @@
name = "dirt"
desc = "Upon closer examination, it's still dirt."
icon_state = "sand"
base_icon_state = "sand"
broken_states = list("sand_damaged")
bullet_bounce_sound = null
footstep = FOOTSTEP_SAND
@@ -4,6 +4,7 @@
desc = "Upon closer examination, it's still dirt."
icon = 'icons/turf/floors.dmi'
icon_state = "dirt"
base_icon_state = "dirt"
baseturfs = /turf/open/chasm/jungle
initial_gas_mix = OPENTURF_LOW_PRESSURE
planetary_atmos = TRUE
@@ -16,6 +17,7 @@
/turf/open/floor/plating/dirt/dark
icon_state = "greenerdirt"
base_icon_state = "greenerdirt"
/turf/open/floor/plating/dirt/try_replace_tile(obj/item/stack/tile/T, mob/user, params)
return
@@ -26,12 +28,14 @@
/turf/open/floor/plating/dirt/jungle/dark
icon_state = "greenerdirt"
base_icon_state = "greenerdirt"
/turf/open/floor/plating/dirt/jungle/wasteland //Like a more fun version of living in Arizona.
name = "cracked earth"
desc = "Looks a bit dry."
icon = 'icons/turf/floors.dmi'
icon_state = "wasteland"
base_icon_state = "wasteland"
slowdown = 1
var/floor_variance = 15
@@ -33,7 +33,7 @@
name = "cracked earth"
icon = 'icons/turf/floors.dmi'
icon_state = "wasteland"
environment_type = "wasteland"
base_icon_state = "wasteland"
baseturfs = /turf/open/floor/plating/asteroid/basalt/wasteland
digResult = /obj/item/stack/ore/glass/basalt
initial_gas_mix = LAVALAND_DEFAULT_ATMOS
@@ -43,7 +43,7 @@
/turf/open/floor/plating/asteroid/basalt/wasteland/Initialize()
.=..()
if(prob(floor_variance))
icon_state = "[environment_type][rand(0,6)]"
icon_state = "[base_icon_state][rand(0,6)]"
/turf/closed/mineral/strong/wasteland
name = "ancient dry rock"