mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 03:27:05 +01:00
Painter Item Refactor (#15828)
* Modular Painter V1 * Improved Suicide * Type & Text Also `item_state` just goes from `icon_state` so it's not needed. * Modular Painter V2 Big refactor of everything to use datums rather than separate objects. * Steel airlock stuff Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com> * Vile Heresy Co-authored-by: Sean Williams <12197162+S34NW@users.noreply.github.com> Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com> Co-authored-by: Sean Williams <12197162+S34NW@users.noreply.github.com>
This commit is contained in:
co-authored by
SteelSlayer
Sean Williams
parent
aa7f3d882f
commit
150e7e3f60
@@ -1,81 +0,0 @@
|
||||
// Airlock painter
|
||||
|
||||
/obj/item/airlock_painter
|
||||
name = "airlock painter"
|
||||
desc = "An advanced autopainter preprogrammed with several paintjobs for airlocks. Use it on a completed airlock to change its paintjob."
|
||||
icon = 'icons/obj/device.dmi'
|
||||
icon_state = "airlock_painter"
|
||||
item_state = "airlock_painter"
|
||||
flags = CONDUCT | NOBLUDGEON
|
||||
usesound = 'sound/effects/spray2.ogg'
|
||||
w_class = WEIGHT_CLASS_SMALL
|
||||
slot_flags = SLOT_BELT
|
||||
materials = list(MAT_METAL = 3000, MAT_GLASS = 1000)
|
||||
var/paint_setting
|
||||
|
||||
// All the different paint jobs that an airlock painter can apply.
|
||||
// If the airlock you're using it on is glass, the new paint job will also be glass
|
||||
var/list/available_paint_jobs = list(
|
||||
"Atmospherics" = /obj/machinery/door/airlock/atmos,
|
||||
"Command" = /obj/machinery/door/airlock/command,
|
||||
"Engineering" = /obj/machinery/door/airlock/engineering,
|
||||
"External" = /obj/machinery/door/airlock/external,
|
||||
"External Maintenance"= /obj/machinery/door/airlock/maintenance/external,
|
||||
"Freezer" = /obj/machinery/door/airlock/freezer,
|
||||
"Maintenance" = /obj/machinery/door/airlock/maintenance,
|
||||
"Medical" = /obj/machinery/door/airlock/medical,
|
||||
"Mining" = /obj/machinery/door/airlock/mining,
|
||||
"Public" = /obj/machinery/door/airlock/public,
|
||||
"Research" = /obj/machinery/door/airlock/research,
|
||||
"Science" = /obj/machinery/door/airlock/science,
|
||||
"Security" = /obj/machinery/door/airlock/security,
|
||||
"Standard" = /obj/machinery/door/airlock,
|
||||
)
|
||||
|
||||
//Only call this if you are certain that the painter will be used right after this check!
|
||||
/obj/item/airlock_painter/proc/paint(mob/user)
|
||||
playsound(loc, usesound, 30, TRUE)
|
||||
return TRUE
|
||||
|
||||
/obj/item/airlock_painter/attack_self(mob/user)
|
||||
paint_setting = input(user, "Please select a paintjob for this airlock.") as null|anything in available_paint_jobs
|
||||
if(!paint_setting)
|
||||
return
|
||||
to_chat(user, "<span class='notice'>The [paint_setting] paint setting has been selected.</span>")
|
||||
|
||||
/obj/item/airlock_painter/suicide_act(mob/user)
|
||||
|
||||
var/obj/item/organ/internal/lungs/L = user.get_organ_slot("lungs")
|
||||
var/lungs_name = "\improper[L.name]"
|
||||
|
||||
if(L)
|
||||
user.visible_message("<span class='suicide'>[user] is inhaling toner from [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
// Once you've inhaled the toner, you throw up your lungs
|
||||
// and then die.
|
||||
|
||||
// they managed to lose their lungs between then and now. Good job.
|
||||
if(!L)
|
||||
return FALSE
|
||||
|
||||
L.remove(user)
|
||||
|
||||
// make some colorful reagent, and apply it to the lungs
|
||||
L.create_reagents(10)
|
||||
L.reagents.add_reagent("colorful_reagent", 10)
|
||||
L.reagents.reaction(L, REAGENT_TOUCH, 1)
|
||||
|
||||
user.emote("scream")
|
||||
user.visible_message("<span class='suicide'>[user] vomits out [user.p_their()] [lungs_name]!</span>")
|
||||
playsound(user.loc, 'sound/effects/splat.ogg', 50, TRUE)
|
||||
|
||||
// make some vomit under the player, and apply colorful reagent
|
||||
var/obj/effect/decal/cleanable/vomit/V = new(get_turf(user))
|
||||
V.create_reagents(10)
|
||||
V.reagents.add_reagent("colorful_reagent", 10)
|
||||
V.reagents.reaction(V, REAGENT_TOUCH, 1)
|
||||
|
||||
L.forceMove(get_turf(user))
|
||||
|
||||
return OXYLOSS
|
||||
else
|
||||
return SHAME
|
||||
@@ -0,0 +1,61 @@
|
||||
/datum/painter/airlock
|
||||
module_name = "airlock painter"
|
||||
module_desc = "An advanced autopainter preprogrammed with several paintjobs for airlocks. Use it on a completed airlock to change its paintjob."
|
||||
module_state = "airlock_painter"
|
||||
|
||||
// All the different paint jobs that an airlock painter can apply.
|
||||
// If the airlock you're using it on is glass, the new paint job will also be glass
|
||||
var/list/available_paint_jobs = list(
|
||||
"Atmospherics" = /obj/machinery/door/airlock/atmos,
|
||||
"Command" = /obj/machinery/door/airlock/command,
|
||||
"Engineering" = /obj/machinery/door/airlock/engineering,
|
||||
"External" = /obj/machinery/door/airlock/external,
|
||||
"External Maintenance"= /obj/machinery/door/airlock/maintenance/external,
|
||||
"Freezer" = /obj/machinery/door/airlock/freezer,
|
||||
"Maintenance" = /obj/machinery/door/airlock/maintenance,
|
||||
"Medical" = /obj/machinery/door/airlock/medical,
|
||||
"Mining" = /obj/machinery/door/airlock/mining,
|
||||
"Public" = /obj/machinery/door/airlock/public,
|
||||
"Research" = /obj/machinery/door/airlock/research,
|
||||
"Science" = /obj/machinery/door/airlock/science,
|
||||
"Security" = /obj/machinery/door/airlock/security,
|
||||
"Standard" = /obj/machinery/door/airlock)
|
||||
|
||||
/datum/painter/airlock/pick_color(mob/user)
|
||||
var/choice = input(user, "Please select a paintjob.") as null|anything in available_paint_jobs
|
||||
if(!choice)
|
||||
return
|
||||
paint_setting = choice
|
||||
to_chat(user, "<span class='notice'>The [paint_setting] paint setting has been selected.</span>")
|
||||
|
||||
/datum/painter/airlock/paint_atom(atom/target, mob/user)
|
||||
if(!istype(target, /obj/machinery/door/airlock))
|
||||
return
|
||||
var/obj/machinery/door/airlock/A = target
|
||||
|
||||
if(!paint_setting)
|
||||
to_chat(user, "<span class='warning'>You need to select a paintjob first.</span>")
|
||||
return
|
||||
|
||||
if(!A.paintable)
|
||||
to_chat(user, "<span class='warning'>This type of airlock cannot be painted.</span>")
|
||||
return
|
||||
|
||||
var/obj/machinery/door/airlock/airlock = available_paint_jobs["[paint_setting]"] // get the airlock type path associated with the airlock name the user just chose
|
||||
var/obj/structure/door_assembly/assembly = initial(airlock.assemblytype)
|
||||
|
||||
if(A.assemblytype == assembly)
|
||||
to_chat(user, "<span class='notice'>This airlock is already painted with the \"[paint_setting]\" color scheme!</span>")
|
||||
return
|
||||
|
||||
if(A.airlock_material == "glass" && initial(assembly.noglass)) // prevents painting glass airlocks with a paint job that doesn't have a glass version, such as the freezer
|
||||
to_chat(user, "<span class='warning'>This paint job can only be applied to non-glass airlocks.</span>")
|
||||
return
|
||||
|
||||
if(do_after(user, 2 SECONDS, FALSE, A))
|
||||
// applies the user-chosen airlock's icon, overlays and assemblytype to the target airlock
|
||||
A.icon = initial(airlock.icon)
|
||||
A.overlays_file = initial(airlock.overlays_file)
|
||||
A.assemblytype = initial(airlock.assemblytype)
|
||||
A.update_icon()
|
||||
return TRUE
|
||||
+18
-33
@@ -1,20 +1,13 @@
|
||||
// Floor painter
|
||||
|
||||
/obj/item/floor_painter
|
||||
name = "floor painter"
|
||||
icon = 'icons/obj/device.dmi'
|
||||
icon_state = "floor_painter"
|
||||
item_state = "floor_painter"
|
||||
usesound = 'sound/effects/spray2.ogg'
|
||||
/datum/painter/floor
|
||||
module_name = "floor painter"
|
||||
module_state = "floor_painter"
|
||||
|
||||
var/floor_icon
|
||||
var/floor_state = "floor"
|
||||
var/floor_dir = SOUTH
|
||||
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
flags = CONDUCT
|
||||
slot_flags = SLOT_BELT
|
||||
|
||||
var/static/list/allowed_states = list("arrival", "arrivalcorner", "bar", "barber", "bcircuit", "blackcorner", "blue", "bluecorner",
|
||||
"bluefull", "bluered", "blueyellow", "blueyellowfull", "bot", "brown", "browncorner", "browncornerold", "brownold",
|
||||
"cafeteria", "caution", "cautioncorner", "chapel", "cmo", "dark", "delivery", "escape", "escapecorner", "floor",
|
||||
@@ -27,43 +20,36 @@
|
||||
"whitered", "whiteredcorner", "whiteredfull", "whiteyellow", "whiteyellowcorner", "whiteyellowfull", "yellow",
|
||||
"yellowcorner", "yellowcornersiding", "yellowsiding")
|
||||
|
||||
/obj/item/floor_painter/afterattack(atom/A, mob/user, proximity, params)
|
||||
if(!proximity)
|
||||
return
|
||||
|
||||
var/turf/simulated/floor/plasteel/F = A
|
||||
/datum/painter/floor/paint_atom(atom/target, mob/user)
|
||||
if(!istype(target, /turf/simulated/floor/plasteel))
|
||||
to_chat(user, "<span class='warning'>[holder] can only be used on station flooring.</span>")
|
||||
var/turf/simulated/floor/plasteel/F = target
|
||||
|
||||
if(F.icon_state == floor_state && F.dir == floor_dir)
|
||||
to_chat(user, "<span class='notice'>This is already painted [floor_state] [dir2text(floor_dir)]!</span>")
|
||||
return
|
||||
|
||||
if(!istype(F))
|
||||
to_chat(user, "<span class='warning'>\The [src] can only be used on station flooring.</span>")
|
||||
return
|
||||
|
||||
playsound(loc, usesound, 30, TRUE)
|
||||
F.icon_state = floor_state
|
||||
F.icon_regular_floor = floor_state
|
||||
F.dir = floor_dir
|
||||
return TRUE
|
||||
|
||||
/obj/item/floor_painter/attack_self(mob/user)
|
||||
/datum/painter/floor/pick_color(mob/user)
|
||||
if(!user)
|
||||
return 0
|
||||
user.set_machine(src)
|
||||
return
|
||||
ui_interact(user)
|
||||
return 1
|
||||
|
||||
/obj/item/floor_painter/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.inventory_state)
|
||||
/datum/painter/floor/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.inventory_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "FloorPainter", name, 405, 470, master_ui, state)
|
||||
ui = new(user, src, ui_key, "FloorPainter", module_name, 405, 470, master_ui, state)
|
||||
// Disable automatic updates, because:
|
||||
// 1) we are the only user of the item, and don't expect to observe external changes
|
||||
// 2) generating and sending the icon each tick is a bit expensive, and creates small but noticeable lag
|
||||
ui.set_autoupdate(FALSE)
|
||||
ui.open()
|
||||
|
||||
/obj/item/floor_painter/ui_data(mob/user)
|
||||
/datum/painter/floor/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["availableStyles"] = allowed_states
|
||||
data["selectedStyle"] = floor_state
|
||||
@@ -77,23 +63,22 @@
|
||||
return data
|
||||
|
||||
|
||||
/obj/item/floor_painter/ui_static_data(mob/user)
|
||||
/datum/painter/floor/ui_static_data(mob/user)
|
||||
var/list/data = list()
|
||||
|
||||
data["allStylesPreview"] = list()
|
||||
for (var/style in allowed_states)
|
||||
for(var/style in allowed_states)
|
||||
var/icon/floor_icon = icon('icons/turf/floors.dmi', style, SOUTH)
|
||||
data["allStylesPreview"][style] = icon2base64(floor_icon)
|
||||
|
||||
return data
|
||||
|
||||
/obj/item/floor_painter/ui_act(action, params)
|
||||
/datum/painter/floor/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
|
||||
if(action == "select_style")
|
||||
var/new_style = params["style"]
|
||||
if (allowed_states.Find(new_style) != 0)
|
||||
if(allowed_states.Find(new_style) != 0)
|
||||
floor_state = new_style
|
||||
|
||||
if(action == "cycle_style")
|
||||
@@ -107,7 +92,7 @@
|
||||
|
||||
if(action == "select_direction")
|
||||
var/dir = text2dir(params["direction"])
|
||||
if (dir != 0)
|
||||
if(dir != 0)
|
||||
floor_dir = dir
|
||||
|
||||
SStgui.update_uis(src)
|
||||
@@ -0,0 +1,188 @@
|
||||
/obj/item/painter
|
||||
name = "modular painter"
|
||||
icon = 'icons/obj/painting.dmi'
|
||||
usesound = 'sound/effects/spray2.ogg'
|
||||
flags = CONDUCT | NOBLUDGEON
|
||||
w_class = WEIGHT_CLASS_SMALL
|
||||
slot_flags = SLOT_BELT
|
||||
materials = list(MAT_METAL = 5000, MAT_GLASS = 2000)
|
||||
/// Associative list of painter types, with the value being the datum. (For use in the radial menu)
|
||||
var/static/list/painter_type_list = list(
|
||||
"Floor Painter" = /datum/painter/floor,
|
||||
"Pipe Painter" = /datum/painter/pipe,
|
||||
"Window Painter" = /datum/painter/pipe/window,
|
||||
"Airlock Painter" = /datum/painter/airlock)
|
||||
|
||||
/// Associative list of painter types, with the value being the icon. (For use in the radial menu)
|
||||
var/static/list/painter_icon_list = list(
|
||||
"Floor Painter" = image(icon = 'icons/obj/painting.dmi', icon_state = "floor_painter"),
|
||||
"Pipe Painter" = image(icon = 'icons/obj/painting.dmi', icon_state = "pipe_painter"),
|
||||
"Window Painter" = image(icon = 'icons/obj/painting.dmi', icon_state = "window_painter"),
|
||||
"Airlock Painter" = image(icon = 'icons/obj/painting.dmi', icon_state = "airlock_painter"))
|
||||
|
||||
/// The [/datum/painter] which is currently active.
|
||||
var/datum/painter/selected_module = null
|
||||
/// List of any instanced [/datum/painter]'s, to avoid spawning more than one of each.
|
||||
var/list/module_list = list()
|
||||
|
||||
/obj/item/painter/Initialize(mapload, datum/painter/default_module = /datum/painter/floor) // Defaults to a floor painter
|
||||
. = ..()
|
||||
change_module(default_module)
|
||||
|
||||
/obj/item/painter/Destroy()
|
||||
selected_module = null
|
||||
for(var/I in module_list)
|
||||
qdel(I)
|
||||
module_list = list()
|
||||
|
||||
return ..()
|
||||
|
||||
/obj/item/painter/examine(mob/user)
|
||||
. = ..()
|
||||
. += "<span class='notice'>Ctrl+click it in your hand to change the type!</span>"
|
||||
|
||||
|
||||
/**
|
||||
* Changes the `selected_module` variable to `new_module`, and updates the painter to reflect the new type.
|
||||
*
|
||||
* If `new_module` is already present in `module_list`, then that will be used instead.
|
||||
* Otherwise a new datum will be spawned and added to `module_list`.
|
||||
* The Name, Description, Icon State, and Item State of the painter will be updated using variables from the `new_module` datum.
|
||||
*
|
||||
* Arguments:
|
||||
* * datum/painter/new_module - The new painter datum which will be used.
|
||||
* * mob/user - The user interacting with the painter.
|
||||
*/
|
||||
/obj/item/painter/proc/change_module(datum/painter/new_module, mob/user)
|
||||
if(!new_module)
|
||||
return
|
||||
selected_module = null
|
||||
|
||||
for(var/I in module_list)
|
||||
var/datum/painter/P = I
|
||||
if(P.type == new_module)
|
||||
selected_module = I
|
||||
break
|
||||
if(!selected_module)
|
||||
var/datum/painter/P = new new_module(src, src)
|
||||
module_list += P
|
||||
selected_module = P
|
||||
|
||||
name = selected_module.module_name
|
||||
desc = selected_module.module_desc
|
||||
icon_state = selected_module.module_state
|
||||
item_state = selected_module.module_state
|
||||
if(user)
|
||||
user.update_inv_l_hand()
|
||||
user.update_inv_r_hand()
|
||||
|
||||
/**
|
||||
* Calls `pick_color()` on the `selected_module`.
|
||||
*/
|
||||
/obj/item/painter/attack_self(mob/user)
|
||||
selected_module.pick_color(user)
|
||||
|
||||
/**
|
||||
* If adjacent, calls `paint_atom()` on the `selected_module`, then plays the `usesound`.
|
||||
*/
|
||||
/obj/item/painter/afterattack(atom/target, mob/user, proximity, params)
|
||||
if(!proximity)
|
||||
return
|
||||
if(selected_module.paint_atom(target, user))
|
||||
playsound(src, usesound, 30, TRUE)
|
||||
|
||||
/**
|
||||
* Displays a radial menu for choosing a new painter module.
|
||||
*/
|
||||
/obj/item/painter/CtrlClick(mob/user)
|
||||
. = ..()
|
||||
if(!ishuman(user)) // Only want human players doing this
|
||||
return
|
||||
if(loc != user) // Not being held
|
||||
return
|
||||
|
||||
playsound(src, 'sound/effects/pop.ogg', 50, TRUE)
|
||||
var/choice = show_radial_menu(user, src, painter_icon_list, require_near = TRUE)
|
||||
var/choice_path = painter_type_list[choice]
|
||||
if(!choice_path || (selected_module.type == choice_path))
|
||||
return
|
||||
|
||||
playsound(src, 'sound/machines/click.ogg', 50, TRUE)
|
||||
do_sparks(1, FALSE, src)
|
||||
change_module(choice_path, user)
|
||||
|
||||
|
||||
/obj/item/painter/suicide_act(mob/user)
|
||||
user.visible_message("<span class='suicide'>[user] is inhaling toner from [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
playsound(src, usesound, 50, TRUE)
|
||||
var/obj/item/organ/internal/lungs/L = user.get_organ_slot("lungs")
|
||||
var/turf/T = get_turf(user)
|
||||
if(!do_mob(user, user, 3 SECONDS) || !L)
|
||||
return SHAME
|
||||
// Once you've inhaled the toner, you throw up your lungs
|
||||
// and then die.
|
||||
|
||||
L.remove(user)
|
||||
|
||||
L.create_reagents(10)
|
||||
L.reagents.add_reagent("colorful_reagent", 10)
|
||||
L.reagents.reaction(L, REAGENT_TOUCH, 1)
|
||||
L.forceMove(T)
|
||||
|
||||
user.emote("scream")
|
||||
user.visible_message("<span class='suicide'>[user] vomits out [user.p_their()] [L.name]!</span>")
|
||||
playsound(T, 'sound/effects/splat.ogg', 50, TRUE)
|
||||
|
||||
// make some vomit under the player, and apply colorful reagent
|
||||
var/obj/effect/decal/cleanable/vomit/V = new(T)
|
||||
V.create_reagents(10)
|
||||
V.reagents.add_reagent("colorful_reagent", 10)
|
||||
V.reagents.reaction(V, REAGENT_TOUCH, 1)
|
||||
|
||||
return OXYLOSS
|
||||
|
||||
|
||||
/**
|
||||
* # Painter Datum
|
||||
*
|
||||
* Contains variables for updating `holder`, as well as procs for choosing a colour and painting an atom.
|
||||
*
|
||||
* The `parent_painter` argument is REQUIRED when spawning this in order to link the datum to an [/obj/item/painter].
|
||||
*/
|
||||
/datum/painter
|
||||
/// Name of the `holder` when using this module.
|
||||
var/module_name = null
|
||||
/// Desc of the `holder` when using this module.
|
||||
var/module_desc = null
|
||||
/// Icon and Item state of the `holder` when using this module.
|
||||
var/module_state = null
|
||||
|
||||
/// The parent [/obj/item/painter] which this datum is linked to.
|
||||
var/obj/item/painter/holder
|
||||
|
||||
/// The current colour or icon state setting.
|
||||
var/paint_setting = null
|
||||
|
||||
/datum/painter/New(obj/item/painter/parent_painter)
|
||||
..()
|
||||
ASSERT(parent_painter)
|
||||
holder = parent_painter
|
||||
|
||||
/datum/painter/ui_host() // For TGUI things.
|
||||
return holder
|
||||
|
||||
/**
|
||||
* Contains code to choose a new colour or icon state for the `paint_setting` variable.
|
||||
*
|
||||
* Called by `attack_self()` on the `holder` object.
|
||||
*/
|
||||
/datum/painter/proc/pick_color(mob/user)
|
||||
return
|
||||
|
||||
/**
|
||||
* Contains code to apply the `paint_setting` variable onto the target atom.
|
||||
*
|
||||
* Called by `afterattack()` on the `holder` object.
|
||||
*/
|
||||
/datum/painter/proc/paint_atom(atom/target, mob/user)
|
||||
return
|
||||
@@ -0,0 +1,35 @@
|
||||
/datum/painter/pipe
|
||||
module_name = "pipe painter"
|
||||
module_state = "pipe_painter"
|
||||
var/static/list/blacklisted_pipes = list(/obj/machinery/atmospherics/pipe/simple/heat_exchanging, /obj/machinery/atmospherics/pipe/simple/insulated)
|
||||
var/static/list/modes = list()
|
||||
|
||||
/datum/painter/pipe/New()
|
||||
..()
|
||||
if(!length(modes))
|
||||
for(var/C in GLOB.pipe_colors)
|
||||
modes += "[C]"
|
||||
paint_setting = pick(modes)
|
||||
|
||||
/datum/painter/pipe/pick_color(mob/user)
|
||||
paint_setting = input("Which color do you want to use?", null, paint_setting) in modes
|
||||
|
||||
/datum/painter/pipe/paint_atom(atom/target, mob/user)
|
||||
if(!istype(target, /obj/machinery/atmospherics/pipe))
|
||||
return
|
||||
var/obj/machinery/atmospherics/pipe/P = target
|
||||
|
||||
if(is_type_in_list(P, blacklisted_pipes))
|
||||
return
|
||||
|
||||
if(P.pipe_color == GLOB.pipe_colors[paint_setting])
|
||||
to_chat(user, "<span class='notice'>This pipe is aready painted [paint_setting]!</span>")
|
||||
return
|
||||
|
||||
var/turf/T = get_turf(P)
|
||||
if(P.level < 2 && T.level == 1 && T.intact)
|
||||
to_chat(user, "<span class='warning'>You must remove the plating first.</span>")
|
||||
return
|
||||
|
||||
P.change_color(GLOB.pipe_colors[paint_setting])
|
||||
return TRUE
|
||||
@@ -0,0 +1,21 @@
|
||||
/datum/painter/pipe/window // Yes, this is a pipe painter subtype.
|
||||
module_name = "window painter"
|
||||
module_state = "window_painter"
|
||||
var/static/list/paintable_windows = list(
|
||||
/obj/structure/window/reinforced,
|
||||
/obj/structure/window/basic,
|
||||
/obj/structure/window/full/reinforced,
|
||||
/obj/structure/window/full/basic,
|
||||
/obj/machinery/door/window)
|
||||
|
||||
/datum/painter/pipe/window/paint_atom(atom/target, mob/user)
|
||||
if(!is_type_in_list(target, paintable_windows))
|
||||
return
|
||||
var/obj/structure/window/W = target
|
||||
|
||||
if(W.color == GLOB.pipe_colors[paint_setting])
|
||||
to_chat(user, "<span class='notice'>This window is aready painted [paint_setting]!</span>")
|
||||
return
|
||||
|
||||
W.color = GLOB.pipe_colors[paint_setting]
|
||||
return TRUE
|
||||
@@ -1,40 +0,0 @@
|
||||
/obj/item/pipe_painter
|
||||
name = "pipe painter"
|
||||
icon = 'icons/obj/device.dmi'
|
||||
icon_state = "pipe_painter"
|
||||
item_state = "pipe_painter"
|
||||
usesound = 'sound/effects/spray2.ogg'
|
||||
var/list/modes
|
||||
var/mode
|
||||
|
||||
/obj/item/pipe_painter/New()
|
||||
..()
|
||||
modes = new()
|
||||
for(var/C in GLOB.pipe_colors)
|
||||
modes += "[C]"
|
||||
mode = pick(modes)
|
||||
|
||||
/obj/item/pipe_painter/afterattack(atom/A, mob/user as mob)
|
||||
if(!istype(A,/obj/machinery/atmospherics/pipe) || istype(A,/obj/machinery/atmospherics/pipe/simple/heat_exchanging) || istype(A,/obj/machinery/atmospherics/pipe/simple/insulated) || !in_range(user, A))
|
||||
return
|
||||
var/obj/machinery/atmospherics/pipe/P = A
|
||||
|
||||
if(P.pipe_color == "[GLOB.pipe_colors[mode]]")
|
||||
to_chat(user, "<span class='notice'>This pipe is aready painted [mode]!</span>")
|
||||
return
|
||||
|
||||
var/turf/T = P.loc
|
||||
if(P.level < 2 && T.level==1 && isturf(T) && T.intact)
|
||||
to_chat(user, "<span class='warning'>You must remove the plating first.</span>")
|
||||
return
|
||||
|
||||
playsound(loc, usesound, 30, TRUE)
|
||||
P.change_color(GLOB.pipe_colors[mode])
|
||||
|
||||
|
||||
/obj/item/pipe_painter/attack_self(mob/user as mob)
|
||||
mode = input("Which colour do you want to use?", name, mode) in modes
|
||||
|
||||
/obj/item/pipe_painter/examine(mob/user)
|
||||
. = ..()
|
||||
. += "<span class='notice'>It is in [mode] mode.</span>"
|
||||
@@ -1,22 +0,0 @@
|
||||
/obj/item/pipe_painter/window_painter
|
||||
name = "window painter"
|
||||
icon_state = "window_painter"
|
||||
|
||||
var/list/paintable_windows = list(
|
||||
/obj/structure/window/reinforced,
|
||||
/obj/structure/window/basic,
|
||||
/obj/structure/window/full/reinforced,
|
||||
/obj/structure/window/full/basic,
|
||||
/obj/machinery/door/window)
|
||||
|
||||
/obj/item/pipe_painter/window_painter/afterattack(atom/A, mob/user as mob)
|
||||
if(!is_type_in_list(A, paintable_windows) || !in_range(user, A))
|
||||
return
|
||||
var/obj/structure/window/W = A
|
||||
|
||||
if(W.color == GLOB.pipe_colors[mode])
|
||||
to_chat(user, "<span class='notice'>This window is aready painted [mode]!</span>")
|
||||
return
|
||||
|
||||
playsound(loc, usesound, 30, TRUE)
|
||||
W.color = GLOB.pipe_colors[mode]
|
||||
Reference in New Issue
Block a user