Skip to content

Commit

Permalink
Merge pull request #3771 from MistakeNot4892/feature/turfs
Browse files Browse the repository at this point in the history
Added log and brick wall icons.
  • Loading branch information
out-of-phaze authored Mar 7, 2024
2 parents e8f9096 + 8303bb5 commit 76a0e29
Show file tree
Hide file tree
Showing 17 changed files with 116 additions and 28 deletions.
12 changes: 10 additions & 2 deletions code/game/machinery/doors/_door.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
var/block_air_zones = 1 //If set, air zones cannot merge across the door even when it is opened.
var/close_door_at = 0 //When to automatically close the door, if possible
var/connections = 0
var/list/blend_objects = list(/obj/structure/wall_frame, /obj/structure/window, /obj/structure/grille, /obj/machinery/door) // Objects which to blend with

var/autoset_access = TRUE // Determines whether the door will automatically set its access from the areas surrounding it. Can be used for mapping.

Expand All @@ -53,6 +52,15 @@
var/icon_state_open = "door0"
var/icon_state_closed = "door1"

/obj/machinery/door/get_blend_objects()
var/static/list/blend_objects = list(
/obj/structure/wall_frame,
/obj/structure/window,
/obj/structure/grille,
/obj/machinery/door
) // Objects which to blend with
return blend_objects

/obj/machinery/door/proc/can_operate(var/mob/user)
. = istype(user) && !user.restrained() && (!issmall(user) || ishuman(user) || issilicon(user) || isbot(user))

Expand Down Expand Up @@ -534,7 +542,7 @@
success = 1
else
for(var/obj/O in T)
for(var/blend_type in blend_objects)
for(var/blend_type in get_blend_objects())
if( istype(O, blend_type))
success = 1

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/doors/double.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
success = 1
else
for(var/obj/O in T)
for(var/blend_type in blend_objects)
for(var/blend_type in get_blend_objects())
if( istype(O, blend_type))
success = 1

Expand Down
12 changes: 9 additions & 3 deletions code/game/machinery/doors/firedoor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,17 @@
"hot",
"cold"
)

blend_objects = list(/obj/machinery/door/firedoor, /obj/structure/wall_frame, /turf/unsimulated/wall, /obj/structure/window) // Objects which to blend with

var/allow_multiple_instances_on_same_tile = FALSE

/obj/machinery/door/firedoor/get_blend_objects()
var/static/list/blend_objects = list(
/obj/machinery/door/firedoor,
/obj/structure/wall_frame,
/turf/unsimulated/wall,
/obj/structure/window
) // Objects which to blend with
return blend_objects

/obj/machinery/door/firedoor/autoset
autoset_access = TRUE //subtype just to make mapping away sites with custom access usage
req_access = list()
Expand Down
3 changes: 3 additions & 0 deletions code/game/objects/objs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -363,3 +363,6 @@
for(var/mat in remove_matter)
matter -= mat
UNSETEMPTY(matter)

/obj/proc/get_blend_objects()
return
31 changes: 28 additions & 3 deletions code/game/objects/structures/doors/_door.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,55 @@
opacity = TRUE

var/datum/lock/lock

var/has_window = FALSE
var/changing_state = FALSE
var/icon_base
var/door_sound_volume = 25
var/connections = 0

/obj/structure/door/Initialize()
. = ..()
..()
if(!istype(material))
return INITIALIZE_HINT_QDEL
if(lock)
lock = new /datum/lock(src, lock)
if(!icon_base)
icon_base = material.door_icon_base
update_icon()
update_nearby_tiles(need_rebuild = TRUE)
if(material?.luminescence)
set_light(material.luminescence, 0.5, material.color)
return INITIALIZE_HINT_LATELOAD

/obj/structure/door/LateInitialize(mapload, dir=0, populate_parts=TRUE)
..()
update_nearby_tiles(need_rebuild = TRUE)

