Rewrites the floor painter.

This commit is contained in:
Zuhayr
2015-08-16 20:12:39 -07:00
parent e58dfe9a71
commit ac261213e9
8 changed files with 148 additions and 203 deletions

View File

@@ -4,215 +4,100 @@
icon_state = "labeler1" icon_state = "labeler1"
item_state = "flight" item_state = "flight"
var/mode_nice = "standard" var/list/decals = list(
var/mode = "floor" "white square" = /obj/effect/floor_decal/corner,
var/tile_dir_mode = 0 "blue square" = /obj/effect/floor_decal/corner/blue,
"pale blue square" = /obj/effect/floor_decal/corner/paleblue,
"green square" = /obj/effect/floor_decal/corner/green,
"lime square" = /obj/effect/floor_decal/corner/lime,
"yellow square" = /obj/effect/floor_decal/corner/yellow,
"beige square" = /obj/effect/floor_decal/corner/beige,
"red square" = /obj/effect/floor_decal/corner/red,
"pink square" = /obj/effect/floor_decal/corner/pink,
"purple square" = /obj/effect/floor_decal/corner/purple,
"mauve square" = /obj/effect/floor_decal/corner/mauve,
"orange square" = /obj/effect/floor_decal/corner/orange,
"brown square" = /obj/effect/floor_decal/corner/brown,
"grey square" = /obj/effect/floor_decal/corner/grey,
"hazard stripes" = /obj/effect/floor_decal/industrial/warning,
"corner, hazard" = /obj/effect/floor_decal/industrial/warning/corner,
"hatched marking" = /obj/effect/floor_decal/industrial/hatch,
"white outline" = /obj/effect/floor_decal/industrial/outline,
"blue outline" = /obj/effect/floor_decal/industrial/outline/blue,
"yellow outline" = /obj/effect/floor_decal/industrial/outline/yellow,
"grey outline" = /obj/effect/floor_decal/industrial/outline/grey,
"loading sign" = /obj/effect/floor_decal/industrial/loading,
"1" = /obj/effect/floor_decal/sign,
"2" = /obj/effect/floor_decal/sign/two,
"A" = /obj/effect/floor_decal/sign/a,
"B" = /obj/effect/floor_decal/sign/b,
"C" = /obj/effect/floor_decal/sign/c,
"D" = /obj/effect/floor_decal/sign/d,
"Ex" = /obj/effect/floor_decal/sign/ex,
"M" = /obj/effect/floor_decal/sign/m,
"CMO" = /obj/effect/floor_decal/sign/cmo,
"V" = /obj/effect/floor_decal/sign/v,
"Psy" = /obj/effect/floor_decal/sign/p,
"remove all decals" = /obj/effect/floor_decal/reset
)
var/decal = "remove all decals"
// mode 0 ignore direction; sets dir=0 var/list/paint_dirs = list(
// mode 1 all-direction "north" = NORTH,
// mode 2 corner selecting the side CW from the selected corner "northwest" = NORTHWEST,
// mode 3 cardinal "west" = WEST,
// mode 4 warningcorner and warnwhitecorner direction fix "southwest" = SOUTHWEST,
// mode 5 Opposite corner tiles where the second icon_state is "[mode]_inv" "south" = SOUTH,
/obj/item/device/floor_painter/afterattack(atom/A, mob/user as mob, proximity) "southeast" = SOUTHEAST,
"east" = EAST,
"northeast" = NORTHEAST,
"user-facing" = 0
)
var/paint_dir = "user-facing"
/obj/item/device/floor_painter/afterattack(var/atom/A, var/mob/user, proximity)
if(!proximity) if(!proximity)
return return
if(istype(A, /turf/simulated/floor)) var/turf/simulated/floor/F = A
var/turf/simulated/floor/F = A if(!istype(F))
user << "<span class='warning'>\The [src] can only be used on station flooring.</span>"
return
if(F.flooring && F.flooring.name == "floor") // only tiled floors if(!F.flooring || !F.flooring.can_paint || F.broken || F.burnt)
if(F.broken || F.burnt) user << "<span class='warning'>\The [src] cannot paint broken or missing tiles.</span>"
usr << "<span class='warning'>\The [F] is too damaged to repaint.</span>" return
return
if(tile_dir_mode)
var/D = get_dir(usr, F)
if(usr.loc == F)
D = usr.dir
switch(tile_dir_mode) if(F.decals && F.decals.len > 5)
if(1) // All directions accepted user << "<span class='warning'>\The [F] has been painted too much; you need to clear it off.</span>"
F.set_dir(D) return
F.icon_state = mode
if(2) // Corner mode - diagonal directions converted CW around. var/painting_decal = decals[decal]
switch(D) if(!ispath(painting_decal))
if(NORTHEAST) user << "<span class='warning'>\The [src] flashes an error light. You might need to reconfigure it.</span>"
D = EAST return
if(SOUTHEAST)
D = SOUTH var/painting_dir = 0
if(SOUTHWEST) if(paint_dir == "user-facing")
D = WEST painting_dir = user.dir
if(NORTHWEST) else if(paint_dirs[paint_dir])
D = NORTH painting_dir = paint_dirs[paint_dir]
F.set_dir(D) new painting_decal(F, painting_dir)
F.icon_state = mode
if(3) // cardinal directions only. I've adjusted diagonals the same way the facing code does.
switch(D)
if(NORTHEAST)
D = EAST
if(SOUTHEAST)
D = EAST
if(SOUTHWEST)
D = WEST
if(NORTHWEST)
D = WEST
F.set_dir(D)
F.icon_state = mode
if(4) // floors.dmi icon_states "warningcorner" and "warnwhitecorner" are incorrect, this fixes it
var/D2
switch(D)
if(NORTHEAST)
D2 = WEST
if(SOUTHEAST)
D2 = SOUTH
if(SOUTHWEST)
D2 = NORTH
if(NORTHWEST)
D2 = EAST
F.set_dir(D2)
F.icon_state = mode
if(5)
F.set_dir(0)
if(D == NORTH || D == SOUTH || D == NORTHEAST || D == SOUTHWEST)
F.icon_state = mode
else
F.icon_state = "[mode]_inv"
else
F.set_dir(0)
F.icon_state = mode
else
usr << "<span class='warning'>You can't paint that!</span>"
/obj/item/device/floor_painter/attack_self(mob/user as mob) /obj/item/device/floor_painter/attack_self(mob/user as mob)
var/type = input("What type of floor?", "Floor painter", "solid") in list("solid", "corner", "opposite corners", "side/three corners", "special", "letters")
tile_dir_mode = 0 var/choice = input("Do you wish to change the decal type or the paint direction?") as null|anything in list("Decal","Direction")
if(choice == "Decal")
switch(type) var/new_decal = input("Select a decal.") as null|anything in decals
if("solid") if(new_decal && !isnull(decals[new_decal]))
tile_dir_mode = 0 decal = new_decal
var/design = input("Which color?", "Floor painter") in list("standard", "dark", "red", "blue", "green", "yellow", "purple", "neutral", "white", "white-red", "white-blue", "white-green", "white-yellow", "white-purple", "freezer", "hydro", "showroom") user << "<span class='notice'>You set \the [src] decal to '[decal]'.</span>"
if(design == "standard") else if(choice == "Direction")
mode = "floor" var/new_dir = input("Select a direction.") as null|anything in paint_dirs
mode_nice = "standard" if(new_dir && !isnull(paint_dirs[new_dir]))
return paint_dir = new_dir
if(design == "white") user << "<span class='notice'>You set \the [src] direction to '[paint_dir]'.</span>"
mode = "white"
mode_nice = "white"
return
if(design == "dark")
mode = "dark"
mode_nice = "dark"
return
if(design == "showroom" || design == "hydro" || design == "freezer")
mode = "[design]floor"
mode_nice = design
return
mode_nice = design
mode = "[replacetext(design, "-", "")]full"
if("corner")
var/design = input("Which design?", "Floor painter") in list("black", "red", "blue", "green", "yellow", "purple", "neutral", "white", "white-red", "white-blue", "white-green", "white-yellow", "white-purple")
mode_nice = "[design] corner"
mode = "[replacetext(design, "-", "")]corner"
tile_dir_mode = 2
if("opposite corners")
var/design = input("Which design?", "Floor painter") in list("bar", "cmo", "yellowpatch", "cafeteria", "red-yellow", "red-blue", "red-green", "green-yellow", "green-blue", "blue-yellow")
mode_nice = design
if(design == "bar" || design == "cmo" || design == "yellowpatch" || design == "cafeteria")
mode = design
else
mode = "[replacetext(design, "-", "")]full"
if(design == "yellowpatch")
tile_dir_mode = 5
else
tile_dir_mode = 0
if("side/three corners")
var/design = input("Which design?", "Floor painter") in list("black", "red", "blue", "green", "yellow", "purple", "neutral", "white", "white-red", "white-blue", "white-green", "white-yellow", "white-purple", "red-yellow", "red-blue", "blue-red", "red-green", "green-yellow", "green-blue", "blue-yellow")
if(design == "white")
mode = "whitehall"
mode_nice = "white side"
else if(design == "black") // because SOMEONE made the black/grey side/corner sprite have the same name as the 'empty space' sprite :(
mode = "blackfloor"
mode_nice = design
else
mode_nice = design
mode = replacetext(design, "-", "")
tile_dir_mode = 1
if("special")
var/design = input("Which design?", "Floor painter") in list("arrival", "escape", "caution", "warning", "white-warning", "white-blue-green", "loadingarea", "delivery", "bot", "white-delivery", "white-bot")
if(design == "white-blue-green")
mode_nice = design
mode = "whitebluegreencorners"
tile_dir_mode = 2
else if(design == "delivery" || design == "bot" || design == "white-delivery" || design == "white-bot")
mode_nice = design
mode = replacetext(design, "-", "")
tile_dir_mode = 0
else if(design == "loadingarea")
mode_nice = design
mode = design
tile_dir_mode = 3
else
if(design == "white-warning")
mode_nice = design
design = "warnwhite"
var/s_corner = alert("Do you want to paint a single corner of the tile?", "Floor painter","Yes","No") == "Yes"
if(s_corner)
mode_nice = "[design] corner"
mode = "[design]corner"
if(design == "warning" || design == "white-warning") // sprites for these are weird, need to fix dirs (icons/turf/floors.dmi, "warningcorner" and "warnwhitecorner")
tile_dir_mode = 4
else
tile_dir_mode = 2
else
mode_nice = design
mode = design
tile_dir_mode = 1
if("letters")
var/which = input("Which letters/design?", "Floor painter") in list("A1", "A2", "DI", "SA", "SA (red)", "SB", "SB (red)", "SC", "SC (red)", "W (red)", "V (green)", "Psy", "Ex", "Ex (blue)", "CMO", "O (OP)", "P (OP)")
mode_nice = which
switch(which)
if("A1")
mode = "white_1"
if("A2")
mode = "white_2"
if("DI")
mode = "white_d"
if("SA")
mode = "white_a"
if("SA (red)")
mode = "whitered_a"
tile_dir_mode = 3
if("SB")
mode = "white_b"
if("SB (red)")
mode = "whitered_b"
tile_dir_mode = 3
if("SC")
mode = "white_c"
if("SC (red)")
mode = "whitered_c"
tile_dir_mode = 3
if("W (red)")
mode = "whitered_w"
tile_dir_mode = 3
if("V (green)")
mode = "whitegreen_v"
tile_dir_mode = 3
if("Psy")
mode = "white_p"
if("Ex")
mode = "white_ex"
if("Ex (blue)")
mode = "whiteblue_ex"
tile_dir_mode = 3
if("CMO") // yes this is also in "opposite corners" choices, but it's a different icon_state (!!)
mode = "white_cmo"
if("O (OP)")
mode = "white_halfo"
if("P (OP)")
mode = "white_halfp"
/obj/item/device/floor_painter/examine(mob/user) /obj/item/device/floor_painter/examine(mob/user)
..(user) ..(user)
user << "It is in [mode_nice] mode." user << "It is configured to paint the '[decal]' decal with a direction of '[paint_dir]'."

