Skip to content

Commit

Permalink
[MIRROR] Better contrasted wall sprites & wall paint layering system (#…
Browse files Browse the repository at this point in the history
…2936)

Co-authored-by: CakeQ <[email protected]>
Co-authored-by: Lexanx <[email protected]>
  • Loading branch information
3 people authored Dec 20, 2024
1 parent 8aa73b5 commit 9b5dd9c
Show file tree
Hide file tree
Showing 23 changed files with 398 additions and 113 deletions.
11 changes: 0 additions & 11 deletions code/__defines/doors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,3 @@
#define DOOR_OPERATING_YES 1
/// Door has been emagged or is otherwise non functional.
#define DOOR_OPERATING_BROKEN -1


// Flags for `/obj/machinery/door/airlock/var/paintable`
/// The main airlock body is paintable.
#define AIRLOCK_PAINTABLE_MAIN FLAG(0)
/// The stripe decal is paintable.
#define AIRLOCK_PAINTABLE_STRIPE FLAG(1)
/// Other detailing is paintable.
#define AIRLOCK_PAINTABLE_DETAIL FLAG(2)
/// The window is paintable.
#define AIRLOCK_PAINTABLE_WINDOW FLAG(3)
7 changes: 7 additions & 0 deletions code/__defines/materials.dm
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,10 @@
#define MATERIAL_RIGID 40
#define MATERIAL_HARD 60
#define MATERIAL_VERY_HARD 80

//Wall & Airlock layering flags
#define MATERIAL_PAINTABLE_MAIN FLAG(0)
#define MATERIAL_PAINTABLE_STRIPE FLAG(1)
#define MATERIAL_PAINTABLE_DETAIL FLAG(2)
#define MATERIAL_PAINTABLE_WINDOW FLAG(3)
#define MATERIAL_WALL_HAS_EDGES FLAG(4)
21 changes: 21 additions & 0 deletions code/_global_vars/lists/objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,24 @@ GLOBAL_DATUM_INIT(universe, /datum/universal_state, new)
GLOBAL_LIST_INIT(full_alphabet, list("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"))

GLOBAL_LIST_EMPTY(meteor_list)

GLOBAL_LIST_EMPTY(shield_generators) // All shield generators

GLOBAL_LIST_INIT(wall_blend_objects, list(
/obj/machinery/door,
/obj/structure/wall_frame,
/obj/structure/grille,
/obj/structure/window/reinforced/full,
/obj/structure/window/reinforced/polarized/full,
/obj/structure/window/shuttle,
/obj/structure/window/boron_basic/full,
/obj/structure/window/boron_reinforced/full
))

GLOBAL_LIST_INIT(wall_noblend_objects, list(
/obj/machinery/door/window
))

GLOBAL_LIST_INIT(wall_fullblend_objects, list(
/obj/structure/wall_frame
))
10 changes: 5 additions & 5 deletions code/game/machinery/doors/airlock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@
/// String. Partial icon state for generating the airlock appearance overlay.
var/airlock_type = "Standard"
var/static/list/airlock_icon_cache = list()
/// Bitflag (Any of `AIRLOCK_PAINTABLE_*`). Determines what parts of the airlock can be recolored with paint.
var/paintable = AIRLOCK_PAINTABLE_MAIN | AIRLOCK_PAINTABLE_STRIPE
/// Bitflag (Any of `MATERIAL_PAINTABLE*`). Determines what parts of the airlock can be recolored with paint.
var/paintable = MATERIAL_PAINTABLE_MAIN | MATERIAL_PAINTABLE_STRIPE
/// Color. The color of the main door body.
var/door_color = null
/// Color. The color of the stripe detail.
Expand Down Expand Up @@ -255,7 +255,7 @@
emag_file = 'icons/obj/doors/external/emag.dmi'
assembly_type = /obj/structure/door_assembly/door_assembly_ext
door_color = COLOR_NT_RED
paintable = AIRLOCK_PAINTABLE_MAIN
paintable = MATERIAL_PAINTABLE_MAIN

/obj/machinery/door/airlock/external/inherit_access_from_area()
..()
Expand Down Expand Up @@ -380,7 +380,7 @@
explosion_resistance = 20
opacity = 1
assembly_type = /obj/structure/door_assembly/door_assembly_hatch
paintable = AIRLOCK_PAINTABLE_STRIPE
paintable = MATERIAL_PAINTABLE_STRIPE

