From a10d7d1bd20c49f071d1eae372b871b50e4b9204 Mon Sep 17 00:00:00 2001 From: Tigercat2000 Date: Tue, 5 Jan 2016 18:46:39 -0800 Subject: [PATCH] fix lightfloors --- code/game/objects/items/stacks/tiles/light.dm | 48 ---------- .../objects/items/stacks/tiles/tile_types.dm | 16 +++- .../game/turfs/simulated/floor/light_floor.dm | 93 +++++++++++-------- paradise.dme | 1 - 4 files changed, 69 insertions(+), 89 deletions(-) delete mode 100644 code/game/objects/items/stacks/tiles/light.dm diff --git a/code/game/objects/items/stacks/tiles/light.dm b/code/game/objects/items/stacks/tiles/light.dm deleted file mode 100644 index 3cf7bd35c68..00000000000 --- a/code/game/objects/items/stacks/tiles/light.dm +++ /dev/null @@ -1,48 +0,0 @@ -#define LIGHTFLOOR_ON 1 -#define LIGHTFLOOR_WHITE 2 -#define LIGHTFLOOR_RED 3 -#define LIGHTFLOOR_GREEN 4 -#define LIGHTFLOOR_YELLOW 5 -#define LIGHTFLOOR_BLUE 6 -#define LIGHTFLOOR_PURPLE 7 - -/obj/item/stack/tile/light - name = "light tiles" - gender = PLURAL - singular_name = "light floor tile" - desc = "A floor tile, made out off glass. Use a multitool on it to change its color." - icon_state = "tile_light blue" - force = 3 - throwforce = 5 - attack_verb = list("bashed", "battered", "bludgeoned", "thrashed", "smashed") - var/on = 1 - var/state = LIGHTFLOOR_ON - -/obj/item/stack/tile/light/proc/color_desc() - switch(state) - if(LIGHTFLOOR_ON) return "light blue" - if(LIGHTFLOOR_WHITE) return "white" - if(LIGHTFLOOR_RED) return "red" - if(LIGHTFLOOR_GREEN) return "green" - if(LIGHTFLOOR_YELLOW) return "yellow" - if(LIGHTFLOOR_BLUE) return "dark blue" - if(LIGHTFLOOR_PURPLE) return "purple" - else return "broken" - -/obj/item/stack/tile/light/attackby(var/obj/item/O as obj, var/mob/user as mob, params) - ..() - 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.unEquip(src, 1) - del(src) - else if(istype(O,/obj/item/device/multitool)) - state++ - if(state>LIGHTFLOOR_PURPLE) state=LIGHTFLOOR_ON - icon_state="tile_"+color_desc() - user << "[src] is now "+color_desc() - - return ..() - \ No newline at end of file diff --git a/code/game/objects/items/stacks/tiles/tile_types.dm b/code/game/objects/items/stacks/tiles/tile_types.dm index 207a046446e..b42dd419ad3 100644 --- a/code/game/objects/items/stacks/tiles/tile_types.dm +++ b/code/game/objects/items/stacks/tiles/tile_types.dm @@ -70,4 +70,18 @@ throw_range = 7 flags = CONDUCT turf_type = /turf/simulated/floor/plasteel - mineralType = "metal" \ No newline at end of file + mineralType = "metal" + +/* + * Light + */ +/obj/item/stack/tile/light + name = "light tiles" + gender = PLURAL + singular_name = "light floor tile" + desc = "A floor tile, made out off glass. Use a multitool on it to change its color." + icon_state = "tile_light blue" + force = 3 + throwforce = 5 + attack_verb = list("bashed", "battered", "bludgeoned", "thrashed", "smashed") + turf_type = /turf/simulated/floor/light \ No newline at end of file diff --git a/code/game/turfs/simulated/floor/light_floor.dm b/code/game/turfs/simulated/floor/light_floor.dm index 25a66394504..8149dae593a 100644 --- a/code/game/turfs/simulated/floor/light_floor.dm +++ b/code/game/turfs/simulated/floor/light_floor.dm @@ -1,9 +1,19 @@ +#define LIGHTFLOOR_ON 1 +#define LIGHTFLOOR_WHITE 2 +#define LIGHTFLOOR_RED 3 +#define LIGHTFLOOR_GREEN 4 +#define LIGHTFLOOR_YELLOW 5 +#define LIGHTFLOOR_BLUE 6 +#define LIGHTFLOOR_PURPLE 7 + /turf/simulated/floor/light name = "Light floor" light_range = 5 icon_state = "light_on" floor_tile = /obj/item/stack/tile/light broken_states = list("light_broken") + var/on = 1 + var/state = LIGHTFLOOR_ON /turf/simulated/floor/light/New() ..() @@ -11,58 +21,63 @@ /turf/simulated/floor/light/update_icon() ..() - if(istype(builtin_tile, /obj/item/stack/tile/light)) - var/obj/item/stack/tile/light/T = builtin_tile - if(T.on) - switch(T.state) - if(LIGHTFLOOR_ON) - icon_state = "light_on" - set_light(5,null,LIGHT_COLOR_LIGHTBLUE) - if(LIGHTFLOOR_WHITE) - icon_state = "light_on-w" - set_light(5,null,LIGHT_COLOR_WHITE) - if(LIGHTFLOOR_RED) - icon_state = "light_on-r" - set_light(5,null,LIGHT_COLOR_RED) - if(LIGHTFLOOR_GREEN) - icon_state = "light_on-g" - set_light(5,null,LIGHT_COLOR_PURE_GREEN) - if(LIGHTFLOOR_YELLOW) - icon_state = "light_on-y" - set_light(5,null,"#FFFF00") - if(LIGHTFLOOR_BLUE) - icon_state = "light_on-b" - set_light(5,null,LIGHT_COLOR_DARKBLUE) - if(LIGHTFLOOR_PURPLE) - icon_state = "light_on-p" - set_light(5,null,LIGHT_COLOR_PURPLE) - else - icon_state = "light_off" - set_light(0) - else - set_light(0) - icon_state = "light_off" + if(on) + switch(state) + if(LIGHTFLOOR_ON) + icon_state = "light_on" + set_light(5,null,LIGHT_COLOR_LIGHTBLUE) + if(LIGHTFLOOR_WHITE) + icon_state = "light_on-w" + set_light(5,null,LIGHT_COLOR_WHITE) + if(LIGHTFLOOR_RED) + icon_state = "light_on-r" + set_light(5,null,LIGHT_COLOR_RED) + if(LIGHTFLOOR_GREEN) + icon_state = "light_on-g" + set_light(5,null,LIGHT_COLOR_PURE_GREEN) + if(LIGHTFLOOR_YELLOW) + icon_state = "light_on-y" + set_light(5,null,"#FFFF00") + if(LIGHTFLOOR_BLUE) + icon_state = "light_on-b" + set_light(5,null,LIGHT_COLOR_DARKBLUE) + if(LIGHTFLOOR_PURPLE) + icon_state = "light_on-p" + set_light(5,null,LIGHT_COLOR_PURPLE) + else + icon_state = "light_off" + set_light(0) + else + set_light(0) + icon_state = "light_off" /turf/simulated/floor/light/ChangeTurf(turf/T) set_light(0) ..() /turf/simulated/floor/light/attack_hand(mob/user) - if(istype(builtin_tile, /obj/item/stack/tile/light)) - var/obj/item/stack/tile/light/T = builtin_tile - T.on = !T.on - update_icon() + on = !on + update_icon() /turf/simulated/floor/light/attackby(obj/item/C, mob/user, params) if(..()) return if(istype(C,/obj/item/weapon/light/bulb)) //only for light tiles if(istype(builtin_tile, /obj/item/stack/tile/light)) - var/obj/item/stack/tile/light/T = builtin_tile - if(T.state) + if(!state) qdel(C) - T.state = C //fixing it by bashing it with a light bulb, fun eh? + state = LIGHTFLOOR_ON update_icon() user << "You replace the light bulb." else - user << "The light bulb seems fine, no need to replace it." \ No newline at end of file + user << "The light bulb seems fine, no need to replace it." + if(istype(C,/obj/item/device/multitool)) + if(state != 0) + if(state < LIGHTFLOOR_PURPLE) + state++ + else + state = LIGHTFLOOR_ON + user << "You change \the [src]'s light bulb color." + update_icon() + else + user << "\The [src]'s light bulb appears to have burned out." \ No newline at end of file diff --git a/paradise.dme b/paradise.dme index ddc9a9720dd..87900dc097a 100644 --- a/paradise.dme +++ b/paradise.dme @@ -690,7 +690,6 @@ #include "code\game\objects\items\stacks\sheets\mineral.dm" #include "code\game\objects\items\stacks\sheets\sheet_types.dm" #include "code\game\objects\items\stacks\sheets\sheets.dm" -#include "code\game\objects\items\stacks\tiles\light.dm" #include "code\game\objects\items\stacks\tiles\tile_types.dm" #include "code\game\objects\items\weapons\AI_modules.dm" #include "code\game\objects\items\weapons\alien_specific.dm"