Adds roofing tiles (#5409)

* Adds roofing tiles
They're used to place plating overhead without going up a floor
And to remove weather effects

Changing a turf will correctly inherit the old outdoors variable, so that roofing tiles can check it when deciding whether to roof an area

* Adds roofing tiles
They're used to place plating overhead without going up a floor
And to remove weather effects

Changing a turf will correctly inherit the old outdoors variable, so that roofing tiles can check it when deciding whether to roof an area
This commit is contained in:
Atermonera
2018-07-14 12:24:18 -07:00
committed by VirgoBot
parent ace8b11792
commit 1216f97663
7 changed files with 154 additions and 37 deletions

View File

@@ -33,18 +33,18 @@
/turf/space/attackby(obj/item/C as obj, mob/user as mob)
if (istype(C, /obj/item/stack/rods))
if(istype(C, /obj/item/stack/rods))
var/obj/structure/lattice/L = locate(/obj/structure/lattice, src)
if(L)
return
var/obj/item/stack/rods/R = C
if (R.use(1))
user << "<span class='notice'>Constructing support lattice ...</span>"
to_chat(user, "<span class='notice'>Constructing support lattice ...</span>")
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
ReplaceWithLattice()
return
if (istype(C, /obj/item/stack/tile/floor))
if(istype(C, /obj/item/stack/tile/floor))
var/obj/structure/lattice/L = locate(/obj/structure/lattice, src)
if(L)
var/obj/item/stack/tile/floor/S = C
@@ -56,7 +56,33 @@
ChangeTurf(/turf/simulated/floor/airless)
return
else
user << "<span class='warning'>The plating is going to need some support.</span>"
to_chat(user, "<span class='warning'>The plating is going to need some support.</span>")
if(istype(C, /obj/item/stack/tile/roofing))
var/turf/T = GetAbove(src)
var/obj/item/stack/tile/roofing/R = C
// Patch holes in the ceiling
if(T)
if(istype(T, /turf/simulated/open) || istype(T, /turf/space))
// Must be build adjacent to an existing floor/wall, no floating floors
var/turf/simulated/A = locate(/turf/simulated/floor) in T.CardinalTurfs()
if(!A)
A = locate(/turf/simulated/wall) in T.CardinalTurfs()
if(!A)
to_chat(user, "<span class='warning'>There's nothing to attach the ceiling to!</span>")
return
if(R.use(1)) // Cost of roofing tiles is 1:1 with cost to place lattice and plating
T.ReplaceWithLattice()
T.ChangeTurf(/turf/simulated/floor)
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
user.visible_message("<span class='notice'>[user] expands the ceiling.</span>", "<span class='notice'>You expand the ceiling.</span>")
else
to_chat(user, "<span class='warning'>There aren't any holes in the ceiling to patch here.</span>")
return
// Space shouldn't have weather of the sort planets with atmospheres do.
// If that's changed, then you'll want to swipe the rest of the roofing code from code/game/turfs/simulated/floor_attackby.dm
return
@@ -64,7 +90,7 @@
/turf/space/Entered(atom/movable/A as mob|obj)
if(movement_disabled)
usr << "<span class='warning'>Movement is admin-disabled.</span>" //This is to identify lag problems
to_chat(usr, "<span class='warning'>Movement is admin-disabled.</span>") //This is to identify lag problems
return
..()
if ((!(A) || src != A.loc)) return