From cd5720b6a70d576a277322f8376c41d5dd41230c Mon Sep 17 00:00:00 2001 From: tkdrg Date: Sun, 19 Oct 2014 16:16:00 -0300 Subject: [PATCH 1/5] Floor refactor, try #1 --- .../machinery/computer/HolodeckControl.dm | 12 +- .../mecha/equipment/tools/medical_tools.dm | 4 +- code/game/mecha/mech_bay.dm | 2 + code/game/objects/items/stacks/tiles/light.dm | 4 +- .../objects/items/stacks/tiles/plasteel.dm | 1 + .../items/stacks/tiles/tile_mineral.dm | 6 + .../objects/items/stacks/tiles/tile_types.dm | 16 +- code/game/turfs/simulated/floor.dm | 544 ++---------------- .../game/turfs/simulated/floor/fancy_floor.dm | 156 +++++ .../game/turfs/simulated/floor/light_floor.dm | 60 ++ .../mineral_floor.dm} | 130 +++-- code/game/turfs/simulated/floor/misc_floor.dm | 90 +++ code/game/turfs/simulated/floor/plating.dm | 140 +++++ code/game/turfs/simulated/floor_types.dm | 208 ------- code/game/turfs/turf.dm | 21 - code/modules/mining/mine_turfs.dm | 3 + code/modules/recycling/disposal.dm | 10 +- tgstation.dme | 49 +- 18 files changed, 669 insertions(+), 787 deletions(-) create mode 100644 code/game/turfs/simulated/floor/fancy_floor.dm create mode 100644 code/game/turfs/simulated/floor/light_floor.dm rename code/game/turfs/simulated/{floor_mineral.dm => floor/mineral_floor.dm} (50%) create mode 100644 code/game/turfs/simulated/floor/misc_floor.dm create mode 100644 code/game/turfs/simulated/floor/plating.dm delete mode 100644 code/game/turfs/simulated/floor_types.dm diff --git a/code/game/machinery/computer/HolodeckControl.dm b/code/game/machinery/computer/HolodeckControl.dm index dbba680f885..99e625ef75d 100644 --- a/code/game/machinery/computer/HolodeckControl.dm +++ b/code/game/machinery/computer/HolodeckControl.dm @@ -288,13 +288,13 @@ gender = PLURAL name = "lush grass" icon_state = "grass1" - floor_tile = new/obj/item/stack/tile/grass + floor_tile = /obj/item/stack/tile/grass - New() - floor_tile.New() //I guess New() isn't run on objects spawned without the definition of a turf to house them, ah well. - icon_state = "grass[pick("1","2","3","4")]" - ..() - spawn(4) +/turf/simulated/floor/holofloor/grass/New() + icon_state = "grass[pick("1","2","3","4")]" + ..() + spawn(4) + if(src) update_icon() for(var/direction in cardinal) if(istype(get_step(src,direction),/turf/simulated/floor)) diff --git a/code/game/mecha/equipment/tools/medical_tools.dm b/code/game/mecha/equipment/tools/medical_tools.dm index 4cfc457473d..c258789e7c6 100644 --- a/code/game/mecha/equipment/tools/medical_tools.dm +++ b/code/game/mecha/equipment/tools/medical_tools.dm @@ -352,9 +352,9 @@ /obj/item/mecha_parts/mecha_equipment/tool/cable_layer/proc/dismantleFloor(var/turf/new_turf) if(istype(new_turf, /turf/simulated/floor)) var/turf/simulated/floor/T = new_turf - if(!T.is_plating()) + if(!istype(T, /turf/simulated/floor/plating)) if(!T.broken && !T.burnt) - new T.floor_tile.type(T) + new T.floor_tile(T) T.make_plating() return !new_turf.intact diff --git a/code/game/mecha/mech_bay.dm b/code/game/mecha/mech_bay.dm index 23417f8f67b..53e3d9ed383 100644 --- a/code/game/mecha/mech_bay.dm +++ b/code/game/mecha/mech_bay.dm @@ -3,6 +3,8 @@ icon = 'icons/turf/floors.dmi' // That are set in stone to check the west turf for recharge port icon_state = "recharge_floor" // Some people just want to watch the world burn i guess +/turf/simulated/floor/mech_bay_recharge_floor/break_tile() + src.ChangeTurf(/turf/simulated/floor/plating) /turf/simulated/floor/mech_bay_recharge_floor/airless icon_state = "recharge_floor_asteroid" diff --git a/code/game/objects/items/stacks/tiles/light.dm b/code/game/objects/items/stacks/tiles/light.dm index 429829cc7fc..2a208746460 100644 --- a/code/game/objects/items/stacks/tiles/light.dm +++ b/code/game/objects/items/stacks/tiles/light.dm @@ -11,8 +11,8 @@ flags = CONDUCT max_amount = 60 attack_verb = list("bashed", "battered", "bludgeoned", "thrashed", "smashed") - var/on = 1 - var/state //0 = fine, 1 = flickering, 2 = breaking, 3 = broken + turf_type = /turf/simulated/floor/light + var/state = 0 /obj/item/stack/tile/light/New(var/loc, var/amount=null) ..() diff --git a/code/game/objects/items/stacks/tiles/plasteel.dm b/code/game/objects/items/stacks/tiles/plasteel.dm index 5e922c9a6c5..6f5e2342f9d 100644 --- a/code/game/objects/items/stacks/tiles/plasteel.dm +++ b/code/game/objects/items/stacks/tiles/plasteel.dm @@ -11,6 +11,7 @@ throw_range = 7 flags = CONDUCT max_amount = 60 + turf_type = /turf/simulated/floor /obj/item/stack/tile/plasteel/cyborg desc = "The ground you walk on" //Not the usual floor tile desc as that refers to throwing, Cyborgs can't do that - RR diff --git a/code/game/objects/items/stacks/tiles/tile_mineral.dm b/code/game/objects/items/stacks/tiles/tile_mineral.dm index 05177a54409..3a94618d548 100644 --- a/code/game/objects/items/stacks/tiles/tile_mineral.dm +++ b/code/game/objects/items/stacks/tiles/tile_mineral.dm @@ -10,6 +10,7 @@ throw_range = 7 max_amount = 60 origin_tech = "plasma=1" + turf_type = /turf/simulated/floor/mineral/plasma /obj/item/stack/tile/mineral/uranium name = "uranium tile" @@ -23,6 +24,7 @@ throw_range = 7 max_amount = 60 origin_tech = "material=1" + turf_type = /turf/simulated/floor/mineral/uranium /obj/item/stack/tile/mineral/gold name = "gold tile" @@ -36,6 +38,7 @@ throw_range = 7 max_amount = 60 origin_tech = "material=1" + turf_type = /turf/simulated/floor/mineral/gold /obj/item/stack/tile/mineral/silver name = "silver tile" @@ -49,6 +52,7 @@ throw_range = 7 max_amount = 60 origin_tech = "material=1" + turf_type = /turf/simulated/floor/mineral/silver /obj/item/stack/tile/mineral/diamond name = "diamond tile" @@ -62,6 +66,7 @@ throw_range = 7 max_amount = 60 origin_tech = "material=2" + turf_type = /turf/simulated/floor/mineral/diamond /obj/item/stack/tile/mineral/bananium name = "bananium tile" @@ -75,4 +80,5 @@ throw_range = 7 max_amount = 60 origin_tech = "material=1" + turf_type = /turf/simulated/floor/mineral/bananium diff --git a/code/game/objects/items/stacks/tiles/tile_types.dm b/code/game/objects/items/stacks/tiles/tile_types.dm index c44038b6638..e33991a7186 100644 --- a/code/game/objects/items/stacks/tiles/tile_types.dm +++ b/code/game/objects/items/stacks/tiles/tile_types.dm @@ -1,10 +1,20 @@ -/* Diffrent misc types of tiles +/* Diffrent misc types of tiles & the tile prototype * Contains: + Tile * Grass * Wood * Carpet */ +/* + * Tile + */ +/obj/item/stack/tile + name = "broken tile" + singular_name = "broken tile" + desc = "A broken tile. This should not exist." + var/turf_type = null + /* * Grass */ @@ -20,6 +30,7 @@ throw_range = 7 max_amount = 60 origin_tech = "biotech=1" + turf_type = /turf/simulated/floor/grass /* * Wood @@ -36,6 +47,8 @@ throw_range = 7 max_amount = 60 origin_tech = "biotech=1" + turf_type = /turf/simulated/floor/wood + /* * Carpets */ @@ -50,3 +63,4 @@ throw_speed = 3 throw_range = 7 max_amount = 60 + turf_type = /turf/simulated/floor/carpet diff --git a/code/game/turfs/simulated/floor.dm b/code/game/turfs/simulated/floor.dm index 4e8ae18a48c..583ceafab6b 100644 --- a/code/game/turfs/simulated/floor.dm +++ b/code/game/turfs/simulated/floor.dm @@ -12,22 +12,10 @@ var/list/icons_to_ignore_at_floor_init = list("damaged1","damaged2","damaged3"," "ironsand6", "ironsand7", "ironsand8", "ironsand9", "ironsand10", "ironsand11", "ironsand12", "ironsand13", "ironsand14", "ironsand15") -var/list/plating_icons = list("plating","platingdmg1","platingdmg2","platingdmg3","asteroid","asteroid_dug", - "ironsand1", "ironsand2", "ironsand3", "ironsand4", "ironsand5", "ironsand6", "ironsand7", - "ironsand8", "ironsand9", "ironsand10", "ironsand11", - "ironsand12", "ironsand13", "ironsand14", "ironsand15") -var/list/wood_icons = list("wood","wood-broken") -var/list/gold_icons = list("gold","gold_dam") -var/list/silver_icons = list("silver","silver_dam") -var/list/plasma_icons = list("plasma","plasma_dam") -var/list/diamond_icons = list("diamond","diamond_dam") -var/list/uranium_icons = list("uranium","uranium_dam") -var/list/bananium_icons = list("bananium","bananium_dam") - /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_plasteel_floor() and is_light_floor() procs instead. --Errorage + //NOTE: Floor code has been refactored, many procs were removed + //using intact should be safe, you can also use istype + //also worhy of note: floor_tile is now a path, and not a tile obj name = "floor" icon = 'icons/turf/floors.dmi' icon_state = "floor" @@ -36,12 +24,15 @@ var/list/bananium_icons = list("bananium","bananium_dam") var/icon_plating = "plating" thermal_conductivity = 0.040 heat_capacity = 10000 + intact = 1 var/lava = 0 var/broken = 0 var/burnt = 0 var/mineral = "metal" var/floortype = "metal" - var/obj/item/stack/tile/floor_tile = new/obj/item/stack/tile/plasteel + var/floor_tile = /obj/item/stack/tile/plasteel + var/list/broken_states = list("damaged1", "damaged2", "damaged3", "damaged4", "damaged5") + var/list/burnt_states = list() /turf/simulated/floor/New() @@ -70,10 +61,7 @@ var/list/bananium_icons = list("bananium","bananium_dam") if(2) src.ChangeTurf(/turf/space) if(3) - if(prob(80)) - src.break_tile_to_plating() - else - src.break_tile() + src.break_tile() src.hotspot_expose(1000,CELL_VOLUME) if(prob(33)) new /obj/item/stack/sheet/metal(src) if(3.0) @@ -85,506 +73,90 @@ var/list/bananium_icons = list("bananium","bananium_dam") /turf/simulated/floor/blob_act() return -turf/simulated/floor/proc/update_icon() +/turf/simulated/floor/proc/update_icon() if(lava) - return + return 0 else if(is_plasteel_floor()) if(!broken && !burnt) icon_state = icon_regular_floor - else if(is_plating()) - if(!broken && !burnt) - icon_state = icon_plating //Because asteroids are 'platings' too. - else 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" - SetLuminosity(1) - if(1) - var/num = pick("1","2","3","4") - icon_state = "light_on_flicker[num]" - SetLuminosity(1) - if(2) - icon_state = "light_on_broken" - SetLuminosity(1) - if(3) - icon_state = "light_off" - SetLuminosity(0) - else - SetLuminosity(0) - icon_state = "light_off" - else if(is_grass_floor()) - if(!broken && !burnt) - if(!(icon_state in list("grass1","grass2","grass3","grass4"))) - icon_state = "grass[pick("1","2","3","4")]" - else if(is_carpet_floor()) - if(!broken && !burnt) - if(icon_state == "carpetsymbol") //le snowflake :^) - return - - var/connectdir = 0 - for(var/direction in cardinal) - if(istype(get_step(src,direction),/turf/simulated/floor)) - var/turf/simulated/floor/FF = get_step(src,direction) - if(FF.is_carpet_floor()) - connectdir |= direction - - //Check the diagonal connections for corners, where you have, for example, connections both north and east. In this case it checks for a north-east connection to determine whether to add a corner marker or not. - var/diagonalconnect = 0 //1 = NE; 2 = SE; 4 = NW; 8 = SW - - //Northeast - if(connectdir & NORTH && connectdir & EAST) - if(istype(get_step(src,NORTHEAST),/turf/simulated/floor)) - var/turf/simulated/floor/FF = get_step(src,NORTHEAST) - if(FF.is_carpet_floor()) - diagonalconnect |= 1 - - //Southeast - if(connectdir & SOUTH && connectdir & EAST) - if(istype(get_step(src,SOUTHEAST),/turf/simulated/floor)) - var/turf/simulated/floor/FF = get_step(src,SOUTHEAST) - if(FF.is_carpet_floor()) - diagonalconnect |= 2 - - //Northwest - if(connectdir & NORTH && connectdir & WEST) - if(istype(get_step(src,NORTHWEST),/turf/simulated/floor)) - var/turf/simulated/floor/FF = get_step(src,NORTHWEST) - if(FF.is_carpet_floor()) - diagonalconnect |= 4 - - //Southwest - if(connectdir & SOUTH && connectdir & WEST) - if(istype(get_step(src,SOUTHWEST),/turf/simulated/floor)) - var/turf/simulated/floor/FF = get_step(src,SOUTHWEST) - if(FF.is_carpet_floor()) - diagonalconnect |= 8 - - icon_state = "carpet[connectdir]-[diagonalconnect]" - - else if(is_wood_floor()) - if(!broken && !burnt) - if( !(icon_state in wood_icons) ) - icon_state = "wood" - //world << "[icon_state]y's got [icon_state]" - - else if(is_gold_floor()) - if(!broken && !burnt) - if( !(icon_state in gold_icons) ) - icon_state = "gold" - - else if(is_silver_floor()) - if(!broken && !burnt) - if( !(icon_state in silver_icons) ) - icon_state = "silver" - - else if(is_plasma_floor()) - if(!broken && !burnt) - if( !(icon_state in plasma_icons) ) - icon_state = "plasma" - - else if(is_uranium_floor()) - if(!broken && !burnt) - if( !(icon_state in uranium_icons) ) - icon_state = "uranium" - - else if(is_diamond_floor()) - if(!broken && !burnt) - if( !(icon_state in diamond_icons) ) - icon_state = "diamond" - - else if(is_bananium_floor()) - if(!broken && !burnt) - if( !(icon_state in bananium_icons) ) - icon_state = "bananium" + return 0 spawn(1) if(istype(src,/turf/simulated/floor)) //Was throwing runtime errors due to a chance of it changing to space halfway through. if(air) update_visuals(air) -/turf/simulated/floor/return_siding_icon_state() - ..() - if(is_grass_floor()) - var/dir_sum = 0 - for(var/direction in cardinal) - var/turf/T = get_step(src,direction) - if(!(T.is_grass_floor())) - dir_sum += direction - if(dir_sum) - return "wood_siding[dir_sum]" - else - return 0 - + return 1 /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() - ..() - /turf/simulated/floor/proc/gets_drilled() return +/turf/simulated/floor/is_plasteel_floor() + if(ispath(floor_tile, /obj/item/stack/tile/plasteel)) + return 1 + else + return 0 + +/turf/simulated/floor/proc/fancy_update() + return + /turf/simulated/floor/proc/break_tile_to_plating() - if(!is_plating()) - make_plating() break_tile() -/turf/simulated/floor/is_plasteel_floor() - if(istype(floor_tile, /obj/item/stack/tile/plasteel)) - 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_grass_floor() - if(istype(floor_tile, /obj/item/stack/tile/grass)) - return 1 - else - return 0 - -/turf/simulated/floor/is_wood_floor() - if(istype(floor_tile, /obj/item/stack/tile/wood)) - return 1 - else - return 0 - -/turf/simulated/floor/is_gold_floor() - if(istype(floor_tile, /obj/item/stack/tile/mineral/gold)) - return 1 - else - return 0 - -/turf/simulated/floor/is_silver_floor() - if(istype(floor_tile, /obj/item/stack/tile/mineral/silver)) - return 1 - else - return 0 - -/turf/simulated/floor/is_plasma_floor() - if(istype(floor_tile, /obj/item/stack/tile/mineral/plasma)) - return 1 - else - return 0 - -/turf/simulated/floor/is_uranium_floor() - if(istype(floor_tile, /obj/item/stack/tile/mineral/uranium)) - return 1 - else - return 0 - -/turf/simulated/floor/is_diamond_floor() - if(istype(floor_tile, /obj/item/stack/tile/mineral/diamond)) - return 1 - else - return 0 - -/turf/simulated/floor/is_bananium_floor() - if(istype(floor_tile, /obj/item/stack/tile/mineral/bananium)) - return 1 - else - return 0 - -/turf/simulated/floor/is_carpet_floor() - if(istype(floor_tile, /obj/item/stack/tile/carpet)) - return 1 - else - return 0 - -/turf/simulated/floor/is_plating() - if(!floor_tile) - return 1 - 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.ChangeTurf(/turf/simulated/floor/plating) - if(broken) return - if(is_plasteel_floor()) - src.icon_state = "damaged[pick(1,2,3,4,5)]" - broken = 1 - else if(is_light_floor()) - src.icon_state = "light_broken" - broken = 1 - else if(is_plating()) - src.icon_state = "platingdmg[pick(1,2,3)]" - broken = 1 - else if(is_wood_floor()) - src.icon_state = "wood-broken" - broken = 1 - else if(is_carpet_floor()) - src.icon_state = "carpet-broken" - broken = 1 - else if(is_grass_floor()) - src.icon_state = "sand[pick("1","2","3")]" - broken = 1 - else if(is_gold_floor()) - src.icon_state = "gold_dam" - broken = 1 - else if(is_silver_floor()) - src.icon_state = "silver_dam" - broken = 1 - else if(is_diamond_floor()) - src.icon_state = "diamond_dam" - broken = 1 - else if(is_bananium_floor()) - src.icon_state = "bananium_dam" - broken = 1 - else if(is_uranium_floor()) - src.icon_state = "uranium_dam" - broken = 1 - else if(is_plasma_floor()) - src.icon_state = "plasma_dam" - broken = 1 + if(broken) + return + src.icon_state = pick(broken_states) + broken = 1 /turf/simulated/floor/proc/burn_tile() - if(istype(src,/turf/simulated/floor/engine)) return - if(istype(src,/turf/simulated/floor/plating/asteroid/airless)) return//Asteroid tiles don't burn - if(broken || burnt) return - if(is_plasteel_floor()) - src.icon_state = "damaged[pick(1,2,3,4,5)]" - burnt = 1 - else if(is_plasteel_floor()) - src.icon_state = "floorscorched[pick(1,2)]" - burnt = 1 - else if(is_plating()) - src.icon_state = "panelscorched" - burnt = 1 - else if(is_wood_floor()) - src.icon_state = "wood-broken" - burnt = 1 - else if(is_carpet_floor()) - src.icon_state = "carpet-broken" - burnt = 1 - else if(is_grass_floor()) - src.icon_state = "sand[pick("1","2","3")]" - burnt = 1 - else if(is_gold_floor()) - src.icon_state = "gold_dam" - burnt = 1 - else if(is_silver_floor()) - src.icon_state = "silver_dam" - burnt = 1 - else if(is_diamond_floor()) - src.icon_state = "diamond_dam" - burnt = 1 - else if(is_bananium_floor()) - src.icon_state = "bananium_dam" - burnt = 1 - else if(is_uranium_floor()) - src.icon_state = "uranium_dam" - burnt = 1 - -//This proc will delete the floor_tile and the update_iocn() proc will then change the icon_state of the turf -//This proc auto corrects the grass tiles' siding. -/turf/simulated/floor/proc/make_plating() - if(istype(src,/turf/simulated/floor/engine)) return - - if(is_grass_floor()) - for(var/direction in cardinal) - if(istype(get_step(src,direction),/turf/simulated/floor)) - var/turf/simulated/floor/FF = get_step(src,direction) - FF.update_icon() //so siding get updated properly - else if(is_carpet_floor()) - spawn(5) - if(src) - for(var/direction in list(1,2,4,8,5,6,9,10)) - if(istype(get_step(src,direction),/turf/simulated/floor)) - var/turf/simulated/floor/FF = get_step(src,direction) - FF.update_icon() //so siding get updated properly - - if (icon_plating) - icon_state = icon_plating - else - icon_state = "plating" //Nothing is defined, so just make it plating - icon_plating = "plating" - if(floor_tile) - qdel(floor_tile) - - SetLuminosity(0) - floor_tile = null - intact = 0 - broken = 0 - burnt = 0 - - update_icon() - levelupdate() - -//This proc will make the turf a plasteel 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_plasteel_floor(var/obj/item/stack/tile/plasteel/T = null) - broken = 0 - burnt = 0 - intact = 1 - SetLuminosity(0) - if(T) - if(istype(T, /obj/item/stack/tile/plasteel)) - floor_tile = T - if (icon_regular_floor) - icon_state = icon_regular_floor - else - icon_state = "floor" - icon_regular_floor = "floor" - update_icon() - levelupdate() - return - //if you gave a valid parameter, it won't get this far. - floor_tile = new/obj/item/stack/tile/plasteel - icon_state = "floor" - icon_regular_floor = "floor" - - update_icon() - levelupdate() - -/turf/simulated/floor/proc/make_floor(floor_tile, T) - broken = 0 - burnt = 0 - intact = 1 - if(T) - floor_tile = T - update_icon() - levelupdate() + if(broken || burnt) return -//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. + + if(is_plasteel_floor()) + src.icon_state = "floorscorched[pick(1,2)]" + else if(burnt_states) + src.icon_state = pick(burnt_states) + else + src.icon_state = pick(broken_states) + burnt = 1 + +/turf/simulated/floor/proc/make_plating() + make_floor(/turf/simulated/floor/plating) + +//wrapped for ChangeTurf that handles fancy flooring properly +/turf/simulated/floor/proc/make_floor(turf/simulated/floor/T as turf) + SetLuminosity(0) + fancy_update() //this has a spawn() so it will actually update after ChangeTurf + var/turf/simulated/floor/W = ChangeTurf(T) + W.update_icon() + W.levelupdate() + return W /turf/simulated/floor/attackby(obj/item/C as obj, mob/user as mob) - if(!C || !user) return 0 - 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.drop_item() - qdel(C) - T.state = C //fixing it by bashing it with a light bulb, fun eh? - update_icon() - user << "You replace the light bulb." - else - user << "The lightbulb seems fine, no need to replace it." - - if(istype(C, /obj/item/weapon/crowbar) && (!(is_plating()))) + if(istype(C, /obj/item/weapon/crowbar)) if(broken || burnt) + broken = 0 + burnt = 0 user << "You remove the broken plating." else - if(is_wood_floor()) + if(istype(src, /turf/simulated/floor/wood)) user << "You forcefully pry off the planks, destroying them in the process." else - user << "You remove the [floor_tile.name]." - new floor_tile.type(src) - + user << "You remove the floor tile." + var/obj/item/stack/tile/T = new floor_tile(src) + if(istype(T, /obj/item/stack/tile/light)) + var/obj/item/stack/tile/light/L = T + var/turf/simulated/floor/light/F = src + L.state = F.state make_plating() playsound(src, 'sound/items/Crowbar.ogg', 80, 1) + return 0 - return - - if(istype(C, /obj/item/weapon/screwdriver) && is_wood_floor()) - if(broken || burnt) - return - else - if(is_wood_floor()) - user << "You unscrew the planks." - new floor_tile.type(src) - - make_plating() - playsound(src, 'sound/items/Screwdriver.ogg', 80, 1) - - return - - if(istype(C, /obj/item/stack/rods)) - var/obj/item/stack/rods/R = C - if (is_plating()) - if (R.get_amount() < 2) - user << "You need two rods to make a reinforced floor." - return - else - user << "Reinforcing the floor..." - if(do_after(user, 30)) - if (R.get_amount() >= 2 && is_plating()) - ChangeTurf(/turf/simulated/floor/engine) - playsound(src, 'sound/items/Deconstruct.ogg', 80, 1) - R.use(2) - user << "You have reinforced the floor." - return - else - user << "You must remove the plating first." - return - - if(istype(C, /obj/item/stack/tile)) - if(is_plating()) - if(!broken && !burnt) - var/obj/item/stack/tile/T = C - if(istype(T, /obj/item/stack/tile/plasteel/cyborg)) - floor_tile = new /obj/item/stack/tile/plasteel - else - floor_tile = new T.type - intact = 1 - if(istype(T,/obj/item/stack/tile/light)) - var/obj/item/stack/tile/light/L = T - var/obj/item/stack/tile/light/F = floor_tile - F.state = L.state - F.on = L.on - if(istype(T,/obj/item/stack/tile/grass)) - for(var/direction in cardinal) - if(istype(get_step(src,direction),/turf/simulated/floor)) - var/turf/simulated/floor/FF = get_step(src,direction) - FF.update_icon() //so siding gets updated properly - else if(istype(T,/obj/item/stack/tile/carpet)) - for(var/direction in list(1,2,4,8,5,6,9,10)) - if(istype(get_step(src,direction),/turf/simulated/floor)) - var/turf/simulated/floor/FF = get_step(src,direction) - FF.update_icon() //so siding gets updated properly - T.use(1) - update_icon() - levelupdate() - playsound(src, 'sound/weapons/Genhit.ogg', 50, 1) - else - user << "This section is too damaged to support a tile. Use a welder to fix the damage." - - - if(istype(C, /obj/item/stack/cable_coil)) - if(is_plating()) - var/obj/item/stack/cable_coil/coil = C - for(var/obj/structure/cable/LC in src) - if((LC.d1==0)||(LC.d2==0)) - LC.attackby(C,user) - return - coil.turf_place(src, user) - else - user << "You must remove the plating first." - - if(istype(C, /obj/item/weapon/shovel)) - if(is_grass_floor()) - new /obj/item/weapon/ore/glass(src) - new /obj/item/weapon/ore/glass(src) //Make some sand if you shovel grass - user << "You shovel the grass." - make_plating() - else - user << "You cannot shovel this." - - if(istype(C, /obj/item/weapon/weldingtool)) - var/obj/item/weapon/weldingtool/welder = C - if(welder.isOn() && (is_plating())) - if(broken || burnt) - if(welder.remove_fuel(0,user)) - user << "You fix some dents on the broken plating." - playsound(src, 'sound/items/Welder.ogg', 80, 1) - icon_state = icon_plating - burnt = 0 - broken = 0 + return 1 diff --git a/code/game/turfs/simulated/floor/fancy_floor.dm b/code/game/turfs/simulated/floor/fancy_floor.dm new file mode 100644 index 00000000000..886be676ba5 --- /dev/null +++ b/code/game/turfs/simulated/floor/fancy_floor.dm @@ -0,0 +1,156 @@ +/* In this file: + * Wood floor + * Grass floor + * Carpet floor + */ + +/turf/simulated/floor/wood + name = "floor" + icon_state = "wood" + floor_tile = /obj/item/stack/tile/wood + var/icons = list("wood","wood-broken") + broken_states = list("wood-broken") + +/turf/simulated/floor/wood/update_icon() + if(!..()) + return + if(!broken && !burnt) + if( !(icon_state in icons) ) + icon_state = "wood" + +/turf/simulated/floor/wood/attackby(obj/item/C as obj, mob/user as mob) + if(!..()) + return + if(istype(C, /obj/item/weapon/screwdriver)) + if(broken || burnt) + return + user << "You unscrew the planks." + new floor_tile(src) + make_plating() + playsound(src, 'sound/items/Screwdriver.ogg', 80, 1) + return + +/turf/simulated/floor/grass + name = "Grass patch" + icon_state = "grass1" + floor_tile = /obj/item/stack/tile/grass + broken_states = list("sand1", "sand2", "sand3") + +/turf/simulated/floor/grass/New() + icon_state = "grass[pick("1","2","3","4")]" + ..() + spawn(4) + if(src) + update_icon() + for(var/direction in cardinal) + if(istype(get_step(src,direction),/turf/simulated/floor/grass)) + var/turf/simulated/floor/grass/FF = get_step(src,direction) + FF.update_icon() //so siding get updated properly + +/turf/simulated/floor/grass/attackby(obj/item/C as obj, mob/user as mob) + if(!..()) + return + if(istype(C, /obj/item/weapon/shovel)) + new /obj/item/weapon/ore/glass(src) + new /obj/item/weapon/ore/glass(src) //Make some sand if you shovel grass + user << "You shovel the grass." + make_plating() + +/turf/simulated/floor/grass/update_icon() + if(!..()) + return + if(!broken && !burnt) + if(!(icon_state in list("grass1","grass2","grass3","grass4"))) + icon_state = "grass[pick("1","2","3","4")]" + +/turf/simulated/floor/grass/fancy_update() + spawn(5) + for(var/direction in cardinal) + if(istype(get_step(src,direction),/turf/simulated/floor/grass)) + var/turf/simulated/floor/grass/FF = get_step(src,direction) + FF.update_icon() //so siding get updated properly + ..() + +/turf/simulated/floor/grass/return_siding_icon_state() + ..() + var/dir_sum = 0 + for(var/direction in cardinal) + var/turf/T = get_step(src,direction) + if(!istype(T, /turf/simulated/floor/grass)) + dir_sum += direction + if(dir_sum) + return "wood_siding[dir_sum]" + else + return 0 + +/turf/simulated/floor/carpet + name = "Carpet" + icon_state = "carpet" + floor_tile = /obj/item/stack/tile/carpet + broken_states = list("carpet-broken") + +/turf/simulated/floor/carpet/New() + if(!icon_state) + icon_state = "carpet" + ..() + spawn(4) + if(src) + update_icon() + for(var/direction in list(1,2,4,8,5,6,9,10)) + if(istype(get_step(src,direction),/turf/simulated/floor/carpet)) + var/turf/simulated/floor/carpet/FF = get_step(src,direction) + FF.update_icon() //so siding get updated properly + +/turf/simulated/floor/carpet/update_icon() + if(!broken && !burnt) + if(icon_state == "carpetsymbol") //le snowflake :^) + return + + var/connectdir = 0 + for(var/direction in cardinal) + if(istype(get_step(src,direction),/turf/simulated/floor/carpet)) + var/turf/simulated/floor/carpet/FF = get_step(src,direction) + if(istype(FF, /turf/simulated/floor/carpet)) + connectdir |= direction + + //Check the diagonal connections for corners, where you have, for example, connections both north and east. In this case it checks for a north-east connection to determine whether to add a corner marker or not. + var/diagonalconnect = 0 //1 = NE; 2 = SE; 4 = NW; 8 = SW + + //Northeast + if(connectdir & NORTH && connectdir & EAST) + if(istype(get_step(src,NORTHEAST),/turf/simulated/floor)) + var/turf/simulated/floor/FF = get_step(src,NORTHEAST) + if(istype(FF, /turf/simulated/floor/carpet)) + diagonalconnect |= 1 + + //Southeast + if(connectdir & SOUTH && connectdir & EAST) + if(istype(get_step(src,SOUTHEAST),/turf/simulated/floor)) + var/turf/simulated/floor/FF = get_step(src,SOUTHEAST) + if(istype(FF, /turf/simulated/floor/carpet)) + diagonalconnect |= 2 + + //Northwest + if(connectdir & NORTH && connectdir & WEST) + if(istype(get_step(src,NORTHWEST),/turf/simulated/floor)) + var/turf/simulated/floor/FF = get_step(src,NORTHWEST) + if(istype(FF, /turf/simulated/floor/carpet)) + diagonalconnect |= 4 + + //Southwest + if(connectdir & SOUTH && connectdir & WEST) + if(istype(get_step(src,SOUTHWEST),/turf/simulated/floor)) + var/turf/simulated/floor/FF = get_step(src,SOUTHWEST) + if(istype(FF, /turf/simulated/floor/carpet)) + diagonalconnect |= 8 + + icon_state = "carpet[connectdir]-[diagonalconnect]" + +/turf/simulated/floor/carpet/fancy_update() + spawn(5) + if(src) + for(var/direction in list(1,2,4,8,5,6,9,10)) + if(istype(get_step(src,direction),/turf/simulated/floor/carpet)) + var/turf/simulated/floor/FF = get_step(src,direction) + FF.update_icon() //so siding get updated properly + ..() diff --git a/code/game/turfs/simulated/floor/light_floor.dm b/code/game/turfs/simulated/floor/light_floor.dm new file mode 100644 index 00000000000..128049cbc6d --- /dev/null +++ b/code/game/turfs/simulated/floor/light_floor.dm @@ -0,0 +1,60 @@ +/* In this file: + * + * Light floor + */ + +/turf/simulated/floor/light + name = "Light floor" + luminosity = 5 + icon_state = "light_on" + floor_tile = /obj/item/stack/tile/light + broken_states = list("light-broken") + var/on = 1 + var/state //0 = fine, 1 = flickering, 2 = breaking, 3 = broken + +/turf/simulated/floor/light/New() + var/n = name //just in case commands rename it in the ..() call + ..() + spawn(4) + if(src) + update_icon() + name = n + +/turf/simulated/floor/light/update_icon() + if(on) + switch(state) + if(0) + icon_state = "light_on" + SetLuminosity(1) + if(1) + var/num = pick("1","2","3","4") + icon_state = "light_on_flicker[num]" + SetLuminosity(1) + if(2) + icon_state = "light_on_broken" + SetLuminosity(1) + if(3) + icon_state = "light_off" + SetLuminosity(0) + else + SetLuminosity(0) + icon_state = "light_off" + +/turf/simulated/floor/light/attack_hand(mob/user as mob) + on = !on + update_icon() + ..() + +/turf/simulated/floor/light/attackby(obj/item/C as obj, mob/user as mob) + if(!..()) + return + if(istype(C,/obj/item/weapon/light/bulb)) //only for light tiles + if(state) + user.drop_item() + qdel(C) + state = 0 //fixing it by bashing it with a light bulb, fun eh? + update_icon() + user << "You replace the light bulb." + else + user << "The lightbulb seems fine, no need to replace it." + return diff --git a/code/game/turfs/simulated/floor_mineral.dm b/code/game/turfs/simulated/floor/mineral_floor.dm similarity index 50% rename from code/game/turfs/simulated/floor_mineral.dm rename to code/game/turfs/simulated/floor/mineral_floor.dm index f281fd6c471..4653163baa5 100644 --- a/code/game/turfs/simulated/floor_mineral.dm +++ b/code/game/turfs/simulated/floor/mineral_floor.dm @@ -1,53 +1,77 @@ - -/turf/simulated/floor/mineral - name = "mineral floor" - icon_state = "" - var/last_event = 0 - var/active = null - -/turf/simulated/floor/mineral/plasma - name = "plasma floor" - icon_state = "plasma" - mineral = "plasma" - floortype = "plasma" - floor_tile = new/obj/item/stack/tile/mineral/plasma - -/turf/simulated/floor/mineral/gold - name = "gold floor" - icon_state = "gold" - mineral = "gold" - floortype = "gold" - floor_tile = new/obj/item/stack/tile/mineral/gold - -/turf/simulated/floor/mineral/silver - name = "silver floor" - icon_state = "silver" - mineral = "silver" - floortype = "silver" - floor_tile = new/obj/item/stack/tile/mineral/silver - -/turf/simulated/floor/mineral/bananium - name = "bananium floor" - icon_state = "bananium" - mineral = "clown" - floortype = "clown" - floor_tile = new/obj/item/stack/tile/mineral/bananium - -/turf/simulated/floor/mineral/bananium/airless - oxygen = 0.01 - nitrogen = 0.01 - temperature = TCMB - -/turf/simulated/floor/mineral/diamond - name = "diamond floor" - icon_state = "diamond" - mineral = "diamond" - floortype = "diamond" - floor_tile = new/obj/item/stack/tile/mineral/diamond - -/turf/simulated/floor/mineral/uranium - name = "uranium floor" - icon_state = "uranium" - mineral = "uranium" - floortype = "uranium" - floor_tile = new/obj/item/stack/tile/mineral/uranium \ No newline at end of file +/* In this file: + * + * Plasma floor + * Gold floor + * Silver floor + * Bananium floor + * Diamond floor + * Uranium floor + */ + +/turf/simulated/floor/mineral + name = "mineral floor" + icon_state = "" + var/last_event = 0 + var/active = null + var/list/icons = list() + +/turf/simulated/floor/New() + broken_states = list("[initial(icon_state)]_dam") + +/turf/simulated/floor/mineral/update_icon() + if(!broken && !burnt) + if( !(icon_state in icons) ) + icon_state = initial(icon_state) + +/turf/simulated/floor/mineral/plasma + name = "plasma floor" + icon_state = "plasma" + mineral = "plasma" + floortype = "plasma" + floor_tile = /obj/item/stack/tile/mineral/plasma + icons = list("plasma","plasma_dam") + +/turf/simulated/floor/mineral/gold + name = "gold floor" + icon_state = "gold" + mineral = "gold" + floortype = "gold" + floor_tile = /obj/item/stack/tile/mineral/gold + icons = list("gold","gold_dam") + +/turf/simulated/floor/mineral/silver + name = "silver floor" + icon_state = "silver" + mineral = "silver" + floortype = "silver" + floor_tile = /obj/item/stack/tile/mineral/silver + icons = list("silver","silver_dam") + +/turf/simulated/floor/mineral/bananium + name = "bananium floor" + icon_state = "bananium" + mineral = "clown" + floortype = "clown" + floor_tile = /obj/item/stack/tile/mineral/bananium + icons = list("bananium","bananium_dam") + +/turf/simulated/floor/mineral/bananium/airless + oxygen = 0.01 + nitrogen = 0.01 + temperature = TCMB + +/turf/simulated/floor/mineral/diamond + name = "diamond floor" + icon_state = "diamond" + mineral = "diamond" + floortype = "diamond" + floor_tile = /obj/item/stack/tile/mineral/diamond + icons = list("diamond","diamond_dam") + +/turf/simulated/floor/mineral/uranium + name = "uranium floor" + icon_state = "uranium" + mineral = "uranium" + floortype = "uranium" + floor_tile = /obj/item/stack/tile/mineral/uranium + icons = list("uranium","uranium_dam") \ No newline at end of file diff --git a/code/game/turfs/simulated/floor/misc_floor.dm b/code/game/turfs/simulated/floor/misc_floor.dm new file mode 100644 index 00000000000..0ea00f986a7 --- /dev/null +++ b/code/game/turfs/simulated/floor/misc_floor.dm @@ -0,0 +1,90 @@ +/* In this file: + * + * Commemorative Plaque + * Vault floor + * Vault wall + * Blue grid + * Green grid + * Shuttle floor + * Beach + * Ocean + * Iron Sand + * Snow + */ + +/turf/simulated/floor/goonplaque + name = "Commemorative Plaque" + icon_state = "plaque" + desc = "\"This is a plaque in honour of our comrades on the G4407 Stations. Hopefully TG4407 model can live up to your fame and fortune.\" Scratched in beneath that is a crude image of a meteor and a spaceman. The spaceman is laughing. The meteor is exploding." + +/turf/simulated/floor/vault + icon_state = "rockvault" + +/turf/simulated/wall/vault + icon_state = "rockvault" + +/turf/simulated/floor/bluegrid + icon = 'icons/turf/floors.dmi' + icon_state = "bcircuit" + +/turf/simulated/floor/greengrid + icon = 'icons/turf/floors.dmi' + icon_state = "gcircuit" + + +/turf/simulated/shuttle + name = "shuttle" + icon = 'icons/turf/shuttle.dmi' + thermal_conductivity = 0.05 + heat_capacity = 0 + layer = 2 + +/turf/simulated/shuttle/wall + name = "wall" + icon_state = "wall1" + opacity = 1 + density = 1 + blocks_air = 1 + +/turf/simulated/shuttle/floor + name = "floor" + icon_state = "floor" + +/turf/simulated/shuttle/plating + name = "plating" + icon = 'icons/turf/floors.dmi' + icon_state = "plating" + +/turf/simulated/shuttle/floor4 // Added this floor tile so that I have a seperate turf to check in the shuttle -- Polymorph + name = "Brig floor" // Also added it into the 2x3 brig area of the shuttle. + icon_state = "floor4" + +/turf/simulated/floor/beach + name = "Beach" + icon = 'icons/misc/beach.dmi' + +/turf/simulated/floor/beach/sand + name = "Sand" + icon_state = "sand" + +/turf/simulated/floor/beach/coastline + name = "Coastline" + icon = 'icons/misc/beach2.dmi' + icon_state = "sandwater" + +/turf/simulated/floor/beach/water + name = "Water" + icon_state = "water" + +/turf/simulated/floor/plating/ironsand/New() + ..() + name = "Iron Sand" + icon_state = "ironsand[rand(1,15)]" + +/turf/simulated/floor/plating/snow + name = "snow" + icon = 'icons/turf/snow.dmi' + icon_state = "snow" + +/turf/simulated/floor/plating/snow/ex_act(severity) + return diff --git a/code/game/turfs/simulated/floor/plating.dm b/code/game/turfs/simulated/floor/plating.dm new file mode 100644 index 00000000000..76214a2dc1c --- /dev/null +++ b/code/game/turfs/simulated/floor/plating.dm @@ -0,0 +1,140 @@ +/* In this file: + * + * Plating + * Airless + * Airless plating + * Engine floor + */ + // note that plating and engine floor do not call their parent attackby, unlike other flooring + +/turf/simulated/floor/plating + name = "plating" + icon_state = "plating" + floor_tile = null + intact = 0 + broken_states = list("platingdmg1", "platingdmg2", "platingdmg3") + burnt_states = list("panelscorched") + +/turf/simulated/floor/plating/update_icon() + if(!..()) + return + if(!broken && !burnt) + icon_state = icon_plating //Because asteroids are 'platings' too. + +/turf/simulated/floor/plating/attackby(obj/item/C as obj, mob/user as mob) + if(!C || !user) + return + if(istype(C, /obj/item/stack/rods)) + var/obj/item/stack/rods/R = C + if (R.get_amount() < 2) + user << "You need two rods to make a reinforced floor." + return + else + user << "Reinforcing the floor..." + if(do_after(user, 30)) + if (R.get_amount() >= 2 && is_plating()) + ChangeTurf(/turf/simulated/floor/engine) + playsound(src, 'sound/items/Deconstruct.ogg', 80, 1) + R.use(2) + user << "You have reinforced the floor." + return + else if(istype(C, /obj/item/stack/tile)) + if(!broken && !burnt) + var/obj/item/stack/tile/W = C + var/turf/simulated/floor/T = make_floor(W.turf_type) + if(istype(W,/obj/item/stack/tile/light)) + var/obj/item/stack/tile/light/L = W + var/turf/simulated/floor/light/F = T + F.state = L.state + W.use(1) + playsound(src, 'sound/weapons/Genhit.ogg', 50, 1) + else + user << "This section is too damaged to support a tile. Use a welder to fix the damage." + else if(istype(C, /obj/item/stack/cable_coil)) + var/obj/item/stack/cable_coil/coil = C + for(var/obj/structure/cable/LC in src) + if((LC.d1==0)||(LC.d2==0)) + LC.attackby(C,user) + return + coil.turf_place(src, user) + else if(istype(C, /obj/item/weapon/weldingtool)) + var/obj/item/weapon/weldingtool/welder = C + if( welder.isOn() && (broken || burnt) ) + if(welder.remove_fuel(0,user)) + user << "You fix some dents on the broken plating." + playsound(src, 'sound/items/Welder.ogg', 80, 1) + icon_state = icon_plating + burnt = 0 + broken = 0 + +/turf/simulated/floor/plating/airless + icon_state = "plating" + name = "airless plating" + oxygen = 0.01 + nitrogen = 0.01 + temperature = TCMB + +/turf/simulated/floor/plating/airless/New() + ..() + name = "plating" + +/turf/simulated/floor/engine + name = "reinforced floor" + icon_state = "engine" + thermal_conductivity = 0.025 + heat_capacity = 325000 + +/turf/simulated/floor/engine/break_tile() + return //unbreakable + +/turf/simulated/floor/engine/burn_tile() + return //unburnable + +/turf/simulated/floor/engine/make_plating() + return //unplateable + +/turf/simulated/floor/engine/attackby(obj/item/weapon/C as obj, mob/user as mob) + if(!C || !user) + return + if(istype(C, /obj/item/weapon/wrench)) + user << "Removing rods..." + playsound(src, 'sound/items/Ratchet.ogg', 80, 1) + if(do_after(user, 30)) + new /obj/item/stack/rods(src, 2) + make_plating() + return + +/turf/simulated/floor/engine/cult + name = "engraved floor" + icon_state = "cult" + +/turf/simulated/floor/engine/n20/New() + ..() + var/datum/gas_mixture/adding = new + var/datum/gas/sleeping_agent/trace_gas = new + + trace_gas.moles = 6000 + adding.trace_gases += trace_gas + adding.temperature = T20C + + assume_air(adding) + +/turf/simulated/floor/engine/vacuum + name = "vacuum floor" + icon_state = "engine" + oxygen = 0 + nitrogen = 0.001 + temperature = TCMB + + + +/turf/simulated/floor/airless + icon_state = "floor" + name = "airless floor" + oxygen = 0.01 + nitrogen = 0.01 + temperature = TCMB + +/turf/simulated/floor/airless/New() + ..() + name = "floor" \ No newline at end of file diff --git a/code/game/turfs/simulated/floor_types.dm b/code/game/turfs/simulated/floor_types.dm deleted file mode 100644 index b446d3f03c7..00000000000 --- a/code/game/turfs/simulated/floor_types.dm +++ /dev/null @@ -1,208 +0,0 @@ -/turf/simulated/floor/airless - icon_state = "floor" - name = "airless floor" - oxygen = 0.01 - nitrogen = 0.01 - temperature = TCMB - -/turf/simulated/floor/airless/New() - ..() - name = "floor" - -/turf/simulated/floor/light - name = "Light floor" - luminosity = 5 - icon_state = "light_on" - floor_tile = new/obj/item/stack/tile/light - -/turf/simulated/floor/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) - if(src) - update_icon() - name = n - - - -/turf/simulated/floor/wood - name = "floor" - icon_state = "wood" - floor_tile = new/obj/item/stack/tile/wood - -/turf/simulated/floor/goonplaque - name = "Commemorative Plaque" - icon_state = "plaque" - desc = "\"This is a plaque in honour of our comrades on the G4407 Stations. Hopefully TG4407 model can live up to your fame and fortune.\" Scratched in beneath that is a crude image of a meteor and a spaceman. The spaceman is laughing. The meteor is exploding." - -/turf/simulated/floor/vault - icon_state = "rockvault" - -/turf/simulated/wall/vault - icon_state = "rockvault" - -/turf/simulated/floor/engine - name = "reinforced floor" - icon_state = "engine" - thermal_conductivity = 0.025 - heat_capacity = 325000 - -/turf/simulated/floor/engine/attackby(obj/item/weapon/C as obj, mob/user as mob) - if(!C) - return - if(!user) - return - if(istype(C, /obj/item/weapon/wrench)) - user << "Removing rods..." - playsound(src, 'sound/items/Ratchet.ogg', 80, 1) - if(do_after(user, 30)) - new /obj/item/stack/rods(src, 2) - ChangeTurf(/turf/simulated/floor) - var/turf/simulated/floor/F = src - F.make_plating() - return - -/turf/simulated/floor/engine/cult - name = "engraved floor" - icon_state = "cult" - - -/turf/simulated/floor/engine/n20/New() - ..() - var/datum/gas_mixture/adding = new - var/datum/gas/sleeping_agent/trace_gas = new - - trace_gas.moles = 6000 - adding.trace_gases += trace_gas - adding.temperature = T20C - - assume_air(adding) - -/turf/simulated/floor/engine/vacuum - name = "vacuum floor" - icon_state = "engine" - oxygen = 0 - nitrogen = 0.001 - temperature = TCMB - -/turf/simulated/floor/plating - name = "plating" - icon_state = "plating" - floor_tile = null - intact = 0 - -/turf/simulated/floor/plating/airless - icon_state = "plating" - name = "airless plating" - oxygen = 0.01 - nitrogen = 0.01 - temperature = TCMB - -/turf/simulated/floor/plating/airless/New() - ..() - name = "plating" - -/turf/simulated/floor/bluegrid - icon = 'icons/turf/floors.dmi' - icon_state = "bcircuit" - -/turf/simulated/floor/greengrid - icon = 'icons/turf/floors.dmi' - icon_state = "gcircuit" - - -/turf/simulated/shuttle - name = "shuttle" - icon = 'icons/turf/shuttle.dmi' - thermal_conductivity = 0.05 - heat_capacity = 0 - layer = 2 - -/turf/simulated/shuttle/wall - name = "wall" - icon_state = "wall1" - opacity = 1 - density = 1 - blocks_air = 1 - -/turf/simulated/shuttle/floor - name = "floor" - icon_state = "floor" - -/turf/simulated/shuttle/plating - name = "plating" - icon = 'icons/turf/floors.dmi' - icon_state = "plating" - -/turf/simulated/shuttle/floor4 // Added this floor tile so that I have a seperate turf to check in the shuttle -- Polymorph - name = "Brig floor" // Also added it into the 2x3 brig area of the shuttle. - icon_state = "floor4" - -/turf/simulated/floor/beach - name = "Beach" - icon = 'icons/misc/beach.dmi' - -/turf/simulated/floor/beach/sand - name = "Sand" - icon_state = "sand" - -/turf/simulated/floor/beach/coastline - name = "Coastline" - icon = 'icons/misc/beach2.dmi' - icon_state = "sandwater" - -/turf/simulated/floor/beach/water - name = "Water" - icon_state = "water" - - -/turf/simulated/floor/grass - name = "Grass patch" - icon_state = "grass1" - floor_tile = new/obj/item/stack/tile/grass - -/turf/simulated/floor/grass/New() - floor_tile.New() //I guess New() isn't ran on objects spawned without the definition of a turf to house them, ah well. - icon_state = "grass[pick("1","2","3","4")]" - ..() - spawn(4) - if(src) - update_icon() - for(var/direction in cardinal) - if(istype(get_step(src,direction),/turf/simulated/floor)) - var/turf/simulated/floor/FF = get_step(src,direction) - FF.update_icon() //so siding get updated properly - -/turf/simulated/floor/carpet - name = "Carpet" - icon_state = "carpet" - floor_tile = new/obj/item/stack/tile/carpet - -/turf/simulated/floor/carpet/New() - floor_tile.New() //I guess New() isn't ran on objects spawned without the definition of a turf to house them, ah well. - if(!icon_state) - icon_state = "carpet" - ..() - spawn(4) - if(src) - update_icon() - for(var/direction in list(1,2,4,8,5,6,9,10)) - if(istype(get_step(src,direction),/turf/simulated/floor)) - var/turf/simulated/floor/FF = get_step(src,direction) - FF.update_icon() //so siding get updated properly - - - -/turf/simulated/floor/plating/ironsand/New() - ..() - name = "Iron Sand" - icon_state = "ironsand[rand(1,15)]" - -/turf/simulated/floor/plating/snow - name = "snow" - icon = 'icons/turf/snow.dmi' - icon_state = "snow" - -/turf/simulated/floor/plating/snow/ex_act(severity) - return diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index c5a7f9d6c33..949bdaaedca 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -2,7 +2,6 @@ icon = 'icons/turf/floors.dmi' level = 1.0 - //for floors, use is_plating(), is_plasteel_floor() and is_light_floor() var/intact = 1 //Properties for open tiles (/floor) @@ -105,26 +104,6 @@ return 0 /turf/proc/is_plasteel_floor() return 0 -/turf/proc/is_light_floor() - return 0 -/turf/proc/is_grass_floor() - return 0 -/turf/proc/is_wood_floor() - return 0 -/turf/proc/is_gold_floor() - return 0 -/turf/proc/is_silver_floor() - return 0 -/turf/proc/is_plasma_floor() - return 0 -/turf/proc/is_uranium_floor() - return 0 -/turf/proc/is_bananium_floor() - return 0 -/turf/proc/is_diamond_floor() - return 0 -/turf/proc/is_carpet_floor() - return 0 /turf/proc/return_siding_icon_state() //used for grass floors, which have siding. return 0 diff --git a/code/modules/mining/mine_turfs.dm b/code/modules/mining/mine_turfs.dm index 5a084218aa1..82ec0a9e4fa 100644 --- a/code/modules/mining/mine_turfs.dm +++ b/code/modules/mining/mine_turfs.dm @@ -490,6 +490,9 @@ // spawn(2) //O updateMineralOverlays() +/turf/simulated/floor/plating/asteroid/burn_tile() + return + /turf/simulated/floor/plating/asteroid/ex_act(severity) switch(severity) if(3.0) diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index e33b55290ec..13f46b22614 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -692,12 +692,10 @@ var/turf/target - if(istype(T, /turf/simulated/floor)) //intact floor, pop the tile - var/turf/simulated/floor/F = T - if(F.floor_tile) - F.floor_tile.loc = H //It took me a day to figure out this was the right way to do it. - F.floor_tile = null //So it doesn't get deleted in make_plating() - F.make_plating() + if(istype(T, /turf/simulated/floor) && !istype(T, /turf/simulated/floor/plating)) //intact floor, pop the tile + var/turf/simulated/floor/myturf = T + new myturf.floor_tile(T) + myturf.make_plating() if(direction) // direction is specified if(istype(T, /turf/space)) // if ended in space, then range is unlimited diff --git a/tgstation.dme b/tgstation.dme index 03fce853a7c..209ec0ddebe 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -6,6 +6,48 @@ // BEGIN_FILE_DIR #define FILE_DIR . +#define FILE_DIR "html" +#define FILE_DIR "icons" +#define FILE_DIR "icons/ass" +#define FILE_DIR "icons/effects" +#define FILE_DIR "icons/mecha" +#define FILE_DIR "icons/misc" +#define FILE_DIR "icons/mob" +#define FILE_DIR "icons/obj" +#define FILE_DIR "icons/obj/assemblies" +#define FILE_DIR "icons/obj/atmospherics" +#define FILE_DIR "icons/obj/clothing" +#define FILE_DIR "icons/obj/doors" +#define FILE_DIR "icons/obj/flora" +#define FILE_DIR "icons/obj/machines" +#define FILE_DIR "icons/obj/pipes" +#define FILE_DIR "icons/obj/power_cond" +#define FILE_DIR "icons/pda_icons" +#define FILE_DIR "icons/spideros_icons" +#define FILE_DIR "icons/stamp_icons" +#define FILE_DIR "icons/Testing" +#define FILE_DIR "icons/turf" +#define FILE_DIR "icons/vending_icons" +#define FILE_DIR "nano" +#define FILE_DIR "nano/images" +#define FILE_DIR "sound" +#define FILE_DIR "sound/AI" +#define FILE_DIR "sound/ambience" +#define FILE_DIR "sound/effects" +#define FILE_DIR "sound/hallucinations" +#define FILE_DIR "sound/items" +#define FILE_DIR "sound/machines" +#define FILE_DIR "sound/mecha" +#define FILE_DIR "sound/misc" +#define FILE_DIR "sound/piano" +#define FILE_DIR "sound/violin" +#define FILE_DIR "sound/voice" +#define FILE_DIR "sound/voice/complionator" +#define FILE_DIR "sound/vox_fem" +#define FILE_DIR "sound/weapons" +#define FILE_DIR "tools" +#define FILE_DIR "tools/AddToChangelog" +#define FILE_DIR "tools/AddToChangelog/AddToChangelog" // END_FILE_DIR // BEGIN_PREFERENCES @@ -689,12 +731,15 @@ #include "code\game\turfs\unsimulated.dm" #include "code\game\turfs\simulated\dirtystation.dm" #include "code\game\turfs\simulated\floor.dm" -#include "code\game\turfs\simulated\floor_mineral.dm" -#include "code\game\turfs\simulated\floor_types.dm" #include "code\game\turfs\simulated\walls.dm" #include "code\game\turfs\simulated\walls_mineral.dm" #include "code\game\turfs\simulated\walls_misc.dm" #include "code\game\turfs\simulated\walls_reinforced.dm" +#include "code\game\turfs\simulated\floor\fancy_floor.dm" +#include "code\game\turfs\simulated\floor\light_floor.dm" +#include "code\game\turfs\simulated\floor\mineral_floor.dm" +#include "code\game\turfs\simulated\floor\misc_floor.dm" +#include "code\game\turfs\simulated\floor\plating.dm" #include "code\game\turfs\space\space.dm" #include "code\game\turfs\space\transit.dm" #include "code\game\turfs\unsimulated\beach.dm" From f9a685378cea50bc9d1fd2aa1b3649d9e882a50d Mon Sep 17 00:00:00 2001 From: tkdrg Date: Sun, 19 Oct 2014 19:30:23 -0300 Subject: [PATCH 2/5] Floor revamp: fixed runtimes and a couple mistakes --- code/game/turfs/simulated/floor.dm | 6 ++- .../game/turfs/simulated/floor/light_floor.dm | 3 +- .../turfs/simulated/floor/mineral_floor.dm | 3 +- tgstation.dme | 42 ------------------- 4 files changed, 8 insertions(+), 46 deletions(-) diff --git a/code/game/turfs/simulated/floor.dm b/code/game/turfs/simulated/floor.dm index 583ceafab6b..d1a90346cbf 100644 --- a/code/game/turfs/simulated/floor.dm +++ b/code/game/turfs/simulated/floor.dm @@ -61,7 +61,10 @@ var/list/icons_to_ignore_at_floor_init = list("damaged1","damaged2","damaged3"," if(2) src.ChangeTurf(/turf/space) if(3) - src.break_tile() + if(prob(80)) + src.break_tile_to_plating() + else + src.break_tile() src.hotspot_expose(1000,CELL_VOLUME) if(prob(33)) new /obj/item/stack/sheet/metal(src) if(3.0) @@ -104,6 +107,7 @@ var/list/icons_to_ignore_at_floor_init = list("damaged1","damaged2","damaged3"," return /turf/simulated/floor/proc/break_tile_to_plating() + make_plating() break_tile() /turf/simulated/floor/proc/break_tile() diff --git a/code/game/turfs/simulated/floor/light_floor.dm b/code/game/turfs/simulated/floor/light_floor.dm index 128049cbc6d..c6b5f8581c4 100644 --- a/code/game/turfs/simulated/floor/light_floor.dm +++ b/code/game/turfs/simulated/floor/light_floor.dm @@ -13,12 +13,11 @@ var/state //0 = fine, 1 = flickering, 2 = breaking, 3 = broken /turf/simulated/floor/light/New() - var/n = name //just in case commands rename it in the ..() call ..() spawn(4) if(src) update_icon() - name = n + name = initial(name) /turf/simulated/floor/light/update_icon() if(on) diff --git a/code/game/turfs/simulated/floor/mineral_floor.dm b/code/game/turfs/simulated/floor/mineral_floor.dm index 4653163baa5..a22115d833e 100644 --- a/code/game/turfs/simulated/floor/mineral_floor.dm +++ b/code/game/turfs/simulated/floor/mineral_floor.dm @@ -15,7 +15,8 @@ var/active = null var/list/icons = list() -/turf/simulated/floor/New() +/turf/simulated/floor/mineral/New() + ..() broken_states = list("[initial(icon_state)]_dam") /turf/simulated/floor/mineral/update_icon() diff --git a/tgstation.dme b/tgstation.dme index 209ec0ddebe..d3b8704b0a5 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -6,48 +6,6 @@ // BEGIN_FILE_DIR #define FILE_DIR . -#define FILE_DIR "html" -#define FILE_DIR "icons" -#define FILE_DIR "icons/ass" -#define FILE_DIR "icons/effects" -#define FILE_DIR "icons/mecha" -#define FILE_DIR "icons/misc" -#define FILE_DIR "icons/mob" -#define FILE_DIR "icons/obj" -#define FILE_DIR "icons/obj/assemblies" -#define FILE_DIR "icons/obj/atmospherics" -#define FILE_DIR "icons/obj/clothing" -#define FILE_DIR "icons/obj/doors" -#define FILE_DIR "icons/obj/flora" -#define FILE_DIR "icons/obj/machines" -#define FILE_DIR "icons/obj/pipes" -#define FILE_DIR "icons/obj/power_cond" -#define FILE_DIR "icons/pda_icons" -#define FILE_DIR "icons/spideros_icons" -#define FILE_DIR "icons/stamp_icons" -#define FILE_DIR "icons/Testing" -#define FILE_DIR "icons/turf" -#define FILE_DIR "icons/vending_icons" -#define FILE_DIR "nano" -#define FILE_DIR "nano/images" -#define FILE_DIR "sound" -#define FILE_DIR "sound/AI" -#define FILE_DIR "sound/ambience" -#define FILE_DIR "sound/effects" -#define FILE_DIR "sound/hallucinations" -#define FILE_DIR "sound/items" -#define FILE_DIR "sound/machines" -#define FILE_DIR "sound/mecha" -#define FILE_DIR "sound/misc" -#define FILE_DIR "sound/piano" -#define FILE_DIR "sound/violin" -#define FILE_DIR "sound/voice" -#define FILE_DIR "sound/voice/complionator" -#define FILE_DIR "sound/vox_fem" -#define FILE_DIR "sound/weapons" -#define FILE_DIR "tools" -#define FILE_DIR "tools/AddToChangelog" -#define FILE_DIR "tools/AddToChangelog/AddToChangelog" // END_FILE_DIR // BEGIN_PREFERENCES From 95f6c29442dd1a4fed07e23d85b965d2b3edc422 Mon Sep 17 00:00:00 2001 From: tkdrg Date: Tue, 21 Oct 2014 15:34:10 -0300 Subject: [PATCH 3/5] Floor refactor: fixes floor tile icon_state switching, removes uneeded spawns, cleans up old cruft and redundant code Fixes #1839 Fixes #2797 --- .../machinery/computer/HolodeckControl.dm | 11 ++-- code/game/turfs/simulated/floor.dm | 57 +++++++++--------- .../game/turfs/simulated/floor/fancy_floor.dm | 59 +++---------------- .../game/turfs/simulated/floor/light_floor.dm | 7 +-- .../turfs/simulated/floor/mineral_floor.dm | 14 ----- code/game/turfs/simulated/floor/misc_floor.dm | 5 +- code/game/turfs/simulated/floor/plating.dm | 9 ++- 7 files changed, 55 insertions(+), 107 deletions(-) diff --git a/code/game/machinery/computer/HolodeckControl.dm b/code/game/machinery/computer/HolodeckControl.dm index 99e625ef75d..8ba54c42a2d 100644 --- a/code/game/machinery/computer/HolodeckControl.dm +++ b/code/game/machinery/computer/HolodeckControl.dm @@ -281,7 +281,7 @@ // Holographic Items! -/turf/simulated/floor/holofloor/ +/turf/simulated/floor/holofloor thermal_conductivity = 0 /turf/simulated/floor/holofloor/grass @@ -291,15 +291,12 @@ floor_tile = /obj/item/stack/tile/grass /turf/simulated/floor/holofloor/grass/New() - icon_state = "grass[pick("1","2","3","4")]" ..() - spawn(4) + icon_state = "grass[pick("1","2","3","4")]" + spawn(1) if(src) update_icon() - for(var/direction in cardinal) - if(istype(get_step(src,direction),/turf/simulated/floor)) - var/turf/simulated/floor/FF = get_step(src,direction) - FF.update_icon() //so siding get updated properly + fancy_update(type) /turf/simulated/floor/holofloor/attackby(obj/item/weapon/W as obj, mob/user as mob) return diff --git a/code/game/turfs/simulated/floor.dm b/code/game/turfs/simulated/floor.dm index d1a90346cbf..fa1eaed7bca 100644 --- a/code/game/turfs/simulated/floor.dm +++ b/code/game/turfs/simulated/floor.dm @@ -16,6 +16,10 @@ var/list/icons_to_ignore_at_floor_init = list("damaged1","damaged2","damaged3"," //NOTE: Floor code has been refactored, many procs were removed //using intact should be safe, you can also use istype //also worhy of note: floor_tile is now a path, and not a tile obj + //future improvements: + //- move fancy_update() to a new /turf/simulated/floor/fancy + //- move the default floor to /turf/simulated/floor/plasteel + //- unsnowflake the light floors somehow name = "floor" icon = 'icons/turf/floors.dmi' icon_state = "floor" @@ -28,13 +32,10 @@ var/list/icons_to_ignore_at_floor_init = list("damaged1","damaged2","damaged3"," var/lava = 0 var/broken = 0 var/burnt = 0 - var/mineral = "metal" - var/floortype = "metal" var/floor_tile = /obj/item/stack/tile/plasteel var/list/broken_states = list("damaged1", "damaged2", "damaged3", "damaged4", "damaged5") var/list/burnt_states = list() - /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 @@ -49,7 +50,6 @@ var/list/icons_to_ignore_at_floor_init = list("damaged1","damaged2","damaged3"," // return ..() /turf/simulated/floor/ex_act(severity) - //set src in oview(1) switch(severity) if(1.0) src.ChangeTurf(/turf/space) @@ -83,12 +83,8 @@ var/list/icons_to_ignore_at_floor_init = list("damaged1","damaged2","damaged3"," if(!broken && !burnt) icon_state = icon_regular_floor return 0 - - spawn(1) - if(istype(src,/turf/simulated/floor)) //Was throwing runtime errors due to a chance of it changing to space halfway through. - if(air) - update_visuals(air) - + if(air) + update_visuals(air) return 1 /turf/simulated/floor/attack_paw(mob/user as mob) @@ -103,47 +99,53 @@ var/list/icons_to_ignore_at_floor_init = list("damaged1","damaged2","damaged3"," else return 0 -/turf/simulated/floor/proc/fancy_update() - return +//updates neighboring carpet & grass +/turf/simulated/floor/proc/fancy_update(fancy_type) + for(var/direction in list(1,2,4,8,5,6,9,10)) + if(istype(get_step(src,direction), fancy_type)) + var/turf/simulated/floor/FF = get_step(src,direction) + FF.update_icon() /turf/simulated/floor/proc/break_tile_to_plating() - make_plating() - break_tile() + var/turf/simulated/floor/plating/T = make_plating() + T.break_tile() /turf/simulated/floor/proc/break_tile() if(broken) return - src.icon_state = pick(broken_states) + icon_state = pick(broken_states) broken = 1 /turf/simulated/floor/proc/burn_tile() if(broken || burnt) return - if(is_plasteel_floor()) - src.icon_state = "floorscorched[pick(1,2)]" + icon_state = "floorscorched[pick(1,2)]" else if(burnt_states) - src.icon_state = pick(burnt_states) + icon_state = pick(burnt_states) else - src.icon_state = pick(broken_states) + icon_state = pick(broken_states) burnt = 1 /turf/simulated/floor/proc/make_plating() - make_floor(/turf/simulated/floor/plating) + return make_floor(/turf/simulated/floor/plating) -//wrapped for ChangeTurf that handles fancy flooring properly +//wrapper for ChangeTurf that handles flooring properly /turf/simulated/floor/proc/make_floor(turf/simulated/floor/T as turf) SetLuminosity(0) - fancy_update() //this has a spawn() so it will actually update after ChangeTurf + var/old_type = type + var/old_icon = icon_regular_floor + var/old_dir = dir var/turf/simulated/floor/W = ChangeTurf(T) + W.icon_regular_floor = old_icon + W.dir = old_dir W.update_icon() - W.levelupdate() + W.fancy_update(old_type) return W /turf/simulated/floor/attackby(obj/item/C as obj, mob/user as mob) if(!C || !user) - return 0 - + return 1 if(istype(C, /obj/item/weapon/crowbar)) if(broken || burnt) broken = 0 @@ -161,6 +163,5 @@ var/list/icons_to_ignore_at_floor_init = list("damaged1","damaged2","damaged3"," L.state = F.state make_plating() playsound(src, 'sound/items/Crowbar.ogg', 80, 1) - return 0 - - return 1 + return 1 + return 0 diff --git a/code/game/turfs/simulated/floor/fancy_floor.dm b/code/game/turfs/simulated/floor/fancy_floor.dm index 886be676ba5..fb9b6b7caac 100644 --- a/code/game/turfs/simulated/floor/fancy_floor.dm +++ b/code/game/turfs/simulated/floor/fancy_floor.dm @@ -8,18 +8,10 @@ name = "floor" icon_state = "wood" floor_tile = /obj/item/stack/tile/wood - var/icons = list("wood","wood-broken") - broken_states = list("wood-broken") - -/turf/simulated/floor/wood/update_icon() - if(!..()) - return - if(!broken && !burnt) - if( !(icon_state in icons) ) - icon_state = "wood" + broken_states = list("wood-broken", "wood-broken2", "wood-broken3", "wood-broken4", "wood-broken5", "wood-broken6", "wood-broken7") /turf/simulated/floor/wood/attackby(obj/item/C as obj, mob/user as mob) - if(!..()) + if(..()) return if(istype(C, /obj/item/weapon/screwdriver)) if(broken || burnt) @@ -37,18 +29,15 @@ broken_states = list("sand1", "sand2", "sand3") /turf/simulated/floor/grass/New() - icon_state = "grass[pick("1","2","3","4")]" ..() - spawn(4) + icon_state = "grass[pick("1","2","3","4")]" + spawn(1) if(src) update_icon() - for(var/direction in cardinal) - if(istype(get_step(src,direction),/turf/simulated/floor/grass)) - var/turf/simulated/floor/grass/FF = get_step(src,direction) - FF.update_icon() //so siding get updated properly + fancy_update(type) /turf/simulated/floor/grass/attackby(obj/item/C as obj, mob/user as mob) - if(!..()) + if(..()) return if(istype(C, /obj/item/weapon/shovel)) new /obj/item/weapon/ore/glass(src) @@ -56,27 +45,11 @@ user << "You shovel the grass." make_plating() -/turf/simulated/floor/grass/update_icon() - if(!..()) - return - if(!broken && !burnt) - if(!(icon_state in list("grass1","grass2","grass3","grass4"))) - icon_state = "grass[pick("1","2","3","4")]" - -/turf/simulated/floor/grass/fancy_update() - spawn(5) - for(var/direction in cardinal) - if(istype(get_step(src,direction),/turf/simulated/floor/grass)) - var/turf/simulated/floor/grass/FF = get_step(src,direction) - FF.update_icon() //so siding get updated properly - ..() - /turf/simulated/floor/grass/return_siding_icon_state() ..() var/dir_sum = 0 for(var/direction in cardinal) - var/turf/T = get_step(src,direction) - if(!istype(T, /turf/simulated/floor/grass)) + if(!istype(get_step(src,direction), /turf/simulated/floor/grass)) dir_sum += direction if(dir_sum) return "wood_siding[dir_sum]" @@ -90,16 +63,11 @@ broken_states = list("carpet-broken") /turf/simulated/floor/carpet/New() - if(!icon_state) - icon_state = "carpet" ..() - spawn(4) + spawn(1) if(src) update_icon() - for(var/direction in list(1,2,4,8,5,6,9,10)) - if(istype(get_step(src,direction),/turf/simulated/floor/carpet)) - var/turf/simulated/floor/carpet/FF = get_step(src,direction) - FF.update_icon() //so siding get updated properly + fancy_update(type) /turf/simulated/floor/carpet/update_icon() if(!broken && !burnt) @@ -145,12 +113,3 @@ diagonalconnect |= 8 icon_state = "carpet[connectdir]-[diagonalconnect]" - -/turf/simulated/floor/carpet/fancy_update() - spawn(5) - if(src) - for(var/direction in list(1,2,4,8,5,6,9,10)) - if(istype(get_step(src,direction),/turf/simulated/floor/carpet)) - var/turf/simulated/floor/FF = get_step(src,direction) - FF.update_icon() //so siding get updated properly - ..() diff --git a/code/game/turfs/simulated/floor/light_floor.dm b/code/game/turfs/simulated/floor/light_floor.dm index c6b5f8581c4..2b0296246d9 100644 --- a/code/game/turfs/simulated/floor/light_floor.dm +++ b/code/game/turfs/simulated/floor/light_floor.dm @@ -14,10 +14,7 @@ /turf/simulated/floor/light/New() ..() - spawn(4) - if(src) - update_icon() - name = initial(name) + update_icon() /turf/simulated/floor/light/update_icon() if(on) @@ -45,7 +42,7 @@ ..() /turf/simulated/floor/light/attackby(obj/item/C as obj, mob/user as mob) - if(!..()) + if(..()) return if(istype(C,/obj/item/weapon/light/bulb)) //only for light tiles if(state) diff --git a/code/game/turfs/simulated/floor/mineral_floor.dm b/code/game/turfs/simulated/floor/mineral_floor.dm index a22115d833e..29242623f91 100644 --- a/code/game/turfs/simulated/floor/mineral_floor.dm +++ b/code/game/turfs/simulated/floor/mineral_floor.dm @@ -11,8 +11,6 @@ /turf/simulated/floor/mineral name = "mineral floor" icon_state = "" - var/last_event = 0 - var/active = null var/list/icons = list() /turf/simulated/floor/mineral/New() @@ -27,32 +25,24 @@ /turf/simulated/floor/mineral/plasma name = "plasma floor" icon_state = "plasma" - mineral = "plasma" - floortype = "plasma" floor_tile = /obj/item/stack/tile/mineral/plasma icons = list("plasma","plasma_dam") /turf/simulated/floor/mineral/gold name = "gold floor" icon_state = "gold" - mineral = "gold" - floortype = "gold" floor_tile = /obj/item/stack/tile/mineral/gold icons = list("gold","gold_dam") /turf/simulated/floor/mineral/silver name = "silver floor" icon_state = "silver" - mineral = "silver" - floortype = "silver" floor_tile = /obj/item/stack/tile/mineral/silver icons = list("silver","silver_dam") /turf/simulated/floor/mineral/bananium name = "bananium floor" icon_state = "bananium" - mineral = "clown" - floortype = "clown" floor_tile = /obj/item/stack/tile/mineral/bananium icons = list("bananium","bananium_dam") @@ -64,15 +54,11 @@ /turf/simulated/floor/mineral/diamond name = "diamond floor" icon_state = "diamond" - mineral = "diamond" - floortype = "diamond" floor_tile = /obj/item/stack/tile/mineral/diamond icons = list("diamond","diamond_dam") /turf/simulated/floor/mineral/uranium name = "uranium floor" icon_state = "uranium" - mineral = "uranium" - floortype = "uranium" floor_tile = /obj/item/stack/tile/mineral/uranium icons = list("uranium","uranium_dam") \ No newline at end of file diff --git a/code/game/turfs/simulated/floor/misc_floor.dm b/code/game/turfs/simulated/floor/misc_floor.dm index 0ea00f986a7..b5ebf04f44e 100644 --- a/code/game/turfs/simulated/floor/misc_floor.dm +++ b/code/game/turfs/simulated/floor/misc_floor.dm @@ -2,7 +2,7 @@ * * Commemorative Plaque * Vault floor - * Vault wall + * Vault wall (why) * Blue grid * Green grid * Shuttle floor @@ -63,6 +63,9 @@ name = "Beach" icon = 'icons/misc/beach.dmi' +/turf/simulated/floor/beach/ex_act(severity) + return + /turf/simulated/floor/beach/sand name = "Sand" icon_state = "sand" diff --git a/code/game/turfs/simulated/floor/plating.dm b/code/game/turfs/simulated/floor/plating.dm index 76214a2dc1c..5f6a9b03ed9 100644 --- a/code/game/turfs/simulated/floor/plating.dm +++ b/code/game/turfs/simulated/floor/plating.dm @@ -5,7 +5,8 @@ * Airless plating * Engine floor */ - // note that plating and engine floor do not call their parent attackby, unlike other flooring +// note that plating and engine floor do not call their parent attackby, unlike other flooring +// this is done in order to avoid inheriting the crowbar attackby /turf/simulated/floor/plating name = "plating" @@ -15,8 +16,12 @@ broken_states = list("platingdmg1", "platingdmg2", "platingdmg3") burnt_states = list("panelscorched") +/turf/simulated/floor/plating/New() + ..() + icon_plating = icon_state + /turf/simulated/floor/plating/update_icon() - if(!..()) + if(..()) return if(!broken && !burnt) icon_state = icon_plating //Because asteroids are 'platings' too. From d8e6a1a931c750081da0d6d7c2d2a9746661effa Mon Sep 17 00:00:00 2001 From: tkdrg Date: Thu, 30 Oct 2014 19:16:15 -0300 Subject: [PATCH 4/5] Readds the built-in floor tiles for a singulo purpose. --- code/game/turfs/simulated/floor.dm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/game/turfs/simulated/floor.dm b/code/game/turfs/simulated/floor.dm index fa1eaed7bca..716af6d65a3 100644 --- a/code/game/turfs/simulated/floor.dm +++ b/code/game/turfs/simulated/floor.dm @@ -33,6 +33,7 @@ var/list/icons_to_ignore_at_floor_init = list("damaged1","damaged2","damaged3"," var/broken = 0 var/burnt = 0 var/floor_tile = /obj/item/stack/tile/plasteel + var/obj/item/stack/tile/builtin_tile = null //needed for performance reasons when the singularity rips off floor tiles var/list/broken_states = list("damaged1", "damaged2", "damaged3", "damaged4", "damaged5") var/list/burnt_states = list() @@ -42,6 +43,8 @@ var/list/icons_to_ignore_at_floor_init = list("damaged1","damaged2","damaged3"," icon_regular_floor = "floor" else icon_regular_floor = icon_state + if(floor_tile) + builtin_tile = new floor_tile //turf/simulated/floor/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) // if ((istype(mover, /obj/machinery/vehicle) && !(src.burnt))) From 0bb462e857b06236aab1c3fe28063066c3c2cb79 Mon Sep 17 00:00:00 2001 From: tkdrg Date: Thu, 30 Oct 2014 20:32:40 -0300 Subject: [PATCH 5/5] Fixes botcall conflicts, removes even more cruft and unused code --- code/game/machinery/bots/floorbot.dm | 16 +++++------- .../objects/items/stacks/tiles/plasteel.dm | 26 ------------------- code/game/turfs/simulated/floor/plating.dm | 2 +- code/game/turfs/space/space.dm | 4 +-- code/game/turfs/turf.dm | 6 +---- code/modules/events/ninja.dm | 4 +-- 6 files changed, 12 insertions(+), 46 deletions(-) diff --git a/code/game/machinery/bots/floorbot.dm b/code/game/machinery/bots/floorbot.dm index 37f35e71252..889bd774238 100644 --- a/code/game/machinery/bots/floorbot.dm +++ b/code/game/machinery/bots/floorbot.dm @@ -341,7 +341,7 @@ obj/machinery/bot/floorbot/process_scan(var/scan_target) result = scan_target if(REPLACE_TILE) F = scan_target - if(F.is_plating()) //The floor must not already have a tile. + if(istype(F, /turf/simulated/floor/plating)) //The floor must not already have a tile. result = F if(FIX_TILE) //Selects only damaged floors. F = scan_target @@ -349,7 +349,7 @@ obj/machinery/bot/floorbot/process_scan(var/scan_target) result = F if(TILE_EMAG) //Emag mode! Rip up the floor and cause breaches to space! F = scan_target - if(!F.is_plating()) + if(!istype(F, /turf/simulated/floor/plating)) result = F else //If no special processing is needed, simply return the result. result = scan_target @@ -368,8 +368,6 @@ obj/machinery/bot/floorbot/process_scan(var/scan_target) mode = BOT_IDLE target = null return - var/turf/simulated/floor/F - var/obj/item/stack/tile/plasteel/T = new /obj/item/stack/tile/plasteel anchored = 1 icon_state = "floorbot-c" if(istype(target_turf, /turf/space/)) //If we are fixing an area not part of pure space, it is @@ -378,23 +376,21 @@ obj/machinery/bot/floorbot/process_scan(var/scan_target) spawn(50) if(mode == BOT_REPAIRING) if(autotile) //Build the floor and include a tile. - F = target_turf.ChangeTurf(/turf/simulated/floor) + target_turf.ChangeTurf(/turf/simulated/floor) else //Build a hull plating without a floor tile. - T.build(loc) + target_turf.ChangeTurf(/turf/simulated/floor/plating) mode = BOT_IDLE amount -= 1 updateicon() anchored = 0 target = null else - F = target_turf - + var/turf/simulated/floor/F = target_turf mode = BOT_REPAIRING visible_message(" [src] begins repairing the floor.") spawn(50) if(mode == BOT_REPAIRING) - F = target_turf - F.make_plasteel_floor(T) + F.make_floor(/turf/simulated/floor) mode = BOT_IDLE amount -= 1 updateicon() diff --git a/code/game/objects/items/stacks/tiles/plasteel.dm b/code/game/objects/items/stacks/tiles/plasteel.dm index 6f5e2342f9d..bad34a66578 100644 --- a/code/game/objects/items/stacks/tiles/plasteel.dm +++ b/code/game/objects/items/stacks/tiles/plasteel.dm @@ -48,29 +48,3 @@ return else ..() - -/* -/obj/item/stack/tile/plasteel/attack_self(mob/user as mob) - if (usr.stat) - return - var/T = user.loc - if (!( istype(T, /turf) )) - user << "\red You must be on the ground!" - return - if (!( istype(T, /turf/space) )) - user << "\red You cannot build on or repair this turf!" - return - src.build(T) - src.add_fingerprint(user) - use(1) - return -*/ - -/obj/item/stack/tile/plasteel/proc/build(turf/S as turf) - S.ChangeTurf(/turf/simulated/floor/plating) -// var/turf/simulated/floor/W = S.ReplaceWithFloor() -// W.make_plating() - return - - - diff --git a/code/game/turfs/simulated/floor/plating.dm b/code/game/turfs/simulated/floor/plating.dm index 5f6a9b03ed9..827c8922c8e 100644 --- a/code/game/turfs/simulated/floor/plating.dm +++ b/code/game/turfs/simulated/floor/plating.dm @@ -37,7 +37,7 @@ else user << "Reinforcing the floor..." if(do_after(user, 30)) - if (R.get_amount() >= 2 && is_plating()) + if (R.get_amount() >= 2) ChangeTurf(/turf/simulated/floor/engine) playsound(src, 'sound/items/Deconstruct.ogg', 80, 1) R.use(2) diff --git a/code/game/turfs/space/space.dm b/code/game/turfs/space/space.dm index b8ecd518b05..86a8d0bdd4e 100644 --- a/code/game/turfs/space/space.dm +++ b/code/game/turfs/space/space.dm @@ -41,7 +41,7 @@ qdel(L) playsound(src, 'sound/weapons/Genhit.ogg', 50, 1) user << "You build a floor." - S.build(src) + ChangeTurf(/turf/simulated/floor) else user << "You need one floor tile to build a floor." else @@ -209,4 +209,4 @@ proc/setup_map_transitions() //listamania S.Assign_Destination() /turf/space/singularity_act() - return + return diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 3619b9e7aee..f00b9e16186 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -93,10 +93,6 @@ loopsanity-- A.HasProximity(M, 1) -/turf/proc/is_plating() - return 0 -/turf/proc/is_asteroid_floor() - return 0 /turf/proc/is_plasteel_floor() return 0 /turf/proc/return_siding_icon_state() //used for grass floors, which have siding. @@ -335,4 +331,4 @@ if(O.invisibility == 101) O.singularity_act() ChangeTurf(/turf/space) - return(2) + return(2) diff --git a/code/modules/events/ninja.dm b/code/modules/events/ninja.dm index 09356add7d4..4efc4c100ce 100644 --- a/code/modules/events/ninja.dm +++ b/code/modules/events/ninja.dm @@ -623,7 +623,7 @@ spideros = text2num(return_to)//Maximum length here is 6. Use (return_to, X) to var/mob/living/carbon/human/U = loc if(candrain&&!draining) var/turf/T = U.loc - if(isturf(T) && T.is_plating()) + if(isturf(T) && istype(T, /turf/simulated/floor/plating) attached = locate() in T if(!attached) U << "\red Warning: no exposed cable available." @@ -2747,4 +2747,4 @@ proc/create_ninja_mind(key) Mind.assigned_role = "MODE" Mind.special_role = "Space Ninja" ticker.mode.traitors |= Mind //Adds them to current traitor list. Which is really the extra antagonist list. - return Mind \ No newline at end of file + return Mind