View File

@@ -36,6 +36,7 @@ var/list/flooring_types
var/descriptor = "tiles" var/descriptor = "tiles"
var/flags var/flags
var/can_paint
/decl/flooring/grass /decl/flooring/grass
name = "grass" name = "grass"
@@ -79,12 +80,14 @@ var/list/flooring_types
damage_temperature = T0C+1400 damage_temperature = T0C+1400
flags = TURF_REMOVE_CROWBAR | TURF_CAN_BREAK | TURF_CAN_BURN flags = TURF_REMOVE_CROWBAR | TURF_CAN_BREAK | TURF_CAN_BURN
build_type = /obj/item/stack/tile/floor build_type = /obj/item/stack/tile/floor
can_paint = 1
/decl/flooring/linoleum /decl/flooring/linoleum
name = "linoleum" name = "linoleum"
desc = "It's like the 2390's all over again." desc = "It's like the 2390's all over again."
icon = 'icons/turf/flooring/linoleum.dmi' icon = 'icons/turf/flooring/linoleum.dmi'
icon_base = "lino" icon_base = "lino"
can_paint = 1
/decl/flooring/tiling/red /decl/flooring/tiling/red
name = "floor" name = "floor"
@@ -153,6 +156,7 @@ var/list/flooring_types
build_time = 30 build_time = 30
apply_thermal_conductivity = 0.025 apply_thermal_conductivity = 0.025
apply_heat_capacity = 325000 apply_heat_capacity = 325000
can_paint = 1
/decl/flooring/reinforced/circuit /decl/flooring/reinforced/circuit
name = "processing strata" name = "processing strata"
@@ -160,6 +164,7 @@ var/list/flooring_types
icon_base = "bcircuit" icon_base = "bcircuit"
build_type = null build_type = null
flags = TURF_ACID_IMMUNE | TURF_CAN_BREAK flags = TURF_ACID_IMMUNE | TURF_CAN_BREAK
can_paint = 1
/decl/flooring/reinforced/circuit/green /decl/flooring/reinforced/circuit/green
name = "processing strata" name = "processing strata"
@@ -173,3 +178,4 @@ var/list/flooring_types
build_type = null build_type = null
has_damage_range = 6 has_damage_range = 6
flags = TURF_ACID_IMMUNE | TURF_CAN_BREAK flags = TURF_ACID_IMMUNE | TURF_CAN_BREAK
can_paint = null

