Skip to content

Commit 62135ed

Browse files
authored
Мирроры покраски (#3740)
1 parent ea5f0f1 commit 62135ed

File tree

23 files changed

+378
-139
lines changed

23 files changed

+378
-139
lines changed

baystation12.dme

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3414,6 +3414,7 @@
34143414
#include "mods\_master_files\code\game\antagonist\station\changeling.dm"
34153415
#include "mods\_master_files\code\game\gamemodes\antag_maps.dm"
34163416
#include "mods\_master_files\code\game\objects\effects\afterimages.dm"
3417+
#include "mods\_master_files\code\game\objects\effects\misc.dm"
34173418
#include "mods\_master_files\code\game\objects\effects\decals\contraband.dm"
34183419
#include "mods\_master_files\code\game\objects\items\stacks\stack.dm"
34193420
#include "mods\_master_files\code\game\objects\structures\mineral_bath.dm"
@@ -3452,6 +3453,7 @@
34523453
#include "mods\_master_files\code\modules\culture_descriptor\religion\religions_vox.dm"
34533454
#include "mods\_master_files\code\modules\events\gravity.dm"
34543455
#include "mods\_master_files\code\modules\maps\map_template.dm"
3456+
#include "mods\_master_files\code\modules\materials\definitions\materials_organic.dm"
34553457
#include "mods\_master_files\code\modules\mob\living\life.dm"
34563458
#include "mods\_master_files\code\modules\mob\living\carbon\viruses.dm"
34573459
#include "mods\_master_files\code\modules\mob\living\carbon\human\human_helpers.dm"

code/__defines/doors.dm

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,4 @@
44
/// Door is opening or closing.
55
#define DOOR_OPERATING_YES 1
66
/// Door has been emagged or is otherwise non functional.
7-
#define DOOR_OPERATING_BROKEN -1
8-
9-
10-
// Flags for `/obj/machinery/door/airlock/var/paintable`
11-
/// The main airlock body is paintable.
12-
#define AIRLOCK_PAINTABLE_MAIN FLAG_01
13-
/// The stripe decal is paintable.
14-
#define AIRLOCK_PAINTABLE_STRIPE FLAG_02
15-
/// Other detailing is paintable.
16-
#define AIRLOCK_PAINTABLE_DETAIL FLAG_03
17-
/// The window is paintable.
18-
#define AIRLOCK_PAINTABLE_WINDOW FLAG_04
7+
#define DOOR_OPERATING_BROKEN -1

code/game/machinery/doors/airlock.dm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@
7979
/// String. Partial icon state for generating the airlock appearance overlay.
8080
var/airlock_type = "Standard"
8181
var/static/list/airlock_icon_cache = list()
82-
/// Bitflag (Any of `AIRLOCK_PAINTABLE_*`). Determines what parts of the airlock can be recolored with paint.
83-
var/paintable = AIRLOCK_PAINTABLE_MAIN | AIRLOCK_PAINTABLE_STRIPE
82+
/// Bitflag (Any of `MATERIAL_PAINTABLE*`). Determines what parts of the airlock can be recolored with paint.
83+
var/paintable = MATERIAL_PAINTABLE_MAIN | MATERIAL_PAINTABLE_STRIPE
8484
/// Color. The color of the main door body.
8585
var/door_color = null
8686
/// Color. The color of the stripe detail.
@@ -255,7 +255,7 @@
255255
emag_file = 'icons/obj/doors/external/emag.dmi'
256256
assembly_type = /obj/structure/door_assembly/door_assembly_ext
257257
door_color = COLOR_NT_RED
258-
paintable = AIRLOCK_PAINTABLE_MAIN
258+
paintable = MATERIAL_PAINTABLE_MAIN
259259

260260
/obj/machinery/door/airlock/external/inherit_access_from_area()
261261
..()
@@ -380,7 +380,7 @@
380380
explosion_resistance = 20
381381
opacity = 1
382382
assembly_type = /obj/structure/door_assembly/door_assembly_hatch
383-
paintable = AIRLOCK_PAINTABLE_STRIPE
383+
paintable = MATERIAL_PAINTABLE_STRIPE
384384

385385
/obj/machinery/door/airlock/hatch/maintenance
386386
name = "Maintenance Hatch"
@@ -1344,7 +1344,7 @@ About the new airlock wires panel:
13441344
brace.update_access()
13451345
update_icon()
13461346
if (glass)
1347-
paintable |= AIRLOCK_PAINTABLE_WINDOW
1347+
paintable |= MATERIAL_PAINTABLE_WINDOW
13481348
window_material = SSmaterials.get_material_by_name(init_material_window)
13491349
if (!window_color)
13501350
window_color = window_material.icon_colour

code/game/objects/effects/misc.dm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,15 @@
1919
/obj/paint/LateInitialize(mapload)
2020
var/turf/simulated/wall/W = get_turf(src)
2121
if(istype(W))
22-
W.paint_color = color
22+
if(W.material.wall_flags & MATERIAL_PAINTABLE_MAIN)
23+
W.paint_color = color
24+
if(W.material.wall_flags & MATERIAL_PAINTABLE_STRIPE)
25+
W.stripe_color = color
2326
W.update_icon()
2427
var/obj/structure/wall_frame/WF = locate() in loc
2528
if(WF)
2629
WF.paint_color = color
30+
WF.stripe_color = color
2731
WF.update_icon()
2832
qdel(src)
2933

code/game/objects/items/devices/paint_sprayer.dm

Lines changed: 115 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#define AIRLOCK_REGION_PAINT "Paint"
2-
#define AIRLOCK_REGION_STRIPE "Stripe"
3-
#define AIRLOCK_REGION_WINDOW "Window"
1+
#define PAINT_REGION_PAINT "Paint"
2+
#define PAINT_REGION_STRIPE "Stripe"
3+
#define PAINT_REGION_WINDOW "Window"
44

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

2425
var/list/decals = list(
@@ -109,6 +110,7 @@
109110
var/radial = list()
110111
radial["Remove all decals"] = mutable_appearance("icons/screen/radial.dmi", "cable_invalid")
111112
radial["Pick color"] = mutable_appearance("icons/screen/radial.dmi", "color_hexagon")
113+
radial["Switch wall paint region"] = mutable_appearance("icons/screen/radial.dmi", "wall_paint_swap")
112114
for (var/key in categories)
113115
radial[key] = mutable_appearance("icons/screen/radial.dmi", categories[key]["icon_state"])
114116
var/choice = show_radial_menu(user, user, radial, require_near = TRUE, radius = 50, tooltips = TRUE, check_locs = list(src))
@@ -121,6 +123,9 @@
121123
if ("Pick color")
122124
choose_color(user)
123125
return
126+
if ("Switch wall paint region")
127+
choose_wall_paint_region(user)
128+
return
124129
category = categories[choice]["id"]
125130
show_decals_by_category(user)
126131

@@ -150,22 +155,22 @@
150155
var/datum/click_handler/default/paint_sprayer/CH = user.click_handlers[1]
151156
CH.paint_sprayer = src
152157
if (isrobot(user))
153-
GLOB.module_deselected_event.register(user, src, TYPE_PROC_REF(/obj/item/device/paint_sprayer, remove_click_handler))
154-
GLOB.module_deactivated_event.register(user, src, TYPE_PROC_REF(/obj/item/device/paint_sprayer, remove_click_handler))
158+
GLOB.module_deselected_event.register(user, src, PROC_REF(remove_click_handler))
159+
GLOB.module_deactivated_event.register(user, src, PROC_REF(remove_click_handler))
155160
else
156-
GLOB.hands_swapped_event.register(user, src, TYPE_PROC_REF(/obj/item/device/paint_sprayer, remove_click_handler))
157-
GLOB.mob_equipped_event.register(user, src, TYPE_PROC_REF(/obj/item/device/paint_sprayer, remove_click_handler))
158-
GLOB.mob_unequipped_event.register(user, src, TYPE_PROC_REF(/obj/item/device/paint_sprayer, remove_click_handler))
161+
GLOB.hands_swapped_event.register(user, src, PROC_REF(remove_click_handler))
162+
GLOB.mob_equipped_event.register(user, src, PROC_REF(remove_click_handler))
163+
GLOB.mob_unequipped_event.register(user, src, PROC_REF(remove_click_handler))
159164

160165
/obj/item/device/paint_sprayer/proc/remove_click_handler(mob/user)
161166
if (user.RemoveClickHandler(/datum/click_handler/default/paint_sprayer))
162-
GLOB.hands_swapped_event.unregister(user, src, TYPE_PROC_REF(/obj/item/device/paint_sprayer, remove_click_handler))
163-
GLOB.mob_equipped_event.unregister(user, src, TYPE_PROC_REF(/obj/item/device/paint_sprayer, remove_click_handler))
164-
GLOB.mob_unequipped_event.unregister(user, src, TYPE_PROC_REF(/obj/item/device/paint_sprayer, remove_click_handler))
165-
GLOB.module_deselected_event.unregister(user, src, TYPE_PROC_REF(/obj/item/device/paint_sprayer, remove_click_handler))
166-
GLOB.module_deactivated_event.unregister(user, src, TYPE_PROC_REF(/obj/item/device/paint_sprayer, remove_click_handler))
167+
GLOB.hands_swapped_event.unregister(user, src, PROC_REF(remove_click_handler))
168+
GLOB.mob_equipped_event.unregister(user, src, PROC_REF(remove_click_handler))
169+
GLOB.mob_unequipped_event.unregister(user, src, PROC_REF(remove_click_handler))
170+
GLOB.module_deselected_event.unregister(user, src, PROC_REF(remove_click_handler))
171+
GLOB.module_deactivated_event.unregister(user, src, PROC_REF(remove_click_handler))
167172

168-
/obj/item/device/paint_sprayer/use_after(atom/target, mob/living/user, click_parameters)
173+
/obj/item/device/paint_sprayer/use_before(atom/target, mob/living/user, click_parameters)
169174
if (apply_paint(target, user, click_parameters))
170175
return TRUE
171176
return ..()
@@ -178,22 +183,31 @@
178183
new_color = pick_color_from_floor(A, user)
179184
else if (istype(A, /obj/machinery/door/airlock))
180185
new_color = pick_color_from_airlock(A, user)
186+
else if (istype(A, /turf/simulated/wall))
187+
new_color = pick_color_from_wall(A, user)
188+
else if (istype(A, /obj/structure/wall_frame))
189+
var/obj/structure/wall_frame/wall_frame = A
190+
new_color = wall_frame.stripe_color
181191
else if (A.atom_flags & ATOM_FLAG_CAN_BE_PAINTED)
182192
new_color = A.get_color()
183193
if (!change_color(new_color, user))
184194
to_chat(user, SPAN_WARNING("\The [A] does not have a color that you could pick from."))
185195
return TRUE // There was an attempt to pick a color.
186196

187197
/obj/item/device/paint_sprayer/proc/apply_paint(atom/A, mob/user, click_parameters)
188-
if (A.atom_flags & ATOM_FLAG_CAN_BE_PAINTED)
189-
A.set_color(paint_color)
190-
. = TRUE
198+
if (istype(A, /turf/simulated/wall))
199+
. = paint_wall(A, user)
191200
else if (istype(A, /turf/simulated/floor))
192201
. = paint_floor(A, user, click_parameters)
193202
else if (istype(A, /obj/machinery/door/airlock))
194203
. = paint_airlock(A, user)
204+
else if (istype(A, /obj/structure/wall_frame))
205+
. = paint_wall_frame(A, user)
195206
else if (istype(A, /mob/living/exosuit))
196207
to_chat(user, SPAN_WARNING("You can't paint an active exosuit. Dismantle it first."))
208+
else if (A.atom_flags & ATOM_FLAG_CAN_BE_PAINTED)
209+
A.set_color(paint_color)
210+
. = TRUE
197211
if (.)
198212
playsound(get_turf(src), 'sound/effects/spray3.ogg', 30, 1, -6)
199213
return .
@@ -207,6 +221,14 @@
207221
LIST_DEC(F.decals)
208222
F.update_icon()
209223
. = TRUE
224+
else if (istype(A, /turf/simulated/wall))
225+
var/turf/simulated/wall/wall = A
226+
wall.paint_wall(null)
227+
wall.stripe_wall(null)
228+
. = TRUE
229+
else if (istype(A, /obj/structure/wall_frame))
230+
var/obj/structure/wall_frame/wall_frame = A
231+
. = wall_frame.stripe_wall_frame(null)
210232
else if (istype(A, /obj/machinery/door/airlock))
211233
var/obj/machinery/door/airlock/D = A
212234
if (D.paintable)
@@ -308,11 +330,11 @@
308330
if (!D.paintable)
309331
return FALSE
310332
switch (select_airlock_region(D, user, "Where do you wish to pick the color from?"))
311-
if (AIRLOCK_REGION_PAINT)
333+
if (PAINT_REGION_PAINT)
312334
return D.door_color
313-
if (AIRLOCK_REGION_STRIPE)
335+
if (PAINT_REGION_STRIPE)
314336
return D.stripe_color
315-
if (AIRLOCK_REGION_WINDOW)
337+
if (PAINT_REGION_WINDOW)
316338
return D.window_color
317339
else
318340
return FALSE
@@ -323,30 +345,80 @@
323345
return FALSE
324346

325347
switch (select_airlock_region(D, user, "What do you wish to paint?"))
326-
if (AIRLOCK_REGION_PAINT)
348+
if (PAINT_REGION_PAINT)
327349
D.paint_airlock(paint_color)
328-
if (AIRLOCK_REGION_STRIPE)
350+
if (PAINT_REGION_STRIPE)
329351
D.stripe_airlock(paint_color)
330-
if (AIRLOCK_REGION_WINDOW)
352+
if (PAINT_REGION_WINDOW)
331353
D.paint_window(paint_color)
332354
else
333355
return FALSE
334356
return TRUE
335357

336-
/obj/item/device/paint_sprayer/proc/select_airlock_region(obj/machinery/door/airlock/D, mob/user, input_text)
358+
/obj/item/device/paint_sprayer/proc/select_airlock_region(obj/machinery/door/airlock/door, mob/user, input_text)
337359
var/choice
338360
var/list/choices = list()
339-
if (D.paintable & AIRLOCK_PAINTABLE_MAIN)
340-
choices |= AIRLOCK_REGION_PAINT
341-
if (D.paintable & AIRLOCK_PAINTABLE_STRIPE)
342-
choices |= AIRLOCK_REGION_STRIPE
343-
if (D.paintable & AIRLOCK_PAINTABLE_WINDOW)
344-
choices |= AIRLOCK_REGION_WINDOW
361+
if (door.paintable & MATERIAL_PAINTABLE_MAIN)
362+
choices |= PAINT_REGION_PAINT
363+
if (door.paintable & MATERIAL_PAINTABLE_STRIPE)
364+
choices |= PAINT_REGION_STRIPE
365+
if (door.paintable & MATERIAL_PAINTABLE_WINDOW)
366+
choices |= PAINT_REGION_WINDOW
345367
choice = input(user, input_text) as null|anything in sortList(choices)
346-
if (user.incapacitated() || !D || !user.Adjacent(D))
368+
if (!user.use_sanity_check(door, src))
347369
return FALSE
348370
return choice
349371

372+
/obj/item/device/paint_sprayer/proc/paint_wall(turf/simulated/wall/wall, mob/user)
373+
if(istype(wall) && (!wall.material?.wall_flags))
374+
to_chat(user, SPAN_WARNING("You can't paint this wall type."))
375+
return
376+
if (!user.use_sanity_check(wall, src))
377+
return FALSE
378+
if(istype(wall))
379+
if(wall_paint_region == PAINT_REGION_PAINT)
380+
if(!(wall.material?.wall_flags & MATERIAL_PAINTABLE_MAIN))
381+
to_chat(user, SPAN_WARNING("You can't paint this wall type."))
382+
return FALSE
383+
wall.paint_wall(paint_color)
384+
return TRUE
385+
else if(wall_paint_region == PAINT_REGION_STRIPE)
386+
if(!(wall.material?.wall_flags & MATERIAL_PAINTABLE_STRIPE))
387+
to_chat(user, SPAN_WARNING("You can't stripe this wall type."))
388+
return FALSE
389+
wall.stripe_wall(paint_color)
390+
return TRUE
391+
392+
393+
/obj/item/device/paint_sprayer/proc/pick_color_from_wall(turf/simulated/wall/wall, mob/user)
394+
if (!wall.material || !wall.material.wall_flags)
395+
return FALSE
396+
397+
switch (select_wall_region(wall, user, "Where do you wish to select the color from?"))
398+
if (PAINT_REGION_PAINT)
399+
return wall.paint_color
400+
if (PAINT_REGION_STRIPE)
401+
return wall.stripe_color
402+
else
403+
return FALSE
404+
405+
/obj/item/device/paint_sprayer/proc/select_wall_region(turf/simulated/wall/wall, mob/user, input_text)
406+
var/list/choices = list()
407+
if (wall.material.wall_flags & MATERIAL_PAINTABLE_MAIN)
408+
choices |= PAINT_REGION_PAINT
409+
if (wall.material.wall_flags & MATERIAL_PAINTABLE_STRIPE)
410+
choices |= PAINT_REGION_STRIPE
411+
var/choice = input(user, input_text) as null|anything in sortTim(choices, GLOBAL_PROC_REF(cmp_text_asc))
412+
if (!user.use_sanity_check(wall, src))
413+
return FALSE
414+
return choice
415+
416+
/obj/item/device/paint_sprayer/proc/paint_wall_frame(obj/structure/wall_frame/wall_frame, mob/user)
417+
if (!user.use_sanity_check(wall_frame, src))
418+
return FALSE
419+
wall_frame.stripe_wall_frame(paint_color)
420+
return TRUE
421+
350422
/obj/item/device/paint_sprayer/proc/change_color(new_color, mob/user)
351423
if (new_color)
352424
paint_color = new_color
@@ -382,6 +454,14 @@
382454
return
383455
change_color(new_color, user)
384456

457+
/obj/item/device/paint_sprayer/proc/choose_wall_paint_region(mob/user)
458+
if(wall_paint_region == PAINT_REGION_STRIPE)
459+
wall_paint_region = PAINT_REGION_PAINT
460+
to_chat(user, SPAN_NOTICE("You set \the [src] to paint walls."))
461+
else
462+
wall_paint_region = PAINT_REGION_STRIPE
463+
to_chat(user, SPAN_NOTICE("You set \the [src] to stripe walls."))
464+
385465
/obj/item/device/paint_sprayer/verb/choose_preset_color()
386466
set name = "Choose Preset Color"
387467
set desc = "Choose a preset color."
@@ -409,9 +489,9 @@
409489
return
410490
user.ClickOn(A, params)
411491

412-
#undef AIRLOCK_REGION_PAINT
413-
#undef AIRLOCK_REGION_STRIPE
414-
#undef AIRLOCK_REGION_WINDOW
492+
#undef PAINT_REGION_PAINT
493+
#undef PAINT_REGION_STRIPE
494+
#undef PAINT_REGION_WINDOW
415495

416496
#undef PLACEMENT_MODE_QUARTERS
417497
#undef PLACEMENT_MODE_TRIANGLES
@@ -420,4 +500,4 @@
420500
#undef CATEGORY_TILES
421501
#undef CATEGORY_HAZARD
422502
#undef CATEGORY_WARD
423-
#undef CATEGORY_MISC
503+
#undef CATEGORY_MISC

code/game/objects/structures/door_assembly.dm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
var/panel_icon = 'icons/obj/doors/station/panel.dmi'
3232
var/fill_icon = 'icons/obj/doors/station/fill_steel.dmi'
3333
var/glass_icon = 'icons/obj/doors/station/fill_glass.dmi'
34-
var/paintable = AIRLOCK_PAINTABLE_MAIN|AIRLOCK_PAINTABLE_STRIPE
34+
var/paintable = MATERIAL_PAINTABLE_MAIN|MATERIAL_PAINTABLE_STRIPE
3535
var/door_color = "none"
3636
var/stripe_color = "none"
3737
var/symbol_color = "none"

0 commit comments

Comments
 (0)