Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved some turf vars to turf flags #8100

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions code/__DEFINES/turf_flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
#define UNUSED_RESERVATION_TURF (1<<1)
/// If a turf is a reserved turf
#define RESERVATION_TURF (1<<2)
#define TURF_DEBRISED (1<<3)
#define TURF_HULL (1<<4)
#define TURF_BURNABLE (1<<5)
#define TURF_BURNT (1<<6)
#define TURF_BREAKABLE (1<<7)
#define TURF_BROKEN (1<<8)

//ChangeTurf options to change its behavior
#define CHANGETURF_DEFER_CHANGE (1<<0)
Expand Down
6 changes: 6 additions & 0 deletions code/_globalvars/bitfields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ DEFINE_BITFIELD(turf_flags, list(
"TURF_ORGANIC" = TURF_ORGANIC,
"UNUSED_RESERVATION_TURF" = UNUSED_RESERVATION_TURF,
"RESERVATION_TURF" = RESERVATION_TURF,
"TURF_DEBRISED" = TURF_DEBRISED,
"TURF_HULL" = TURF_HULL,
"TURF_BURNABLE" = TURF_BURNABLE,
"TURF_BURNT" = TURF_BURNT,
"TURF_BREAKABLE" = TURF_BREAKABLE,
"TURF_BROKEN" = TURF_BROKEN,
))