View File

@@ -7,8 +7,14 @@ var/list/floor_decals = list()
name = "floor decal" name = "floor decal"
icon = 'icons/turf/flooring/decals.dmi' icon = 'icons/turf/flooring/decals.dmi'
layer = TURF_LAYER + 0.01 layer = TURF_LAYER + 0.01
var/supplied_dir
/obj/effect/floor_decal/New(var/newloc, var/newdir)
supplied_dir = newdir
..(newloc)
/obj/effect/floor_decal/initialize() /obj/effect/floor_decal/initialize()
if(supplied_dir) set_dir(supplied_dir)
var/turf/T = get_turf(src) var/turf/T = get_turf(src)
if(istype(T, /turf/simulated/floor) || istype(T, /turf/unsimulated/floor)) if(istype(T, /turf/simulated/floor) || istype(T, /turf/unsimulated/floor))
var/cache_key = "[alpha]-[color]-[dir]-[icon_state]-[layer]" var/cache_key = "[alpha]-[color]-[dir]-[icon_state]-[layer]"
@@ -24,6 +30,16 @@ var/list/floor_decals = list()
qdel(src) qdel(src)
return return
/obj/effect/floor_decal/reset
name = "reset marker"
/obj/effect/floor_decal/reset/initialize()
var/turf/T = get_turf(src)
if(T.decals && T.decals.len)
T.decals.Cut()
T.update_icon()
return
/obj/effect/floor_decal/corner /obj/effect/floor_decal/corner
icon_state = "corner_white" icon_state = "corner_white"
@@ -292,3 +308,37 @@ var/list/floor_decals = list()
/obj/effect/floor_decal/ss13/l16 /obj/effect/floor_decal/ss13/l16
name = "L16" name = "L16"
icon_state = "L16" icon_state = "L16"
/obj/effect/floor_decal/sign
name = "floor sign"
icon_state = "white_1"
/obj/effect/floor_decal/sign/two
icon_state = "white_2"
/obj/effect/floor_decal/sign/a
icon_state = "white_a"
/obj/effect/floor_decal/sign/b
icon_state = "white_b"
/obj/effect/floor_decal/sign/c
icon_state = "white_c"
/obj/effect/floor_decal/sign/d
icon_state = "white_d"
/obj/effect/floor_decal/sign/ex
icon_state = "white_ex"
/obj/effect/floor_decal/sign/m
icon_state = "white_m"
/obj/effect/floor_decal/sign/cmo
icon_state = "white_cmo"
/obj/effect/floor_decal/sign/v
icon_state = "white_v"
/obj/effect/floor_decal/sign/p
icon_state = "white_p"