/obj/structure/door/update_nearby_tiles(need_rebuild)
. = ..()
update_connections(TRUE)

/obj/structure/door/Destroy()
update_nearby_tiles()
QDEL_NULL(lock)
return ..()

/obj/structure/door/get_blend_objects()
var/static/list/blend_objects = list(
/obj/structure/wall_frame,
/obj/structure/window,
/obj/structure/grille,
/obj/machinery/door
)
return blend_objects

/obj/structure/door/update_connections(var/propagate = FALSE)
. = ..()
if(propagate && isturf(loc))
for(var/turf/simulated/wall/W in RANGE_TURFS(loc, 1))
W.wall_connections = null
W.other_connections = null
W.queue_icon_update()

/obj/structure/door/get_material_health_modifier()
. = 10

Expand Down
21 changes: 21 additions & 0 deletions code/game/turfs/simulated/wall_brick.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/turf/simulated/wall/brick
icon_state = "brick"
material = /decl/material/solid/stone/sandstone
girder_material = null

/turf/simulated/wall/brick/get_dismantle_stack_type()
return /obj/item/stack/material/brick

/turf/simulated/wall/brick/get_wall_icon()
return 'icons/turf/walls/brick.dmi'

/turf/simulated/wall/brick/get_dismantle_sound()
return 'sound/foley/wooden_drop.ogg' // todo

// Subtypes.
/turf/simulated/wall/brick/sandstone
color = COLOR_GOLD

/turf/simulated/wall/brick/basalt
material = /decl/material/solid/stone/basalt
color = COLOR_DARK_GRAY
2 changes: 2 additions & 0 deletions code/game/turfs/simulated/wall_icon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
if(2)
wall_dirs += get_dir(src, T)
other_dirs += get_dir(src, T)

if(handle_structure_blending)
var/success = 0
for(var/O in T)
Expand All @@ -94,6 +95,7 @@
if(!blendable)
other_dirs += get_dir(src, T)
break

wall_connections = dirs_to_corner_states(wall_dirs)
other_connections = dirs_to_corner_states(other_dirs)

Expand Down
18 changes: 18 additions & 0 deletions code/game/turfs/simulated/wall_log.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/turf/simulated/wall/log
icon_state = "log"
material = /decl/material/solid/organic/wood
girder_material = null

/turf/simulated/wall/log/get_dismantle_stack_type()
return /obj/item/stack/material/log

/turf/simulated/wall/log/get_wall_icon()
return 'icons/turf/walls/log.dmi'

/turf/simulated/wall/log/get_dismantle_sound()
return 'sound/foley/wooden_drop.ogg'

// Subtypes.
/turf/simulated/wall/log/ebony
material = /decl/material/solid/organic/wood/ebony
color = WOOD_COLOR_BLACK
11 changes: 0 additions & 11 deletions code/game/turfs/simulated/wall_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,6 @@
/turf/simulated/wall/plastic/facade
girder_material = /decl/material/solid/organic/plastic

/turf/simulated/wall/brick
icon_state = "stone"
material = /decl/material/solid/stone/sandstone
girder_material = null

/turf/simulated/wall/brick/get_wall_icon()
return 'icons/turf/walls/stone.dmi'

/turf/simulated/wall/brick/sandstone
color = COLOR_GOLD

