Files
CHOMPStation2/code/game/turfs/simulated/floor.dm
CHOMPStation2StaffMirrorBot f7de0bb70b [MIRROR] Start of TG Click Code Port (#12071)
Co-authored-by: Cameron Lennox <killer65311@gmail.com>
2025-12-06 03:18:32 -05:00

188 lines
5.9 KiB
Plaintext

/turf/simulated/floor
name = "plating"
desc = "Unfinished flooring."
icon = 'icons/turf/flooring/plating.dmi'
icon_state = "plating"
// Damage to flooring.
var/broken
var/burnt
// Plating data.
var/base_name = "plating"
var/base_desc = "The naked hull."
var/base_icon = 'icons/turf/flooring/plating.dmi'
var/base_icon_state = "plating"
var/list/old_decals = null
// Flooring data.
var/flooring_override
var/initial_flooring
var/decl/flooring/flooring
var/mineral = DEFAULT_WALL_MATERIAL
var/can_be_plated = TRUE // This is here for inheritance's sake. Override to FALSE for turfs you don't want someone to simply slap a plating over such as hazards.
thermal_conductivity = 0.040
heat_capacity = 10000
/turf/simulated/floor/is_plating()
return (!flooring || flooring.is_plating)
/turf/simulated/floor/Initialize(mapload, floortype)
. = ..()
if(!floortype && initial_flooring)
floortype = initial_flooring
if(floortype)
set_flooring(get_flooring_data(floortype), TRUE)
. = INITIALIZE_HINT_LATELOAD // We'll update our icons after everyone is ready
if(can_dirty && can_start_dirty)
if(prob(dirty_prob))
dirt += rand(50,100)
update_dirt() //5% chance to start with dirt on a floor tile- give the janitor something to do
/turf/simulated/floor/LateInitialize()
. = ..()
update_icon()
/turf/simulated/floor/proc/swap_decals()
var/current_decals = decals
decals = old_decals
old_decals = current_decals
/turf/simulated/floor/proc/set_flooring(var/decl/flooring/newflooring, var/initializing)
//make_plating(defer_icon_update = 1)
if(is_plating() && !initializing) // Plating -> Flooring
swap_decals()
flooring = newflooring
if(!initializing)
update_icon(1)
levelupdate()
//This proc will set floor_type to null and the update_icon() proc will then change the icon_state of the turf
//This proc auto corrects the grass tiles' siding.
/turf/simulated/floor/proc/make_plating(var/place_product, var/defer_icon_update)
cut_overlays()
for(var/obj/effect/decal/writing/W in src)
qdel(W)
name = base_name
desc = base_desc
icon = base_icon
icon_state = base_icon_state
color = null
if(!is_plating()) // Flooring -> Plating
swap_decals()
if(flooring.build_type && place_product)
new flooring.build_type(src, flooring.build_cost) //VOREstation Edit: conservation of mass
var/newtype = flooring.get_plating_type()
if(newtype) // Has a custom plating type to become
set_flooring(get_flooring_data(newtype))
else
flooring = null
set_light(0)
broken = null
burnt = null
flooring_override = null
levelupdate()
if(!defer_icon_update)
update_icon(1)
/turf/simulated/floor/levelupdate()
var/floored_over = !is_plating()
for(var/obj/O in src)
O.hide(O.hides_under_flooring() && floored_over)
/turf/simulated/floor/can_engrave()
return (!flooring || flooring.can_engrave)
/turf/simulated/floor/proc/cause_slip(var/mob/living/M)
PROTECTED_PROC(TRUE)
return
/* CHOMPEdit - moved this block to modular_chomp\code\game\objects\items\weapons\rcd.dm
/turf/simulated/floor/rcd_values(mob/living/user, obj/item/rcd/the_rcd, passed_mode)
switch(passed_mode)
if(RCD_FLOORWALL)
// A wall costs four sheets to build (two for the grider and two for finishing it).
var/cost = RCD_SHEETS_PER_MATTER_UNIT * 4
// R-walls cost five sheets, however.
if(the_rcd.make_rwalls)
cost += RCD_SHEETS_PER_MATTER_UNIT * 1
return list(
RCD_VALUE_MODE = RCD_FLOORWALL,
RCD_VALUE_DELAY = 2 SECONDS,
RCD_VALUE_COST = cost
)
if(RCD_AIRLOCK)
// Airlock assemblies cost four sheets. Let's just add another for the electronics/wires/etc.
return list(
RCD_VALUE_MODE = RCD_AIRLOCK,
RCD_VALUE_DELAY = 5 SECONDS,
RCD_VALUE_COST = RCD_SHEETS_PER_MATTER_UNIT * 5
)
if(RCD_WINDOWGRILLE)
// One steel sheet for the girder (two rods, which is one sheet).
return list(
RCD_VALUE_MODE = RCD_WINDOWGRILLE,
RCD_VALUE_DELAY = 1 SECOND,
RCD_VALUE_COST = RCD_SHEETS_PER_MATTER_UNIT * 1
)
if(RCD_DECONSTRUCT)
// Old RCDs made deconning the floor cost 10 units (IE, three times on full RCD).
// Now it's ten sheets worth of units (which is the same capacity-wise, three times on full RCD).
return list(
RCD_VALUE_MODE = RCD_DECONSTRUCT,
RCD_VALUE_DELAY = 5 SECONDS,
RCD_VALUE_COST = RCD_SHEETS_PER_MATTER_UNIT * 10
)
return FALSE
/turf/simulated/floor/rcd_act(mob/living/user, obj/item/rcd/the_rcd, passed_mode)
switch(passed_mode)
if(RCD_FLOORWALL)
to_chat(user, span_notice("You build a wall."))
ChangeTurf(/turf/simulated/wall)
var/turf/simulated/wall/T = get_turf(src) // Ref to the wall we just built.
// Apparently set_material(...) for walls requires refs to the material singletons and not strings.
// This is different from how other material objects with their own set_material(...) do it, but whatever.
var/datum/material/M = name_to_material[the_rcd.material_to_use]
T.set_material(M, the_rcd.make_rwalls ? M : null, M)
T.add_hiddenprint(user)
return TRUE
if(RCD_AIRLOCK)
if(locate(/obj/machinery/door/airlock) in src)
return FALSE // No more airlock stacking.
to_chat(user, span_notice("You build an airlock."))
new the_rcd.airlock_type(src)
return TRUE
if(RCD_WINDOWGRILLE)
if(locate(/obj/structure/grille) in src)
return FALSE
to_chat(user, span_notice("You construct the grille."))
var/obj/structure/grille/G = new(src)
G.anchored = TRUE
return TRUE
if(RCD_DECONSTRUCT)
to_chat(user, span_notice("You deconstruct \the [src]."))
ChangeTurf(get_base_turf_by_area(src), preserve_outdoors = TRUE)
return TRUE
*/
/turf/simulated/floor/occult_act(mob/living/user)
to_chat(user, span_cult("You consecrate the floor."))
ChangeTurf(/turf/simulated/floor/cult, preserve_outdoors = TRUE)
return TRUE
/turf/simulated/floor/click_alt(mob/user)
if(isliving(user))
var/mob/living/livingUser = user
if(try_graffiti(livingUser, livingUser.get_active_hand()))
return
. = ..()