View File

@@ -1,6 +1,6 @@
var/list/flooring_cache = list() var/list/flooring_cache = list()
/turf/simulated/floor/proc/update_icon(var/update_neighbors) /turf/simulated/floor/update_icon(var/update_neighbors)
if(lava) if(lava)
return return

View File

@@ -35,7 +35,7 @@
reinf_material = newrmaterial reinf_material = newrmaterial
update_material() update_material()
/turf/simulated/wall/proc/update_icon() /turf/simulated/wall/update_icon()
if(!material) if(!material)
return return

View File

@@ -33,6 +33,9 @@
return return
turfs |= src turfs |= src
/turf/proc/update_icon()
return
/turf/Destroy() /turf/Destroy()
turfs -= src turfs -= src
..() ..()

View File

@@ -3,4 +3,5 @@ delete-after: True
changes: changes:
- tweak: "Rewrote tiling. White floors, dark floors and freezer floors now have associated tiles." - tweak: "Rewrote tiling. White floors, dark floors and freezer floors now have associated tiles."
- tweak: "Changed how decals work in the mapper. floor_decal is now used instead of an icon in floors.dmi." - tweak: "Changed how decals work in the mapper. floor_decal is now used instead of an icon in floors.dmi."
- tweak: "The floor painter has been rewritten to use decals. Click it in-hand to set direction and decal."
- tweak: "Floor lights are now built from the autholathe, secured with a screwdriver, activated by clicking them with an empty hand, and repaired with a welding torch." - tweak: "Floor lights are now built from the autholathe, secured with a screwdriver, activated by clicking them with an empty hand, and repaired with a welding torch."

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 57 KiB