diff --git a/code/defines/obj.dm b/code/defines/obj.dm index 31a560f9268..79d2503e3d4 100644 --- a/code/defines/obj.dm +++ b/code/defines/obj.dm @@ -1042,6 +1042,7 @@ throw_speed = 3 throw_range = 3 + /obj/item/stack/sheet/rglass name = "reinforced glass" singular_name = "reinforced glass sheet" @@ -1078,9 +1079,9 @@ throw_range = 4 flags = FPRINT | TABLEPASS | CONDUCT -/obj/item/stack/tile - name = "steel floor tile" - singular_name = "steel floor tile" +/obj/item/stack/tile/steel + name = "Steel floor tile" + singular_name = "S teel floor tile" desc = "Those could work as a pretty decent throwing weapon" icon_state = "tile" w_class = 3.0 @@ -1090,4 +1091,76 @@ throw_speed = 5 throw_range = 20 flags = FPRINT | TABLEPASS | CONDUCT - max_amount = 60 \ No newline at end of file + max_amount = 60 + +/obj/item/stack/light_w + name = "Wired glass tile" + singular_name = "Wired glass tile" + desc = "" + icon_state = "glass_wire" + w_class = 3.0 + force = 6.0 + throwforce = 15.0 + throw_speed = 5 + throw_range = 20 + flags = FPRINT | TABLEPASS | CONDUCT + max_amount = 60 + + attackby(var/obj/item/O as obj, var/mob/user as mob) + ..() + if(istype(O,/obj/item/weapon/wirecutters)) + var/obj/item/weapon/cable_coil/CC = new/obj/item/weapon/cable_coil(user.loc) + CC.amount = 5 + amount-- + new/obj/item/stack/sheet/glass(user.loc) + if(amount <= 0) + user.u_equip(src) + del(src) + + if(istype(O,/obj/item/stack/sheet/metal)) + var/obj/item/stack/sheet/metal/M = O + M.amount-- + if(M.amount <= 0) + user.u_equip(M) + del(M) + amount-- + new/obj/item/stack/tile/light(user.loc) + if(amount <= 0) + user.u_equip(src) + del(src) + +/obj/item/stack/tile/light + name = "Light floor tile" + singular_name = "Light floor tile" + desc = "" + icon_state = "tile_e" + w_class = 3.0 + force = 6.0 + throwforce = 15.0 + throw_speed = 5 + throw_range = 20 + flags = FPRINT | TABLEPASS | CONDUCT + max_amount = 60 + var/on = 1 + var/state //0 = fine, 1 = flickering, 2 = breaking, 3 = broken + + New() + ..() + if(prob(5)) + state = 3 //broken + else if(prob(5)) + state = 2 //breaking + else if(prob(10)) + state = 1 //flickering occasionally + else + state = 0 //fine + + attackby(var/obj/item/O as obj, var/mob/user as mob) + ..() + if(istype(O,/obj/item/weapon/crowbar)) + new/obj/item/stack/sheet/metal(user.loc) + amount-- + new/obj/item/stack/light_w(user.loc) + if(amount <= 0) + user.u_equip(src) + del(src) \ No newline at end of file diff --git a/code/defines/turf.dm b/code/defines/turf.dm index 7d3dc3d63e3..4205e5e9384 100644 --- a/code/defines/turf.dm +++ b/code/defines/turf.dm @@ -1,6 +1,6 @@ /turf icon = 'floors.dmi' - var/intact = 1 + var/intact = 1 //for floors, use is_plating(), is_steel_floor() and is_light_floor() level = 1.0 @@ -22,6 +22,14 @@ icon_old = null pathweight = 1 + proc/is_plating() + return 0 + proc/is_steel_floor() + return 0 + proc/is_light_floor() + return 0 + + /turf/space icon = 'space.dmi' name = "space" @@ -46,25 +54,6 @@ var/to_be_destroyed = 0 //Used for fire, if a melting temperature was reached, it will be destroyed var/max_fire_temperature_sustained = 0 //The max temperature of the fire which it was subjected to -/turf/simulated/floor - name = "floor" - icon = 'floors.dmi' - icon_state = "floor" - thermal_conductivity = 0.040 - heat_capacity = 10000 - var/broken = 0 - var/burnt = 0 - - airless - name = "airless floor" - oxygen = 0.01 - nitrogen = 0.01 - temperature = TCMB - - New() - ..() - name = "floor" - /turf/simulated/floor/engine name = "reinforced floor" icon_state = "engine" @@ -81,6 +70,7 @@ /turf/simulated/floor/plating name = "plating" icon_state = "plating" + floor_tile = null intact = 0 /turf/simulated/floor/plating/airless diff --git a/code/game/machinery/bots/floorbot.dm b/code/game/machinery/bots/floorbot.dm index 21736787a4f..a86c80a53e0 100644 --- a/code/game/machinery/bots/floorbot.dm +++ b/code/game/machinery/bots/floorbot.dm @@ -99,8 +99,8 @@ /obj/machinery/bot/floorbot/attackby(var/obj/item/W , mob/user as mob) - if(istype(W, /obj/item/stack/tile)) - var/obj/item/stack/tile/T = W + if(istype(W, /obj/item/stack/tile/steel)) + var/obj/item/stack/tile/steel/T = W if(src.amount >= 50) return var/loaded = min(50-src.amount, T.amount) @@ -169,7 +169,7 @@ floorbottargets += bot.target if(src.amount <= 0 && ((src.target == null) || !src.target)) if(src.eattiles) - for(var/obj/item/stack/tile/T in view(7, src)) + for(var/obj/item/stack/tile/steel/T in view(7, src)) if(T != src.oldtarget && !(target in floorbottargets)) src.oldtarget = T src.target = T @@ -215,7 +215,7 @@ src.target = F break if((!src.target || src.target == null) && src.eattiles) - for(var/obj/item/stack/tile/T in view(7, src)) + for(var/obj/item/stack/tile/steel/T in view(7, src)) if(!(T in floorbottargets) && T != src.oldtarget) src.oldtarget = T src.target = T @@ -245,7 +245,7 @@ src.path = new() if(src.loc == src.target || src.loc == src.target.loc) - if(istype(src.target, /obj/item/stack/tile)) + if(istype(src.target, /obj/item/stack/tile/steel)) src.eattile(src.target) else if(istype(src.target, /obj/item/stack/sheet/metal)) src.maketile(src.target) @@ -270,7 +270,7 @@ if(istype(target, /turf/space/)) for(var/mob/O in viewers(src, null)) O.show_message(text("\red [src] begins to repair the hole"), 1) - var/obj/item/stack/tile/T = new /obj/item/stack/tile + var/obj/item/stack/tile/steel/T = new /obj/item/stack/tile/steel src.repairing = 1 spawn(50) T.build(src.loc) @@ -291,8 +291,8 @@ src.anchored = 0 src.target = null -/obj/machinery/bot/floorbot/proc/eattile(var/obj/item/stack/tile/T) - if(!istype(T, /obj/item/stack/tile)) +/obj/machinery/bot/floorbot/proc/eattile(var/obj/item/stack/tile/steel/T) + if(!istype(T, /obj/item/stack/tile/steel)) return for(var/mob/O in viewers(src, null)) O.show_message(text("\red [src] begins to collect tiles."), 1) @@ -326,7 +326,7 @@ src.target = null src.repairing = 0 return - var/obj/item/stack/tile/T = new /obj/item/stack/tile + var/obj/item/stack/tile/steel/T = new /obj/item/stack/tile/steel T.amount = 4 T.loc = M.loc del(M) @@ -352,7 +352,7 @@ new /obj/item/robot_parts/l_arm(Tsec) if (amount) - new /obj/item/stack/tile(Tsec) // only one tile, yes + new /obj/item/stack/tile/steel(Tsec) // only one tile, yes var/datum/effects/system/spark_spread/s = new /datum/effects/system/spark_spread s.set_up(3, 1, src) @@ -361,9 +361,9 @@ return -/obj/item/weapon/storage/toolbox/mechanical/attackby(var/obj/item/stack/tile/T, mob/user as mob) +/obj/item/weapon/storage/toolbox/mechanical/attackby(var/obj/item/stack/tile/steel/T, mob/user as mob) ..() - if(!istype(T, /obj/item/stack/tile)) + if(!istype(T, /obj/item/stack/tile/steel)) ..() return if(src.contents.len >= 1) diff --git a/code/game/objects/items/clothing.dm b/code/game/objects/items/clothing.dm index 8f172080bfd..a6d135d0ec5 100644 --- a/code/game/objects/items/clothing.dm +++ b/code/game/objects/items/clothing.dm @@ -960,7 +960,7 @@ NINJA MASK var/mob/living/carbon/human/U = usr if(candrain&&!draining) var/turf/T = U.loc - if(isturf(T) && !T.intact) + if(isturf(T) && T.is_plating()) attached = locate() in T if(!attached) U << "\red Warning: no exposed cable available." diff --git a/code/game/objects/stacks/glass.dm b/code/game/objects/stacks/glass.dm index 848ddb6b63b..25972a49eff 100644 --- a/code/game/objects/stacks/glass.dm +++ b/code/game/objects/stacks/glass.dm @@ -78,7 +78,21 @@ SHARDS /obj/item/stack/sheet/glass/attackby(obj/item/W, mob/user) ..() - if( istype(W, /obj/item/stack/rods) ) + if(istype(W,/obj/item/weapon/cable_coil)) + var/obj/item/weapon/cable_coil/CC = W + if(CC.amount < 5) + user << "\b There is not enough wire in this coil. You need 5 lengths." + CC.amount -= 5 + amount -= 1 + user << "\blue You attack wire to the [name]." + new/obj/item/stack/light_w(user.loc) + if(CC.amount <= 0) + user.u_equip(CC) + del(CC) + if(src.amount <= 0) + user.u_equip(src) + del(src) + else if( istype(W, /obj/item/stack/rods) ) var/obj/item/stack/rods/V = W var/obj/item/stack/sheet/rglass/RG = new (user.loc) RG.add_fingerprint(user) diff --git a/code/game/objects/stacks/metal.dm b/code/game/objects/stacks/metal.dm index 08dba690dd1..bf78eacf2c9 100644 --- a/code/game/objects/stacks/metal.dm +++ b/code/game/objects/stacks/metal.dm @@ -66,7 +66,7 @@ var/global/list/datum/stack_recipe/metal_recipes = list ( \ null, \ new/datum/stack_recipe("canister", /obj/machinery/portable_atmospherics/canister, 2, one_per_turf = 1), \ null, \ - new/datum/stack_recipe("floor tile", /obj/item/stack/tile, 1, 4, 10), \ + new/datum/stack_recipe("floor tile", /obj/item/stack/tile/steel, 1, 4, 10), \ new/datum/stack_recipe("metal rod", /obj/item/stack/rods, 1, 2, 60), \ new/datum/stack_recipe("reinforced sheet", /obj/item/stack/sheet/r_metal, 2, 1, 50), \ null, \ @@ -102,13 +102,13 @@ var/global/list/datum/stack_recipe/r_metal_recipes = list ( \ // TILES -/obj/item/stack/tile/New(var/loc, var/amount=null) +/obj/item/stack/tile/steel/New(var/loc, var/amount=null) ..() src.pixel_x = rand(1, 14) src.pixel_y = rand(1, 14) return -/obj/item/stack/tile/attack_self(mob/user as mob) +/obj/item/stack/tile/steel/attack_self(mob/user as mob) if (usr.stat) return var/T = user.loc @@ -123,7 +123,7 @@ var/global/list/datum/stack_recipe/r_metal_recipes = list ( \ use(1) return -/obj/item/stack/tile/proc/build(turf/S as turf) +/obj/item/stack/tile/steel/proc/build(turf/S as turf) var/turf/simulated/floor/W = S.ReplaceWithFloor() - W.to_plating() + W.make_plating() return \ No newline at end of file diff --git a/code/game/turf.dm b/code/game/turf.dm index f4d925d191e..45ea7a45334 100644 --- a/code/game/turf.dm +++ b/code/game/turf.dm @@ -138,14 +138,12 @@ return W /turf/proc/ReplaceWithEngineFloor() - var/prior_icon = icon_old var/old_dir = dir var/turf/simulated/floor/engine/E = new /turf/simulated/floor/engine( locate(src.x, src.y, src.z) ) E.dir = old_dir - if(prior_icon) E.icon_state = prior_icon - else E.icon_state = "engine" + E.icon_state = "engine" /turf/simulated/Entered(atom/A, atom/OL) if (istype(A,/mob/living/carbon)) @@ -339,7 +337,7 @@ O.density = 1 O.layer = 5 var/turf/simulated/floor/F = ReplaceWithFloor() - F.to_plating() + F.make_plating() F.burn_tile() user << "\red The thermite melts the wall." spawn(100) del(O) @@ -405,7 +403,7 @@ O.density = 1 O.layer = 5 var/turf/simulated/floor/F = ReplaceWithFloor() - F.to_plating() + F.make_plating() F.burn_tile() user << "\red The thermite melts the wall." spawn(100) del(O) @@ -514,6 +512,60 @@ dismantle_wall() return 0 + +//This is so damaged or burnt tiles or platings don't get remembered as the default tile +var/list/icons_to_ignore_at_floor_init = list("damaged1","damaged2","damaged3","damaged4", + "damaged5","panelscorched","floorscorched1","floorscorched2","platingdmg1","platingdmg2", + "platingdmg3","plating","light_on","light_on_flicker1","light_on_flicker2", + "light_on_clicker3","light_on_clicker4","light_on_clicker5","light_broken", + "light_on_broken","light_off",) + +/turf/simulated/floor + + //Note to coders, the 'intact' var can no longer be used to determine if the floor is a plating or not. + //Use the is_plating(), is_sttel_floor() and is_light_floor() procs instead. --Errorage + name = "floor" + icon = 'floors.dmi' + icon_state = "floor" + var/icon_regular_floor = "floor" //used to remember what icon the tile should have by default + thermal_conductivity = 0.040 + heat_capacity = 10000 + var/broken = 0 + var/burnt = 0 + var/obj/item/stack/tile/floor_tile = new/obj/item/stack/tile/steel + + airless + name = "airless floor" + oxygen = 0.01 + nitrogen = 0.01 + temperature = TCMB + + New() + ..() + name = "floor" + + light + name = "Light floor" + luminosity = 5 + icon_state = "light_on" + floor_tile = new/obj/item/stack/tile/light + + New() + floor_tile.New() //I guess New() isn't run on objects spawned without the definition of a turf to house them, ah well. + var/n = name //just in case commands rename it in the ..() call + ..() + spawn(4) + update_icon() + name = n + + +/turf/simulated/floor/New() + ..() + if(icon_state in icons_to_ignore_at_floor_init) //so damaged/burned tiles or plating icons aren't saved as the default + icon_regular_floor = "floor" + else + icon_regular_floor = icon_state + /turf/simulated/floor/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) if ((istype(mover, /obj/machinery/vehicle) && !(src.burnt))) if (!( locate(/obj/machinery/mass_driver, src) )) @@ -549,13 +601,43 @@ return turf/simulated/floor/proc/update_icon() + if(is_steel_floor()) + if(!broken && !burnt) + icon_state = icon_regular_floor + if(is_plating()) + if(!broken && !burnt) + icon_state = "plating" + if(is_light_floor()) + var/obj/item/stack/tile/light/T = floor_tile + if(T.on) + switch(T.state) + if(0) + icon_state = "light_on" + sd_SetLuminosity(5) + if(1) + var/num = pick("1","2","3","4") + icon_state = "light_on_flicker[num]" + sd_SetLuminosity(5) + if(2) + icon_state = "light_on_broken" + sd_SetLuminosity(5) + if(3) + icon_state = "light_off" + sd_SetLuminosity(0) + else + sd_SetLuminosity(0) + icon_state = "light_off" + /turf/simulated/floor/attack_paw(mob/user as mob) return src.attack_hand(user) /turf/simulated/floor/attack_hand(mob/user as mob) - + if (is_light_floor()) + var/obj/item/stack/tile/light/T = floor_tile + T.on = !T.on + update_icon() if ((!( user.canmove ) || user.restrained() || !( user.pulling ))) return if (user.pulling.anchored) @@ -584,58 +666,116 @@ turf/simulated/floor/proc/update_icon() new /obj/item/stack/rods(src, 2) ReplaceWithFloor() var/turf/simulated/floor/F = src - F.to_plating() + F.make_plating() return -/turf/simulated/floor/proc/to_plating() - if(istype(src,/turf/simulated/floor/engine)) return - if(!intact) return - if(!icon_old) icon_old = icon_state - src.icon_state = "plating" - intact = 0 - broken = 0 - burnt = 0 - levelupdate() - /turf/simulated/floor/proc/gets_drilled() return /turf/simulated/floor/proc/break_tile_to_plating() - if(intact) to_plating() + if(!is_plating()) make_plating() break_tile() +/turf/simulated/floor/is_steel_floor() + if(istype(floor_tile,/obj/item/stack/tile/steel)) + return 1 + else + return 0 + +/turf/simulated/floor/is_light_floor() + if(istype(floor_tile,/obj/item/stack/tile/light)) + return 1 + else + return 0 + +/turf/simulated/floor/is_plating() + if(!floor_tile) + return 1 + else + return 0 + /turf/simulated/floor/proc/break_tile() if(istype(src,/turf/simulated/floor/engine)) return if(istype(src,/turf/simulated/floor/mech_bay_recharge_floor)) src.ReplaceWithPlating() if(broken) return - if(!icon_old) icon_old = icon_state - if(intact) + if(is_steel_floor()) src.icon_state = "damaged[pick(1,2,3,4,5)]" broken = 1 - else + else if(is_steel_floor()) + src.icon_state = "light_broken" + broken = 1 + else if(is_plating()) src.icon_state = "platingdmg[pick(1,2,3)]" broken = 1 /turf/simulated/floor/proc/burn_tile() if(istype(src,/turf/simulated/floor/engine)) return if(broken || burnt) return - if(!icon_old) icon_old = icon_state - if(intact) + if(is_steel_floor()) + src.icon_state = "damaged[pick(1,2,3,4,5)]" + burnt = 1 + else if(is_steel_floor()) src.icon_state = "floorscorched[pick(1,2)]" - else + burnt = 1 + else if(is_plating()) src.icon_state = "panelscorched" - burnt = 1 + burnt = 1 -/turf/simulated/floor/proc/restore_tile() - if(intact) return - intact = 1 +//This proc will delete the floor_tile and the update_iocn() proc will then change the icon_state of the turf +/turf/simulated/floor/proc/make_plating() + if(istype(src,/turf/simulated/floor/engine)) return + if(!floor_tile) return + del(floor_tile) + sd_SetLuminosity(0) + floor_tile = null + intact = 0 broken = 0 burnt = 0 - if(icon_old) - icon_state = icon_old - else - icon_state = "floor" + + update_icon() + levelupdate() + +//This proc will make the turf a steel floor tile. The expected argument is the tile to make the turf with +//If none is given it will make a new object. dropping or unequipping must be handled before or after calling +//this proc. +/turf/simulated/floor/proc/make_steel_floor(var/obj/item/stack/tile/steel/T = null) + broken = 0 + burnt = 0 + intact = 1 + sd_SetLuminosity(0) + if(T) + if(istype(T,/obj/item/stack/tile/steel)) + floor_tile = T + if (icon_regular_floor) + icon_state = icon_regular_floor + else + icon_state = "floor" + icon_regular_floor = icon_state + return + //if you gave a valid parameter, it won't get thisf ar. + floor_tile = new/obj/item/stack/tile/steel + icon_state = "floor" + icon_regular_floor = icon_state + + update_icon() + levelupdate() + +//This proc will make the turf a light floor tile. The expected argument is the tile to make the turf with +//If none is given it will make a new object. dropping or unequipping must be handled before or after calling +//this proc. +/turf/simulated/floor/proc/make_light_floor(var/obj/item/stack/tile/light/T = null) + broken = 0 + burnt = 0 + intact = 1 + if(T) + if(istype(T,/obj/item/stack/tile/light)) + floor_tile = T + return + //if you gave a valid parameter, it won't get thisf ar. + floor_tile = new/obj/item/stack/tile/light + + update_icon() levelupdate() /turf/simulated/floor/attackby(obj/item/C as obj, mob/user as mob) @@ -643,22 +783,35 @@ turf/simulated/floor/proc/update_icon() if(!C || !user) return 0 - if(istype(C, /obj/item/weapon/crowbar) && intact) + if(istype(C,/obj/item/weapon/light/bulb)) //only for light tiles + if(is_light_floor()) + var/obj/item/stack/tile/light/T = floor_tile + if(T.state) + user.u_equip(C) + del(C) + T.state = C //fixing it by bashing it with a light bulb, fun eh? + update_icon() + user << "\blue You replace the light bulb." + else + user << "\blue The lightbulb seems fine, no need to replace it." + + if(istype(C, /obj/item/weapon/crowbar) && (!(is_plating()))) if(broken || burnt) user << "\red You remove the broken plating." else - new /obj/item/stack/tile(src) + user << "\red You remove the [floor_tile.name]." + new floor_tile.type(src) - to_plating() + make_plating() playsound(src.loc, 'Crowbar.ogg', 80, 1) return if(istype(C, /obj/item/stack/rods)) - if (!src.intact) + if (is_plating()) if (C:amount >= 2) user << "\blue Reinforcing the floor..." - if(do_after(user, 30) && C && C:amount >= 2 && !src.intact) + if(do_after(user, 30) && C && C:amount >= 2 && is_plating()) ReplaceWithEngineFloor() playsound(src.loc, 'Deconstruct.ogg', 80, 1) C:use(2) @@ -669,14 +822,24 @@ turf/simulated/floor/proc/update_icon() user << "\red You must remove the plating first." return - if(istype(C, /obj/item/stack/tile) && !intact) - restore_tile() - var/obj/item/stack/tile/T = C - playsound(src.loc, 'Genhit.ogg', 50, 1) - T.use(1) + if(istype(C, /obj/item/stack/tile)) + if(is_plating()) + var/obj/item/stack/tile/T = C + floor_tile = new T.type + intact = 1 + if(istype(T,/obj/item/stack/tile/light)) + floor_tile:state = T:state + floor_tile:on = T:on + T.use(1) + update_icon() + levelupdate() + playsound(src.loc, 'Genhit.ogg', 50, 1) + else + user << "\blue This section already has a tile on it. Use a crowbar to pry it off." + if(istype(C, /obj/item/weapon/cable_coil)) - if(!intact) + if(is_plating()) var/obj/item/weapon/cable_coil/coil = C coil.turf_place(src, user) else @@ -733,7 +896,7 @@ turf/simulated/floor/proc/update_icon() C:use(1) return - if (istype(C, /obj/item/stack/tile)) + if (istype(C, /obj/item/stack/tile/steel)) var/obj/lattice/L = locate(/obj/lattice, src) if(L) del(L) diff --git a/icons/obj/items.dmi b/icons/obj/items.dmi index 12620e5b12b..8f0f542ac5c 100644 Binary files a/icons/obj/items.dmi and b/icons/obj/items.dmi differ diff --git a/icons/turf/floors.dmi b/icons/turf/floors.dmi index 1cebe6b279a..17f49f85eb5 100644 Binary files a/icons/turf/floors.dmi and b/icons/turf/floors.dmi differ