DEFINE_BITFIELD(flags_item, list(
Expand Down
4 changes: 2 additions & 2 deletions code/controllers/subsystem/mapping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ SUBSYSTEM_DEF(mapping)
unused_turfs["[T.z]"] |= T
//var/area/old_area = T.loc
//old_area.turfs_to_uncontain += T
T.turf_flags = UNUSED_RESERVATION_TURF
T.turf_flags |= UNUSED_RESERVATION_TURF
//world_contents += T
//world_turf_contents += T
packet.len--
Expand Down Expand Up @@ -366,7 +366,7 @@ SUBSYSTEM_DEF(mapping)
var/block = block(SHUTTLE_TRANSIT_BORDER, SHUTTLE_TRANSIT_BORDER, z, world.maxx - SHUTTLE_TRANSIT_BORDER, world.maxy - SHUTTLE_TRANSIT_BORDER, z)
for(var/turf/T as anything in block)
// No need to empty() these, because they just got created and are already /turf/open/space/basic.
T.turf_flags = UNUSED_RESERVATION_TURF
T.turf_flags |= UNUSED_RESERVATION_TURF
CHECK_TICK

// Gotta create these suckers if we've not done so already
Expand Down
2 changes: 1 addition & 1 deletion code/datums/elements/bullet_trait/penetrating/heavy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@
if(!istype(hit_wall))
return COMPONENT_BULLET_PASS_THROUGH

if(!hit_wall.hull)
if(!(hit_wall.turf_flags & TURF_HULL))
return COMPONENT_BULLET_PASS_THROUGH

Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@
if(!istype(T))
return COMPONENT_BULLET_PASS_THROUGH

if(!T.hull)
if(!(T.turf_flags & TURF_HULL))
return COMPONENT_BULLET_PASS_THROUGH
2 changes: 1 addition & 1 deletion code/datums/elements/bullet_trait/penetrating/weak.dm
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@
if(!istype(hit_wall))
return COMPONENT_BULLET_PASS_THROUGH

if(!hit_wall.hull)
if(!(hit_wall.turf_flags & TURF_HULL))
return COMPONENT_BULLET_PASS_THROUGH
2 changes: 1 addition & 1 deletion code/game/area/areas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
continue
if(istype(current, /turf/closed/wall))
var/turf/closed/wall/current_wall = current
if(!current_wall.hull)
if(!(current_wall.turf_flags & TURF_HULL))
openable_turf_count++
continue

Expand Down
4 changes: 2 additions & 2 deletions code/game/gamemodes/colonialmarines/colonialmarines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@
if(!istype(turf, /turf/closed/wall))
continue
var/turf/closed/wall/wall = turf
if(wall.hull)
if(wall.turf_flags & TURF_HULL)
continue
lz_smoke += new /obj/effect/particle_effect/smoke/miasma(turf, null, new_cause_data)

Expand Down Expand Up @@ -310,7 +310,7 @@
if(!istype(turf, /turf/closed/wall))
continue
var/turf/closed/wall/wall = turf
if(wall.hull)
if(wall.turf_flags & TURF_HULL)
continue
new /obj/effect/particle_effect/smoke/weedkiller(turf, null, cause_data)

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/HolodeckControl.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

/turf/open/floor/holofloor/grass/update_icon()
. = ..()
if(!broken && !burnt)
if(!(turf_flags & TURF_BROKEN) && !(turf_flags & TURF_BURNT))
if(!(icon_state in list("grass1", "grass2", "grass3", "grass4")))
icon_state = "grass[pick("1", "2", "3", "4")]"

Expand Down
6 changes: 3 additions & 3 deletions code/game/objects/items/explosives/plastic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@

if(istype(target, /turf/closed/wall))
var/turf/closed/wall/W = target
if(W.hull)
if(W.turf_flags & TURF_HULL)
to_chat(user, SPAN_WARNING("You are unable to stick [src] to [W]!"))
return FALSE

Expand Down Expand Up @@ -288,7 +288,7 @@
plant_target.ex_act(2000, dir, temp_cause)

for(var/turf/closed/wall/W in orange(1, target_turf))
if(W.hull)
if(W.turf_flags & TURF_HULL)
continue
W.ex_act(1000 * penetration, , cause_data)

Expand Down Expand Up @@ -352,7 +352,7 @@

if(istype(target, /turf/closed/wall))
var/turf/closed/wall/targeted_wall = target
if(targeted_wall.hull)
if(targeted_wall.turf_flags & TURF_HULL)
to_chat(user, SPAN_WARNING("You are unable to stick [src] to [targeted_wall]!"))
return FALSE

Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/tools/maintenance_tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@
var/turf/open/floor/flooring = attacked_obj

if(crowbar_mode && user.a_intent == INTENT_HELP) //Only pry flooring on help intent
if(flooring.hull_floor) //no interaction for hulls
if(flooring.turf_flags & TURF_HULL) //no interaction for hulls
return
if(flooring.weeds)
return attackby(src, user)
Expand Down
34 changes: 15 additions & 19 deletions code/game/turfs/floor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@
name = "floor"
icon = 'icons/turf/floors/floors.dmi'
icon_state = "floor"
var/broken = FALSE
var/burnt = FALSE
turf_flags = TURF_BURNABLE|TURF_BREAKABLE
var/mineral = "metal"
var/breakable_tile = TRUE
var/burnable_tile = TRUE
var/hull_floor = FALSE //invincible floor, can't interact with it
var/image/wet_overlay

var/tile_type = /obj/item/stack/tile/plasteel
Expand All @@ -18,7 +14,7 @@

/turf/open/floor/get_examine_text(mob/user)
. = ..()
if(!hull_floor)
if(!(turf_flags & TURF_HULL))
var/tool_output = list()
if(tool_flags & REMOVE_CROWBAR)
tool_output += SPAN_GREEN("crowbar")
Expand All @@ -37,7 +33,7 @@


/turf/open/floor/ex_act(severity, explosion_direction)
if(hull_floor)
if(turf_flags & TURF_HULL)
return 0
switch(severity)
if(0 to EXPLOSION_THRESHOLD_LOW)
Expand All @@ -53,9 +49,9 @@
return 0

/turf/open/floor/fire_act(exposed_temperature, exposed_volume)
if(hull_floor)
if(turf_flags & TURF_HULL)
return
if(!burnt && prob(5))
if(!(turf_flags & TURF_BURNT) && prob(5))
burn_tile()
else if(prob(1))
make_plating()
Expand Down Expand Up @@ -87,12 +83,12 @@
break_tile()

/turf/open/floor/proc/break_tile()
if(!breakable_tile || hull_floor)
if(!(turf_flags & TURF_BREAKABLE) || turf_flags & TURF_HULL)
return
if(broken)
if(turf_flags & TURF_BROKEN)
return

broken = TRUE
turf_flags |= TURF_BROKEN
if(is_plasteel_floor())
icon_state = "damaged[pick(1, 2, 3, 4, 5)]"
else if(is_light_floor())
Expand All @@ -108,12 +104,12 @@
icon_state = "grass[pick("1", "2", "3")]"

/turf/open/floor/proc/burn_tile()
if(!burnable_tile || hull_floor)
if(!(turf_flags & TURF_BURNABLE) || turf_flags & TURF_HULL)
return
if(broken || burnt)
if(turf_flags & TURF_BROKEN || turf_flags & TURF_BURNT)
return

burnt = TRUE
turf_flags |= TURF_BURNT
if(is_plasteel_floor())
icon_state = "damaged[pick(1, 2, 3, 4, 5)]"
else if(is_plasteel_floor())
Expand All @@ -131,19 +127,19 @@
/turf/open/floor/proc/make_plating()
set_light(0)
intact_tile = FALSE
broken = FALSE
burnt = FALSE
turf_flags &= ~TURF_BURNT
turf_flags &= ~TURF_BROKEN
ChangeTurf(plating_type)

/turf/open/floor/attackby(obj/item/hitting_item, mob/user)
if(hull_floor) //no interaction for hulls
if(turf_flags & TURF_HULL) //no interaction for hulls
return

if(src.weeds)
return weeds.attackby(hitting_item,user)

if(HAS_TRAIT(hitting_item, TRAIT_TOOL_CROWBAR) && (tool_flags & (REMOVE_CROWBAR|BREAK_CROWBAR)))
if(broken || burnt)
if(turf_flags & TURF_BROKEN || turf_flags & TURF_BURNT)
to_chat(user, SPAN_WARNING("You remove the broken tiles."))
else
if(tool_flags & BREAK_CROWBAR)
Expand Down
42 changes: 19 additions & 23 deletions code/game/turfs/floor_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,18 @@
to_chat(user, SPAN_WARNING("You need a stronger blowtorch!"))
return
var/obj/item/tool/weldingtool/welder = C
if(welder.isOn() && (broken || burnt))
if(welder.isOn() && (turf_flags & TURF_BROKEN || turf_flags & TURF_BURNT))
if(welder.remove_fuel(0, user))
to_chat(user, SPAN_WARNING("You fix some dents on the broken plating."))
playsound(src, 'sound/items/Welder.ogg', 25, 1)
icon_state = "plating"
burnt = FALSE
broken = FALSE
turf_flags &= ~TURF_BURNT
turf_flags &= ~TURF_BROKEN
else
to_chat(user, SPAN_WARNING("You need more welding fuel to complete this task."))
return
if(istype(C, /obj/item/stack/tile))
if(broken || burnt)
if(turf_flags & TURF_BROKEN || turf_flags & TURF_BURNT)
to_chat(user, SPAN_NOTICE("This section is too damaged to support a tile. Use a welder to fix the damage."))
return
var/obj/item/stack/tile/T = C
Expand All @@ -75,7 +75,7 @@
T.build(src)
return
if(istype(C, /obj/item/stack/catwalk))
if(broken || burnt)
if(turf_flags & TURF_BROKEN || turf_flags & TURF_BURNT)
to_chat(user, SPAN_NOTICE("This section is too damaged to support a catwalk. Use a welder to fix the damage."))
return
var/obj/item/stack/catwalk/T = C
Expand All @@ -91,8 +91,8 @@
return

/turf/open/floor/plating/burnt_platingdmg3
burnt = TRUE
icon_state = "platingdmg3"
turf_flags = TURF_BURNABLE|TURF_BREAKABLE|TURF_BURNT

/turf/open/floor/plating/burnt_platingdmg3/west
dir = WEST
Expand Down Expand Up @@ -326,8 +326,7 @@
/turf/open/floor/plating/plating_catwalk/aicore
icon = 'icons/turf/floors/aicore.dmi'
icon_state = "ai_plating_catwalk"
breakable_tile = FALSE // platingdmg# icon_state does not exist in this icon
burnable_tile = FALSE // panelscorched icon_state does not exist in this icon
turf_flags = NO_FLAGS // platingdmg && panelscorched icon_state does not exist in this icon
covered_icon_state = "ai_catwalk"

/turf/open/floor/plating/plating_catwalk/aicore/white
Expand All @@ -348,8 +347,7 @@
icon_state = "catwalk0"
name = "catwalk"
desc = "Cats really don't like these things."
breakable_tile = FALSE // platingdmg# icon_state does not exist in this icon
burnable_tile = FALSE // panelscorched icon_state does not exist in this icon
turf_flags = NO_FLAGS // platingdmg && panelscorched icon_state does not exist in this icon

/turf/open/floor/almayer
icon = 'icons/turf/almayer.dmi'
Expand Down Expand Up @@ -1839,7 +1837,7 @@
icon = 'icons/turf/almayer.dmi'
icon_state = "plating"
plating_type = /turf/open/floor/tdome
hull_floor = TRUE
turf_flags = TURF_HULL

/turf/open/floor/tdome/w_y0
icon_state = "w-y0"
Expand Down Expand Up @@ -1992,7 +1990,7 @@

/turf/open/floor/almayer/no_build
allow_construction = FALSE
hull_floor = TRUE
turf_flags = TURF_BURNABLE|TURF_BREAKABLE|TURF_HULL

/turf/open/floor/almayer/no_build/ai_floors
icon_state = "ai_floors"
Expand Down Expand Up @@ -2033,7 +2031,7 @@

/turf/open/floor/almayer/aicore/no_build
allow_construction = FALSE
hull_floor = TRUE
turf_flags = TURF_BURNABLE|TURF_BREAKABLE|TURF_HULL

/turf/open/floor/almayer/aicore/no_build/ai_arrow
icon_state = "ai_arrow"
Expand Down Expand Up @@ -2064,7 +2062,7 @@

/turf/open/floor/almayer/aicore/glowing/no_build
allow_construction = FALSE
hull_floor = TRUE
turf_flags = TURF_BURNABLE|TURF_BREAKABLE|TURF_HULL

/turf/open/floor/almayer/aicore/glowing/no_build/ai_floor3_4range
icon_state = "ai_floor3"
Expand Down Expand Up @@ -2138,7 +2136,7 @@
icon = 'icons/turf/almayer.dmi'
icon_state = "outerhull"
name = "hull"
hull_floor = TRUE
turf_flags = TURF_HULL

/turf/open/floor/almayer_hull/outerhull_dir
icon_state = "outerhull_dir"
Expand Down Expand Up @@ -2263,8 +2261,7 @@
name = "reinforced floor"
icon_state = "engine"
intact_tile = 0
breakable_tile = FALSE
burnable_tile = FALSE
turf_flags = NO_FLAGS
baseturfs = /turf/open/floor

/turf/open/floor/engine/simulator_center
Expand Down Expand Up @@ -2363,7 +2360,7 @@

/turf/open/floor/grass/update_icon()
. = ..()
if(!broken && !burnt)
if(!(turf_flags & TURF_BROKEN) && !(turf_flags & TURF_BURNT))
if(!(icon_state in list("grass1", "grass2", "grass3", "grass4")))
icon_state = "grass[pick("1", "2", "3", "4")]"

Expand Down Expand Up @@ -2396,7 +2393,7 @@

/turf/open/floor/carpet/update_icon()
. = ..()
if(!broken && !burnt)
if(!(turf_flags & TURF_BROKEN) && !(turf_flags & TURF_BURNT))
if(icon_state != "carpetsymbol")
var/connectdir = 0
for(var/direction in GLOB.cardinals)
Expand Down Expand Up @@ -3229,10 +3226,10 @@
icon_state = "recharge_floor"

/turf/open/floor/mech_bay_recharge_floor/break_tile()
if(broken)
if(turf_flags & TURF_BROKEN)
return
ChangeTurf(/turf/open/floor/plating)
broken = TRUE
turf_flags |= TURF_BROKEN

/turf/open/floor/mech_bay_recharge_floor/shuttle_landing_lights
name = "shuttle landing lights"
Expand All @@ -3245,8 +3242,7 @@
name = "wooden floor"
icon_state = "oldwood1"
tile_type = /obj/item/stack/tile/wood
breakable_tile = FALSE // wood-broken icon_state does not exist in this icon
burnable_tile = FALSE // wood-broken icon_state does not exist in this icon
turf_flags = NO_FLAGS // platingdmg && panelscorched icon_state does not exist in this icon

/turf/open/floor/interior/wood/is_wood_floor()
return TRUE
Expand Down
Loading
Loading