/turf/simulated/wall/wood
color = COLOR_BROWN
icon_state = "wood"
Expand Down
13 changes: 10 additions & 3 deletions code/game/turfs/simulated/walls.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var/global/list/wall_blend_objects = list(
/obj/machinery/door,
/obj/structure/door,
/obj/structure/wall_frame,
/obj/structure/grille,
/obj/structure/window/reinforced/full,
Expand Down Expand Up @@ -48,7 +49,7 @@ var/global/list/wall_fullblend_objects = list(
..(ml)

// Clear mapping icons.
icon = 'icons/turf/walls/solid.dmi'
icon = get_wall_icon()
icon_state = "blank"
color = null

Expand Down Expand Up @@ -204,9 +205,15 @@ var/global/list/wall_fullblend_objects = list(
take_damage(log(RAND_F(0.9, 1.1) * (adj_temp - material.melting_point)))
return ..()

/turf/simulated/wall/proc/get_dismantle_stack_type()
return

/turf/simulated/wall/proc/get_dismantle_sound()
return 'sound/items/Welder.ogg'

/turf/simulated/wall/proc/dismantle_wall(var/devastated, var/explode, var/no_product)

playsound(src, 'sound/items/Welder.ogg', 100, 1)
playsound(src, get_dismantle_sound(), 100, 1)
if(!no_product)
var/list/obj/structure/girder/placed_girders
if(girder_material)
Expand All @@ -216,7 +223,7 @@ var/global/list/wall_fullblend_objects = list(
placed_girder.prepped_for_fakewall = can_open
placed_girder.update_icon()
if(material)
material.place_dismantled_product(src, devastated)
material.place_dismantled_product(src, devastated, amount = rand(3, 5), drop_type = get_dismantle_stack_type())

for(var/obj/O in src.contents) //Eject contents!
if(istype(O,/obj/structure/sign/poster))
Expand Down
13 changes: 8 additions & 5 deletions code/modules/materials/material_recipes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,14 @@
. += new/datum/stack_recipe/furniture/bed(src)
return

if(ispath(stack_type, /obj/item/stack/material/brick) && wall_support_value >= 10)
. += new/datum/stack_recipe/turfs/wall/brick(src)
. += new/datum/stack_recipe/turfs/path(src)
. += new/datum/stack_recipe/turfs/path/herringbone(src)
. += new/datum/stack_recipe/turfs/path/running_bond(src)
if(wall_support_value >= 10)
if(ispath(stack_type, /obj/item/stack/material/brick))
. += new/datum/stack_recipe/turfs/wall/brick(src)
. += new/datum/stack_recipe/turfs/path(src)
. += new/datum/stack_recipe/turfs/path/herringbone(src)
. += new/datum/stack_recipe/turfs/path/running_bond(src)
else if(ispath(stack_type, /obj/item/stack/material/log))
. += new/datum/stack_recipe/turfs/wall/log(src)

// We assume a non-ore non-strut stack type is a general type that can use general recipes.
if(opacity < 0.6)
Expand Down
4 changes: 4 additions & 0 deletions code/modules/materials/recipes_turfs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
title = "brick wall"
result_type = /turf/simulated/wall/brick

/datum/stack_recipe/turfs/wall/log
title = "log wall"
result_type = /turf/simulated/wall/log

/datum/stack_recipe/turfs/path
abstract_type = /datum/stack_recipe/turfs/path
expected_product_type = /turf/exterior
Expand Down
Binary file modified icons/turf/walls.dmi
Binary file not shown.
Binary file modified icons/turf/walls/_previews.dmi
Binary file not shown.
Binary file added icons/turf/walls/brick.dmi
Binary file not shown.
Binary file added icons/turf/walls/log.dmi
Binary file not shown.
2 changes: 2 additions & 0 deletions nebula.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1529,7 +1529,9 @@
#include "code\game\turfs\simulated\floor_static.dm"
#include "code\game\turfs\simulated\footsteps.dm"
#include "code\game\turfs\simulated\wall_attacks.dm"
#include "code\game\turfs\simulated\wall_brick.dm"
#include "code\game\turfs\simulated\wall_icon.dm"
#include "code\game\turfs\simulated\wall_log.dm"
#include "code\game\turfs\simulated\wall_material.dm"
#include "code\game\turfs\simulated\wall_shuttle.dm"
#include "code\game\turfs\simulated\wall_types.dm"
Expand Down

0 comments on commit 76a0e29

Please sign in to comment.