/obj/machinery/door/airlock/hatch/maintenance
name = "Maintenance Hatch"
Expand Down Expand Up @@ -1344,7 +1344,7 @@ About the new airlock wires panel:
brace.update_access()
update_icon()
if (glass)
paintable |= AIRLOCK_PAINTABLE_WINDOW
paintable |= MATERIAL_PAINTABLE_WINDOW
window_material = SSmaterials.get_material_by_name(init_material_window)
if (!window_color)
window_color = window_material.icon_colour
Expand Down
6 changes: 5 additions & 1 deletion code/game/objects/effects/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@
/obj/paint/LateInitialize(mapload)
var/turf/simulated/wall/W = get_turf(src)
if(istype(W))
W.paint_color = color
if(W.material.wall_flags & MATERIAL_PAINTABLE_MAIN)
W.paint_color = color
if(W.material.wall_flags & MATERIAL_PAINTABLE_STRIPE)
W.stripe_color = color
W.update_icon()
var/obj/structure/wall_frame/WF = locate() in loc
if(WF)
WF.paint_color = color
WF.stripe_color = color
WF.update_icon()
qdel(src)

Expand Down
126 changes: 103 additions & 23 deletions code/game/objects/items/devices/paint_sprayer.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define AIRLOCK_REGION_PAINT "Paint"
#define AIRLOCK_REGION_STRIPE "Stripe"
#define AIRLOCK_REGION_WINDOW "Window"
#define PAINT_REGION_PAINT "Paint"
#define PAINT_REGION_STRIPE "Stripe"
#define PAINT_REGION_WINDOW "Window"

#define PLACEMENT_MODE_QUARTERS 1
#define PLACEMENT_MODE_TRIANGLES 2
Expand All @@ -19,6 +19,7 @@
desc = "A slender and none-too-sophisticated device capable of applying paint on floors, walls, exosuits and certain airlocks."
var/decal = "Quarter-Tile"
var/paint_color
var/wall_paint_region = PAINT_REGION_PAINT
var/category

var/list/decals = list(
Expand Down Expand Up @@ -109,6 +110,7 @@
var/radial = list()
radial["Remove all decals"] = mutable_appearance("icons/screen/radial.dmi", "cable_invalid")
radial["Pick color"] = mutable_appearance("icons/screen/radial.dmi", "color_hexagon")
radial["Switch wall paint region"] = mutable_appearance("icons/screen/radial.dmi", "wall_paint_swap")
for (var/key in categories)
radial[key] = mutable_appearance("icons/screen/radial.dmi", categories[key]["icon_state"])
var/choice = show_radial_menu(user, user, radial, require_near = TRUE, radius = 50, tooltips = TRUE, check_locs = list(src))
Expand All @@ -121,6 +123,9 @@
if ("Pick color")
choose_color(user)
return
if ("Switch wall paint region")
choose_wall_paint_region(user)
return
category = categories[choice]["id"]
show_decals_by_category(user)

Expand Down Expand Up @@ -178,22 +183,31 @@
new_color = pick_color_from_floor(A, user)
else if (istype(A, /obj/machinery/door/airlock))
new_color = pick_color_from_airlock(A, user)
else if (istype(A, /turf/simulated/wall))
new_color = pick_color_from_wall(A, user)
else if (istype(A, /obj/structure/wall_frame))
var/obj/structure/wall_frame/wall_frame = A
new_color = wall_frame.stripe_color
else if (A.atom_flags & ATOM_FLAG_CAN_BE_PAINTED)
new_color = A.get_color()
if (!change_color(new_color, user))
to_chat(user, SPAN_WARNING("\The [A] does not have a color that you could pick from."))
return TRUE // There was an attempt to pick a color.

/obj/item/device/paint_sprayer/proc/apply_paint(atom/A, mob/user, click_parameters)
if (A.atom_flags & ATOM_FLAG_CAN_BE_PAINTED)
A.set_color(paint_color)
. = TRUE
if (istype(A, /turf/simulated/wall))
. = paint_wall(A, user)
else if (istype(A, /turf/simulated/floor))
. = paint_floor(A, user, click_parameters)
else if (istype(A, /obj/machinery/door/airlock))
. = paint_airlock(A, user)
else if (istype(A, /obj/structure/wall_frame))
. = paint_wall_frame(A, user)
else if (istype(A, /mob/living/exosuit))
to_chat(user, SPAN_WARNING("You can't paint an active exosuit. Dismantle it first."))
else if (A.atom_flags & ATOM_FLAG_CAN_BE_PAINTED)
A.set_color(paint_color)
. = TRUE
if (.)
playsound(get_turf(src), 'sound/effects/spray3.ogg', 30, 1, -6)
return .
Expand All @@ -207,6 +221,14 @@
LIST_DEC(F.decals)
F.update_icon()
. = TRUE
else if (istype(A, /turf/simulated/wall))
var/turf/simulated/wall/wall = A
wall.paint_wall(null)
wall.stripe_wall(null)
. = TRUE
else if (istype(A, /obj/structure/wall_frame))
var/obj/structure/wall_frame/wall_frame = A
. = wall_frame.stripe_wall_frame(null)
else if (istype(A, /obj/machinery/door/airlock))
var/obj/machinery/door/airlock/D = A
if (D.paintable)
Expand Down Expand Up @@ -308,11 +330,11 @@
if (!D.paintable)
return FALSE
switch (select_airlock_region(D, user, "Where do you wish to pick the color from?"))
if (AIRLOCK_REGION_PAINT)
if (PAINT_REGION_PAINT)
return D.door_color
if (AIRLOCK_REGION_STRIPE)
if (PAINT_REGION_STRIPE)
return D.stripe_color
if (AIRLOCK_REGION_WINDOW)
if (PAINT_REGION_WINDOW)
return D.window_color
else
return FALSE
Expand All @@ -323,30 +345,80 @@
return FALSE

switch (select_airlock_region(D, user, "What do you wish to paint?"))
if (AIRLOCK_REGION_PAINT)
if (PAINT_REGION_PAINT)
D.paint_airlock(paint_color)
if (AIRLOCK_REGION_STRIPE)
if (PAINT_REGION_STRIPE)
D.stripe_airlock(paint_color)
if (AIRLOCK_REGION_WINDOW)
if (PAINT_REGION_WINDOW)
D.paint_window(paint_color)
else
return FALSE
return TRUE

/obj/item/device/paint_sprayer/proc/select_airlock_region(obj/machinery/door/airlock/D, mob/user, input_text)
/obj/item/device/paint_sprayer/proc/select_airlock_region(obj/machinery/door/airlock/door, mob/user, input_text)
var/choice
var/list/choices = list()
if (D.paintable & AIRLOCK_PAINTABLE_MAIN)
choices |= AIRLOCK_REGION_PAINT
if (D.paintable & AIRLOCK_PAINTABLE_STRIPE)
choices |= AIRLOCK_REGION_STRIPE
if (D.paintable & AIRLOCK_PAINTABLE_WINDOW)
choices |= AIRLOCK_REGION_WINDOW
if (door.paintable & MATERIAL_PAINTABLE_MAIN)
choices |= PAINT_REGION_PAINT
if (door.paintable & MATERIAL_PAINTABLE_STRIPE)
choices |= PAINT_REGION_STRIPE
if (door.paintable & MATERIAL_PAINTABLE_WINDOW)
choices |= PAINT_REGION_WINDOW
choice = input(user, input_text) as null|anything in sortList(choices)
if (user.incapacitated() || !D || !user.Adjacent(D))
if (!user.use_sanity_check(door, src))
return FALSE
return choice

/obj/item/device/paint_sprayer/proc/paint_wall(turf/simulated/wall/wall, mob/user)
if(istype(wall) && (!wall.material?.wall_flags))
to_chat(user, SPAN_WARNING("You can't paint this wall type."))
return
if (!user.use_sanity_check(wall, src))
return FALSE
if(istype(wall))
if(wall_paint_region == PAINT_REGION_PAINT)
if(!(wall.material?.wall_flags & MATERIAL_PAINTABLE_MAIN))
to_chat(user, SPAN_WARNING("You can't paint this wall type."))
return FALSE
wall.paint_wall(paint_color)
return TRUE
else if(wall_paint_region == PAINT_REGION_STRIPE)
if(!(wall.material?.wall_flags & MATERIAL_PAINTABLE_STRIPE))
to_chat(user, SPAN_WARNING("You can't stripe this wall type."))
return FALSE
wall.stripe_wall(paint_color)
return TRUE


/obj/item/device/paint_sprayer/proc/pick_color_from_wall(turf/simulated/wall/wall, mob/user)
if (!wall.material || !wall.material.wall_flags)
return FALSE

switch (select_wall_region(wall, user, "Where do you wish to select the color from?"))
if (PAINT_REGION_PAINT)
return wall.paint_color
if (PAINT_REGION_STRIPE)
return wall.stripe_color
else
return FALSE

/obj/item/device/paint_sprayer/proc/select_wall_region(turf/simulated/wall/wall, mob/user, input_text)
var/list/choices = list()
if (wall.material.wall_flags & MATERIAL_PAINTABLE_MAIN)
choices |= PAINT_REGION_PAINT
if (wall.material.wall_flags & MATERIAL_PAINTABLE_STRIPE)
choices |= PAINT_REGION_STRIPE
var/choice = input(user, input_text) as null|anything in sortTim(choices, /proc/cmp_text_asc)
if (!user.use_sanity_check(wall, src))
return FALSE
return choice

/obj/item/device/paint_sprayer/proc/paint_wall_frame(obj/structure/wall_frame/wall_frame, mob/user)
if (!user.use_sanity_check(wall_frame, src))
return FALSE
wall_frame.stripe_wall_frame(paint_color)
return TRUE

/obj/item/device/paint_sprayer/proc/change_color(new_color, mob/user)
if (new_color)
paint_color = new_color
Expand Down Expand Up @@ -382,6 +454,14 @@
return
change_color(new_color, user)

/obj/item/device/paint_sprayer/proc/choose_wall_paint_region(mob/user)
if(wall_paint_region == PAINT_REGION_STRIPE)
wall_paint_region = PAINT_REGION_PAINT
to_chat(user, SPAN_NOTICE("You set \the [src] to paint walls."))
else
wall_paint_region = PAINT_REGION_STRIPE
to_chat(user, SPAN_NOTICE("You set \the [src] to stripe walls."))

/obj/item/device/paint_sprayer/verb/choose_preset_color()
set name = "Choose Preset Color"
set desc = "Choose a preset color."
Expand Down Expand Up @@ -409,9 +489,9 @@
return
user.ClickOn(A, params)

#undef AIRLOCK_REGION_PAINT
#undef AIRLOCK_REGION_STRIPE
#undef AIRLOCK_REGION_WINDOW
#undef PAINT_REGION_PAINT
#undef PAINT_REGION_STRIPE
#undef PAINT_REGION_WINDOW

#undef PLACEMENT_MODE_QUARTERS
#undef PLACEMENT_MODE_TRIANGLES
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/door_assembly.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
var/panel_icon = 'icons/obj/doors/station/panel.dmi'
var/fill_icon = 'icons/obj/doors/station/fill_steel.dmi'
var/glass_icon = 'icons/obj/doors/station/fill_glass.dmi'
var/paintable = AIRLOCK_PAINTABLE_MAIN|AIRLOCK_PAINTABLE_STRIPE
var/paintable = MATERIAL_PAINTABLE_MAIN|MATERIAL_PAINTABLE_STRIPE
var/door_color = "none"
var/stripe_color = "none"
var/symbol_color = "none"
Expand Down
24 changes: 14 additions & 10 deletions code/game/objects/structures/wall_frame.dm
Original file line number Diff line number Diff line change
Expand Up @@ -139,24 +139,23 @@
ClearOverlays()
var/image/I

var/new_color = (paint_color ? paint_color : material.icon_colour)
color = new_color
var/new_color = stripe_color ? stripe_color : material.icon_colour

for(var/i = 1 to 4)
if(other_connections[i] != "0")
I = image('icons/obj/structures/wall_frame.dmi', "frame_other[connections[i]]", dir = SHIFTL(1, i - 1))
else
I = image('icons/obj/structures/wall_frame.dmi', "frame[connections[i]]", dir = SHIFTL(1, i - 1))
I.color = new_color
AddOverlays(I)

if(stripe_color)
for(var/i = 1 to 4)
if(other_connections[i] != "0")
I = image('icons/obj/structures/wall_frame.dmi', "stripe_other[connections[i]]", dir = SHIFTL(1, i - 1))
else
I = image('icons/obj/structures/wall_frame.dmi', "stripe[connections[i]]", dir = SHIFTL(1, i - 1))
I.color = stripe_color
AddOverlays(I)
/obj/structure/wall_frame/proc/paint_wall_frame(new_paint_color)
paint_color = new_paint_color
update_icon()

/obj/structure/wall_frame/proc/stripe_wall_frame(new_paint_color)
stripe_color = new_paint_color
update_icon()

/obj/structure/wall_frame/hull/Initialize()
. = ..()
Expand All @@ -171,6 +170,7 @@
if(spacefacing)
var/bleach_factor = rand(10,50)
paint_color = adjust_brightness(paint_color, bleach_factor)
stripe_color = adjust_brightness(stripe_color, bleach_factor)
update_icon()

/obj/structure/wall_frame/on_death()
Expand All @@ -190,6 +190,7 @@
//Subtypes
/obj/structure/wall_frame/standard
paint_color = COLOR_WALL_GUNMETAL
stripe_color = COLOR_GUNMETAL

/obj/structure/wall_frame/titanium
material = MATERIAL_TITANIUM
Expand All @@ -200,9 +201,12 @@

/obj/structure/wall_frame/hull
paint_color = COLOR_SOL
stripe_color = COLOR_SOL

/obj/structure/wall_frame/hull/vox
paint_color = COLOR_GREEN_GRAY
stripe_color = COLOR_GREEN_GRAY

/obj/structure/wall_frame/hull/verne
paint_color = COLOR_GUNMETAL
stripe_color = COLOR_GUNMETAL
Loading

0 comments on commit 9b5dd9c

Please sign in to comment.