From 5140b4e906378ea82eba0ac0c7b925db29b35252 Mon Sep 17 00:00:00 2001 From: SkyMarshal Date: Sat, 11 Aug 2012 21:22:34 -0700 Subject: [PATCH 1/3] ZAS fixes. --- code/ZAS/Variable Settings.dm | 94 ++--------------------------------- code/ZAS/ZAS_Turfs.dm | 61 +++++------------------ code/ZAS/ZAS_Zones.dm | 1 + 3 files changed, 17 insertions(+), 139 deletions(-) diff --git a/code/ZAS/Variable Settings.dm b/code/ZAS/Variable Settings.dm index deb24080642..9b02ec553e6 100644 --- a/code/ZAS/Variable Settings.dm +++ b/code/ZAS/Variable Settings.dm @@ -1,9 +1,6 @@ var/global/vs_control/vsc = new vs_control/var -// zone_share_percent = 12 -// zone_share_percent_NAME = "Zone Share Percent" -// zone_share_percent_DESC = "Percentage of air difference to move per tick" IgnitionLevel = 0.5 IgnitionLevel_DESC = "Moles of oxygen+plasma - co2 needed to burn." airflow_lightest_pressure = 30 @@ -49,10 +46,7 @@ vs_control list/settings = list() list/bitflags = list("1","2","4","8","16","32","64","128","256","512","1024") pl_control/plc = new() - /*RPREV_REQUIRE_HEADS_ALIVE = 0 - RPREV_REQUIRE_HEADS_ALIVE_DESC = "Require the heads to be captured alive in RP Rev, rather than either dead or captured." - RPREV_REQUIRE_REVS_ALIVE = 0 - RPREV_REQUIRE_REVS_ALIVE_DESC = "Require the rev leaders to be captured alive in RP Rev, rather than either dead or captured."*/ + New() . = ..() settings = vars.Copy() @@ -142,7 +136,6 @@ vs_control if(how == "Toggle") newvar = (newvar?"ON":"OFF") world << "\blue [key_name(user)] changed the setting [display_description] to [newvar]." - //user << "[which] has been changed to [newvar]." if(ch in plc.settings) ChangeSettingsDialog(user,plc.settings) else @@ -162,7 +155,6 @@ vs_control proc/ChangePlasma() for(var/V in plc.settings) plc.Randomize(V) - ////world << "Plasma randomized." proc/SetDefault(var/mob/user) var/list/setting_choices = list("Plasma - Standard", "Plasma - Low Hazard", "Plasma - High Hazard", "Plasma - Oh Shit!",\ @@ -173,100 +165,35 @@ vs_control switch(def) if("Plasma - Standard") plc.CLOTH_CONTAMINATION = 0 //If this is on, plasma does damage by getting into cloth. - plc.PLASMAGUARD_ONLY = 0 - - //plc.CANISTER_CORROSION = 0 //If this is on, plasma must be stored in orange tanks and canisters, - plc.GENETIC_CORRUPTION = 0 //Chance of genetic corruption as well as toxic damage, X in 1000. - plc.SKIN_BURNS = 0 //Plasma has an effect similar to mustard gas on the un-suited. - - //plc.PLASMA_INJECTS_TOXINS = 0 //Plasma damage injects the toxins chemical to do damage over time. - plc.EYE_BURNS = 0 //Plasma burns the eyes of anyone not wearing eye protection. - plc.PLASMA_HALLUCINATION = 0 - - //plc.N2O_REACTION = 0 //Plasma can react with N2O, making sparks and starting a fire if levels are high. - - //plc.PLASMA_COLOR = "onturf" //Plasma can change colors yaaaay! - - //plc.PLASMA_DMG_OFFSET = 1 - //plc.PLASMA_DMG_QUOTIENT = 10 - plc.CONTAMINATION_LOSS = 0 + if("Plasma - Low Hazard") plc.CLOTH_CONTAMINATION = 0 //If this is on, plasma does damage by getting into cloth. - plc.PLASMAGUARD_ONLY = 0 - - // plc.CANISTER_CORROSION = 0 //If this is on, plasma must be stored in orange tanks and canisters, - - plc.GENETIC_CORRUPTION = 0 //Chance of genetic corruption as well as toxic damage, X in 1000. - + plc.GENETIC_CORRUPTION = 0 //Chance of genetic corruption as well as toxic damage, X in 1000 plc.SKIN_BURNS = 1 //Plasma has an effect similar to mustard gas on the un-suited. - - // plc.PLASMA_INJECTS_TOXINS = 0 //Plasma damage injects the toxins chemical to do damage over time. - plc.EYE_BURNS = 0 //Plasma burns the eyes of anyone not wearing eye protection. - - // plc.N2O_REACTION = 0 //Plasma can react with N2O, making sparks and starting a fire if levels are high. - - // plc.PLASMA_COLOR = "onturf" //RBPYB - - //if(prob(20)) - // plc.PLASMA_COLOR = pick("red","yellow","blue","purple") - - //plc.PLASMA_DMG_OFFSET = 1.5 - //plc.PLASMA_DMG_QUOTIENT = 8 - plc.CONTAMINATION_LOSS = 0 if("Plasma - High Hazard") plc.CLOTH_CONTAMINATION = 1 //If this is on, plasma does damage by getting into cloth. - plc.PLASMAGUARD_ONLY = 0 - - // plc.CANISTER_CORROSION = 1 //If this is on, plasma must be stored in orange tanks and canisters, - plc.GENETIC_CORRUPTION = 0 //Chance of genetic corruption as well as toxic damage, X in 1000. - plc.SKIN_BURNS = 1 //Plasma has an effect similar to mustard gas on the un-suited. - - // plc.PLASMA_INJECTS_TOXINS = 0 //Plasma damage injects the toxins chemical to do damage over time. - plc.EYE_BURNS = 1 //Plasma burns the eyes of anyone not wearing eye protection. - // plc.N2O_REACTION = 0 //Plasma can react with N2O, making sparks and starting a fire if levels are high. - - // plc.PLASMA_COLOR = "onturf"//pick("red","yellow","blue","purple") //RBPYB - - //plc.PLASMA_DMG_OFFSET = 3 - //plc.PLASMA_DMG_QUOTIENT = 5 - if("Plasma - Oh Shit!") plc.CLOTH_CONTAMINATION = 1 //If this is on, plasma does damage by getting into cloth. - plc.PLASMAGUARD_ONLY = 1 - - // plc.CANISTER_CORROSION = 1 //If this is on, plasma must be stored in orange tanks and canisters, - plc.GENETIC_CORRUPTION = 5 //Chance of genetic corruption as well as toxic damage, X in 1000. - plc.SKIN_BURNS = 1 //Plasma has an effect similar to mustard gas on the un-suited. - - // plc.PLASMA_INJECTS_TOXINS = 1 //Plasma damage injects the toxins chemical to do damage over time. - plc.EYE_BURNS = 1 //Plasma burns the eyes of anyone not wearing eye protection. - // plc.N2O_REACTION = 1 //Plasma can react with N2O, making sparks and starting a fire if levels are high. - - // plc.PLASMA_COLOR = "onturf" //RBPYB - - //plc.PLASMA_DMG_OFFSET = 3 - //plc.PLASMA_DMG_QUOTIENT = 5 - if("ZAS - Normal") IgnitionLevel = 0.5 airflow_lightest_pressure = 30 @@ -346,40 +273,27 @@ pl_control settings -= "settings" proc/Randomize(V) - //world << "Randomizing [V]" var/newvalue if("[V]_RANDOM" in vars) if(isnum(vars["[V]_RANDOM"])) newvalue = prob(vars["[V]_RANDOM"]) - if(newvalue) - //world << "Probability [vars["[V]_RANDOM"]]%: Success." - else - //world << "Probability [vars["[V]_RANDOM"]]%: Failure." else if(istext(vars["[V]_RANDOM"])) var/txt = vars["[V]_RANDOM"] if(findtextEx(txt,"PROB")) - //world << "Probability/Roll Combo \..." txt = dd_text2list(txt,"/") txt[1] = dd_replacetext(txt[1],"PROB","") var/p = text2num(txt[1]) var/r = txt[2] - //world << "Prob:[p]% Roll:[r]" if(prob(p)) newvalue = roll(r) - //world << "Success. New value: [newvalue]" else newvalue = vars[V] - //world << "Probability check failed." else if(findtextEx(txt,"PICK")) txt = dd_replacetext(txt,"PICK","") - //world << "Pick: [txt]" txt = dd_text2list(txt,",") newvalue = pick(txt) - //world << "Picked: [newvalue]" else newvalue = roll(txt) - //world << "Roll: [txt] - [newvalue]" else newvalue = vars[V] - vars[V] = newvalue - ////world << "Plasma color updated." \ No newline at end of file + vars[V] = newvalue \ No newline at end of file diff --git a/code/ZAS/ZAS_Turfs.dm b/code/ZAS/ZAS_Turfs.dm index c2c7fd5f067..92754fe92e2 100644 --- a/code/ZAS/ZAS_Turfs.dm +++ b/code/ZAS/ZAS_Turfs.dm @@ -45,46 +45,24 @@ turf datum/gas_mixture/air processing = 1 -// group_border = 0 -// length_space_border = 0 air_check_directions = 0 //Do not modify this, just add turf to air_master.tiles_to_update -// archived_cycle = 0 -// current_cycle = 0 - obj/fire/active_hotspot -// temperature_archived //USED ONLY FOR SOLIDS -// being_superconductive = 0 + proc/update_visuals() + overlays = null - proc - process_cell() - update_air_properties() - archive() - - mimic_air_with_tile(turf/model) - share_air_with_tile(turf/simulated/sharer) - - mimic_temperature_with_tile(turf/model) - share_temperature_with_tile(turf/simulated/sharer) - - - super_conduct() - - update_visuals() - overlays = null - - var/siding_icon_state = return_siding_icon_state() - if(siding_icon_state) - overlays += image('floors.dmi',siding_icon_state) - var/datum/gas_mixture/model = return_air() - switch(model.graphic) - if(1) - overlays.Add(plmaster) //TODO: Make invisible plasma an option - if(2) - overlays.Add(slmaster) + var/siding_icon_state = return_siding_icon_state() + if(siding_icon_state) + overlays += image('floors.dmi',siding_icon_state) + var/datum/gas_mixture/model = return_air() + switch(model.graphic) + if(1) + overlays.Add(plmaster) //TODO: Make invisible plasma an option + if(2) + overlays.Add(slmaster) @@ -105,8 +83,6 @@ turf if(air_master) air_master.tiles_to_update.Add(src) -// air.parent = src //TODO DEBUG REMOVE - else if(air_master) for(var/direction in cardinal) @@ -132,19 +108,6 @@ turf else return ..() -// archive() -// if(air) //For open space like floors -// air.archive() - -// temperature_archived = temperature -// archived_cycle = air_master.current_cycle - - share_air_with_tile(turf/simulated/T) - return air.share(T.air) - - mimic_air_with_tile(turf/T) - return air.mimic(T) - return_air() if(zone) return zone.air @@ -170,7 +133,7 @@ turf else return ..() - update_air_properties() + proc/update_air_properties() . = 1 air_check_directions = 0 diff --git a/code/ZAS/ZAS_Zones.dm b/code/ZAS/ZAS_Zones.dm index 36e5ccec39f..2c249a75671 100644 --- a/code/ZAS/ZAS_Zones.dm +++ b/code/ZAS/ZAS_Zones.dm @@ -359,6 +359,7 @@ proc/ShareSpace(datum/gas_mixture/A, list/unsimulated_tiles) if(sharing_lookup_table.len >= unsimulated_tiles.len) //6 or more interconnecting tiles will max at 42% of air moved per tick. ratio = sharing_lookup_table[unsimulated_tiles.len] + ratio *= 2 A.oxygen = max(0, (A.oxygen - oxy_avg) * (1-ratio) + oxy_avg ) A.nitrogen = max(0, (A.nitrogen - nit_avg) * (1-ratio) + nit_avg ) From 0bee1cb6b5750b0b381a7871c6fb527d704548d1 Mon Sep 17 00:00:00 2001 From: SkyMarshal Date: Sat, 11 Aug 2012 23:40:28 -0700 Subject: [PATCH 2/3] Work on 3D stuff. --- baystation12.dme | 3 +- code/TriDimension/Movement.dm | 49 ++++ .../Processing.dm => TriDimension/Pipes.dm} | 0 code/TriDimension/Structures.dm | 173 +++++++++++ code/TriDimension/Turfs.dm | 96 ++++++ .../Cael_Aislinn => TriDimension}/multiz.dmi | Bin code/WorkInProgress/Cael_Aislinn/MultiZ.dm | 277 ------------------ code/ZAS/Functions.dm | 2 +- code/setup.dm | 14 +- code/setup_3d.dm | 20 ++ 10 files changed, 342 insertions(+), 292 deletions(-) create mode 100644 code/TriDimension/Movement.dm rename code/{ZAS/Processing.dm => TriDimension/Pipes.dm} (100%) create mode 100644 code/TriDimension/Structures.dm create mode 100644 code/TriDimension/Turfs.dm rename code/{WorkInProgress/Cael_Aislinn => TriDimension}/multiz.dmi (100%) delete mode 100644 code/WorkInProgress/Cael_Aislinn/MultiZ.dm create mode 100644 code/setup_3d.dm diff --git a/baystation12.dme b/baystation12.dme index 1b527b04f99..14a379fc536 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -154,6 +154,7 @@ #define FILE_DIR "code/modules/scripting/Parser" #define FILE_DIR "code/modules/scripting/Scanner" #define FILE_DIR "code/modules/security levels" +#define FILE_DIR "code/TriDimension" #define FILE_DIR "code/unused" #define FILE_DIR "code/unused/beast" #define FILE_DIR "code/unused/computer2" @@ -231,6 +232,7 @@ #include "code\access_defines.dm" #include "code\names.dm" #include "code\setup.dm" +#include "code\setup_3d.dm" #include "code\stylesheet.dm" #include "code\ATMOSPHERICS\atmospherics.dm" #include "code\ATMOSPHERICS\datum_pipe_network.dm" @@ -1267,7 +1269,6 @@ #include "code\ZAS\Fire.dm" #include "code\ZAS\Functions.dm" #include "code\ZAS\Plasma.dm" -#include "code\ZAS\Processing.dm" #include "code\ZAS\Variable Settings.dm" #include "code\ZAS\ZAS_Turfs.dm" #include "code\ZAS\ZAS_Zones.dm" diff --git a/code/TriDimension/Movement.dm b/code/TriDimension/Movement.dm new file mode 100644 index 00000000000..dfb529df5b1 --- /dev/null +++ b/code/TriDimension/Movement.dm @@ -0,0 +1,49 @@ +var/maxZ = 6 +var/minZ = 2 + +// Maybe it's best to have this hardcoded for whatever we'd add to the map, in order to avoid exploits +// (such as mining base => admin station) +// Note that this assumes the ship's top is at z=1 and bottom at z=4 +/obj/item/weapon/tank/jetpack/proc/move_z(cardinal, mob/user as mob) + if (user.z > 1) + user << "\red There is nothing of interest in that direction." + return + if(allow_thrust(0.01, user)) + switch(cardinal) + if (UP) // Going up! + if(user.z > maxZ) // If we aren't at the very top of the ship + var/turf/T = locate(user.x, user.y, user.z - 1) + // You can only jetpack up if there's space above, and you're sitting on either hull (on the exterior), or space + //if(T && istype(T, /turf/space) && (istype(user.loc, /turf/space) || istype(user.loc, /turf/space/*/hull*/))) + //check through turf contents to make sure there's nothing blocking the way + if(T && istype(T, /turf/space)) + var/blocked = 0 + for(var/atom/A in T.contents) + if(T.density) + blocked = 1 + user << "\red You bump into [T.name]." + break + if(!blocked) + user.Move(T) + else + user << "\red You bump into the ship's plating." + else + user << "\red The ship's gravity well keeps you in orbit!" // Assuming the ship starts on z level 1, you don't want to go past it + + if (DOWN) // Going down! + if (user.z < 1) // If we aren't at the very bottom of the ship, or out in space + var/turf/T = locate(user.x, user.y, user.z + 1) + // You can only jetpack down if you're sitting on space and there's space down below, or hull + if(T && (istype(T, /turf/space) || istype(T, /turf/space/*/hull*/)) && istype(user.loc, /turf/space)) + var/blocked = 0 + for(var/atom/A in T.contents) + if(T.density) + blocked = 1 + user << "\red You bump into [T.name]." + break + if(!blocked) + user.Move(T) + else + user << "\red You bump into the ship's plating." + else + user << "\red The ship's gravity well keeps you in orbit!" \ No newline at end of file diff --git a/code/ZAS/Processing.dm b/code/TriDimension/Pipes.dm similarity index 100% rename from code/ZAS/Processing.dm rename to code/TriDimension/Pipes.dm diff --git a/code/TriDimension/Structures.dm b/code/TriDimension/Structures.dm new file mode 100644 index 00000000000..c1aadc83525 --- /dev/null +++ b/code/TriDimension/Structures.dm @@ -0,0 +1,173 @@ +/////////////////////////////////////// +//Contents: Ladders, Hatches, Stairs.// +/////////////////////////////////////// + +/obj/multiz + icon = 'multiz.dmi' + density = 0 + opacity = 0 + anchored = 1 + var/obj/multiz/target + + CanPass(obj/mover, turf/source, height, airflow) + return airflow || !density + +/obj/multiz/ladder + icon_state = "ladderdown" + name = "ladder" + desc = "A Ladder. You climb up and down it." + + var/top_icon_state = "ladderdown" + var/bottom_icon_state = "ladderup" + + New() + . = ..() + spawn(1) //Allow map to load + if(!target) + target = locate() in locate(x,y,z-1) + if (istype(target)) + icon_state = top_icon_state + else + target = locate() in locate(x,y,z+1) + if (istype(target)) + icon_state = bottom_icon_state + else + del src + if(target) + target.icon_state = ( icon_state == top_icon_state ? bottom_icon_state : top_icon_state) + target.target = src + + Del() + spawn(1) + if(target) + del target + return ..() + + attack_paw(var/mob/M) + return attack_hand(M) + + attackby(var/W, var/mob/M) + return attack_hand(M) + + attack_hand(var/mob/M) + if(!target || !istype(target.loc, /turf)) + del src + M.visible_message("\blue \The [M] climbs [target.z > z ? "up" : "down"] \the [src]!", "You climb [target.z > z ? "up" : "down"] \the [src]!", "You hear some grunting, and clanging of a metal ladder being used.") + M.Move(target.loc) + + + hatch + icon_state = "hatchdown" + name = "hatch" + desc = "A hatch. You climb down it, and it will automatically seal against pressure loss behind you." + top_icon_state = "hatchdown" + var/top_icon_state_open = "hatchdown-open" + var/top_icon_state_close = "hatchdown-close" + + bottom_icon_state = "hatchup" + + var/image/green_overlay + var/image/red_overlay + + var/active = 0 + + New() + . = ..() + red_overlay = image(icon, "red-ladderlight") + green_overlay = image(icon, "green-ladderlight") + + attack_hand(var/mob/M) + + if(!target || !istype(target.loc, /turf)) + del src + + if(active) + M << "That [src] is being used." + return // It is a tiny airlock, only one at a time. + + active = 1 + var/obj/multiz/ladder/hatch/top_hatch = target + var/obj/multiz/ladder/hatch/bottom_hatch = src + if(icon_state == top_icon_state) + top_hatch = src + bottom_hatch = target + + flick(top_icon_state_open, top_hatch) + bottom_hatch.overlays += green_overlay + + spawn(7) + if(!target || !istype(target.loc, /turf)) + del src + if(M.z == z && get_dist(src,M) <= 1) + M.visible_message("\blue \The [M] scurries [target.z > z ? "up" : "down"] \the [src]!", "You scramble [target.z > z ? "up" : "down"] \the [src]!", "You hear some grunting, and a hatch sealing.") + M.Move(target.loc) + flick(top_icon_state_close,top_hatch) + bottom_hatch.overlays -= green_overlay + bottom_hatch.overlays += red_overlay + + spawn(7) + top_hatch.icon_state = top_icon_state + bottom_hatch.overlays -= red_overlay + active = 0 + +/obj/multiz/stairs + name = "Stairs" + desc = "Stairs. You walk up and down them." + icon_state = "ramptop" + var/top_icon_state = "ramptop" + var/bottom_icon_state = "rampbottom" + + active + density = 1 + + + New() + . = ..() + spawn(1) + if(!target) + target = locate() in locate(x,y,z+1) + if(istype(target)) + icon_state = bottom_icon_state + else + target = locate() in locate(x,y,z-1) + if(istype(target)) + icon_state = top_icon_state + else + del src + if(target) + target.icon_state = ( icon_state == top_icon_state ? bottom_icon_state : top_icon_state) + target.target = src + var/obj/multiz/stairs/lead_in = locate() in get_step(src, reverse_direction(dir)) + if(lead_in) + lead_in.icon_state = ( icon_state == top_icon_state ? bottom_icon_state : top_icon_state) + + + Del() + spawn(1) + if(target) + del target + return ..() + + + Bumped(var/atom/movable/M) + if(target.z > z && istype(src, /obj/multiz/stairs/active) && !locate(/obj/multiz/stairs) in M.loc) + return //If on bottom, only let them go up stairs if they've moved to the entry tile first. + //If it's the top, they can fall down just fine. + + if(!target || !istype(target.loc, /turf)) + del src + + if(ismob(M) && M:client) + M:client.moving = 1 + M.Move(target.loc) + if (ismob(M) && M:client) + M:client.moving = 0 + + Click() + if(!istype(usr,/mob/dead/observer)) + return ..() + if(!target || !istype(target.loc, /turf)) + del src + usr.client.moving = 1 + usr.Move(target.loc) + usr.client.moving = 0 \ No newline at end of file diff --git a/code/TriDimension/Turfs.dm b/code/TriDimension/Turfs.dm new file mode 100644 index 00000000000..59342eb0904 --- /dev/null +++ b/code/TriDimension/Turfs.dm @@ -0,0 +1,96 @@ +atom/movable/var/list/adjacent_z_levels +atom/movable/var/archived_z_level + +atom/movable/Move() //Hackish + + if(adjacent_z_levels && adjacent_z_levels["up"]) + var/turf/above_me = locate(x,y,adjacent_z_levels["up"]) + if(istype(above_me, /turf/simulated/floor/open)) + above_me:RemoveImage(src) + + . = ..() + + if(archived_z_level != z) + archived_z_level = z + if(z in levels_3d) + adjacent_z_levels = global_adjacent_z_levels["[z]"] + else + adjacent_z_levels = null + + if(adjacent_z_levels && adjacent_z_levels["up"]) + var/turf/above_me = locate(x,y,adjacent_z_levels["up"]) + if(istype(above_me, /turf/simulated/floor/open)) + above_me:AddImage(src) + +/turf/simulated/floor/open + name = "open space" + intact = 0 + density = 0 + icon_state = "black" + pathweight = 100000 //Seriously, don't try and path over this one numbnuts + var/icon/darkoverlays = null + var/turf/floorbelow + var/list/overlay_references + mouse_opacity = 2 + + New() + ..() + spawn(1) + if(!(z in levels_3d)) + ReplaceWithSpace() + var/list/adjacent_to_me = global_adjacent_z_levels["[z]"] + if(!("down" in adjacent_to_me)) + ReplaceWithSpace() + + floorbelow = locate(x, y, adjacent_to_me["down"]) + if(floorbelow) + if(!istype(floorbelow,/turf)) + del src + else if(floorbelow.density) + ReplaceWithPlating() + else + set_up() + else + ReplaceWithSpace() + + + Enter(var/atom/movable/AM) + if (..()) //TODO make this check if gravity is active (future use) - Sukasa + spawn(1) + if(AM) + AM.Move(floorbelow) + if (istype(AM, /mob/living/carbon/human)) + var/mob/living/carbon/human/H = AM + var/damage = rand(5,15) + H.apply_damage(2*damage, BRUTE, "head") + H.apply_damage(2*damage, BRUTE, "chest") + H.apply_damage(0.5*damage, BRUTE, "l_leg") + H.apply_damage(0.5*damage, BRUTE, "r_leg") + H.apply_damage(0.5*damage, BRUTE, "l_arm") + H.apply_damage(0.5*damage, BRUTE, "r_arm") + H:weakened = max(H:weakened,2) + H:updatehealth() + return ..() + + attackby() + return //nothing + + proc/set_up() //Update the overlayss to make the openspace turf show what's down a level + if(!overlay_references) + overlay_references = list() + if(!floorbelow) return + overlays += floorbelow + for(var/obj/o in floorbelow) + var/image/o_img = image(o, dir=o.dir, layer = TURF_LAYER+0.05*o.layer) + overlays += o_img + overlay_references[o] = o_img + + proc/AddImage(var/atom/movable/o) + var/o_img = image(o, dir=o.dir, layer = TURF_LAYER+0.05*o.layer) + overlays += o_img + overlay_references[o] = o_img + + proc/RemoveImage(var/atom/movable/o) + var/o_img = overlay_references[o] + overlays -= o_img + overlay_references -= o \ No newline at end of file diff --git a/code/WorkInProgress/Cael_Aislinn/multiz.dmi b/code/TriDimension/multiz.dmi similarity index 100% rename from code/WorkInProgress/Cael_Aislinn/multiz.dmi rename to code/TriDimension/multiz.dmi diff --git a/code/WorkInProgress/Cael_Aislinn/MultiZ.dm b/code/WorkInProgress/Cael_Aislinn/MultiZ.dm deleted file mode 100644 index 855e26e14ab..00000000000 --- a/code/WorkInProgress/Cael_Aislinn/MultiZ.dm +++ /dev/null @@ -1,277 +0,0 @@ -/obj/multiz - icon = 'multiz.dmi' - density = 0 - opacity = 0 - anchored = 1 - var/istop = 1 - - CanPass(obj/mover, turf/source, height, airflow) - return airflow || !density - -/obj/multiz/proc/targetZ() - return src.z + (istop ? 1 : -1) - -/obj/multiz/ladder - icon_state = "ladderdown" - name = "ladder" - desc = "A Ladder. You climb up and down it." - -/obj/multiz/ladder/New() - ..() - if (!istop) - icon_state = "ladderup" - else - icon_state = "ladderdown" - -/obj/multiz/ladder/attack_paw(var/mob/M) - return attack_hand(M) - -/obj/multiz/ladder/attackby(var/W, var/mob/M) - return attack_hand(M) - -/obj/multiz/ladder/attack_hand(var/mob/M) - M.Move(locate(src.x, src.y, targetZ())) - - -/obj/multiz/ladder/hatch - icon_state = "hatchdown" - name = "hatch" - desc = "A Hatch. You climb down it, and it will automatically seal against pressure loss behind you." - -/obj/multiz/ladder/hatch/New() - ..() - if(istop == 1) - icon_state = "hatchdown" - -/obj/multiz/ladder/hatch/hatchbottom - icon_state = "hatchdown" - -/obj/multiz/ladder/hatch/hatchbottom/New() - istop = 0 - ..() - -/obj/multiz/ladder/hatch/attack_hand(var/mob/M) - var/obj/multiz/ladder/hatch/Htop - var/obj/multiz/ladder/hatch/Hbottom - if(!istop && src.z > 1) - Htop = locate(/obj/multiz/ladder/hatch, locate(src.x, src.y, src.z-1)) - Hbottom = src - else - Hbottom = locate(/obj/multiz/ladder/hatch, locate(src.x, src.y, src.z + 1)) - Htop = src - - if(!Htop) - //world << "Htop == null" - return - if(!Hbottom) - //world << "Hbottom == null" - return - - if(Htop.icon_state == "hatchdown") - flick("hatchdown-open",Htop) - Hbottom.overlays += "green-ladderlight" - spawn(7) - if(M.z == src.z && get_dist(src,M) <= 1) - M.Move(locate(src.x, src.y, targetZ())) - flick("hatchdown-close",Htop) - Hbottom.overlays -= "green-ladderlight" - Hbottom.overlays += "red-ladderlight" - spawn(7) - Htop.icon_state = "hatchdown" - Hbottom.overlays -= "red-ladderlight" - -/* -/obj/multiz/ladder/blob_act() - var/newblob = 1 - for(var/obj/blob in locate(src.x, src.y, targetZ())) - newblob = 0 - if(newblob) - new /obj/blob(locate(src.x, src.y, targetZ())) -*/ -//Stairs. var/dir on all four component objects should be the dir you'd walk from top to bottom -//active = bump to move down -//active/bottom = bump to move up -//enter = decorative downwards stairs -//enter/bottom = decorative upward stairs -/obj/multiz/stairs - name = "Stairs" - desc = "Stairs. You walk up and down them." - icon_state = "ramptop" - -/obj/multiz/stairs/New() - icon_state = istop ^ istype(src, /obj/multiz/stairs/active) ? "ramptop" : "rampbottom" - -/obj/multiz/stairs/enter/bottom - istop = 0 - -/obj/multiz/stairs/active - density = 1 - -/obj/multiz/stairs/active/Bumped(var/atom/movable/M) - if(istype(src, /obj/multiz/stairs/active/bottom) && !locate(/obj/multiz/stairs/enter) in M.loc) - return //If on bottom, only let them go up stairs if they've moved to the entry tile first. - //If it's the top, they can fall down just fine. - if(ismob(M) && M:client) - M:client.moving = 1 - M.Move(locate(src.x, src.y, targetZ())) - if (ismob(M) && M:client) - M:client.moving = 0 - -/obj/multiz/stairs/active/Click() - if(!istype(usr,/mob/dead/observer)) - return ..() - usr.client.moving = 1 - usr.Move(locate(src.x, src.y, targetZ())) - usr.client.moving = 0 -/obj/multiz/stairs/active/bottom - istop = 0 - opacity = 1 - -/turf/simulated/floor/open - name = "open space" - intact = 0 - icon_state = "black" - pathweight = 100000 //Seriously, don't try and path over this one numbnuts - var/icon/darkoverlays = null - var/turf/floorbelow - //floorstrength = 1 - mouse_opacity = 2 - - New() - ..() - spawn(1) - if(!istype(src, /turf/simulated/floor/open)) //This should not be needed but is. - return - floorbelow = locate(x, y, z + 1) - if(floorbelow) - //Fortunately, I've done this before. - Aryn - if(istype(floorbelow,/turf/space) || floorbelow.z > 4) - new/turf/space(src) - else if(!istype(floorbelow,/turf/simulated/floor)) - new/turf/simulated/floor/plating(src) - else - //if(ticker) - //find_zone() - update() - else - new/turf/space(src) - - Del() - . = ..() - - Enter(var/atom/movable/AM) - if (..()) //TODO make this check if gravity is active (future use) - Sukasa - spawn(1) - if(AM) - AM.Move(locate(x, y, z + 1)) - if (istype(AM, /mob/living/carbon/human)) - var/mob/living/carbon/human/H = AM - var/damage = rand(5,15) - H.apply_damage(2*damage, BRUTE, "head") - H.apply_damage(2*damage, BRUTE, "chest") - H.apply_damage(0.5*damage, BRUTE, "l_leg") - H.apply_damage(0.5*damage, BRUTE, "r_leg") - H.apply_damage(0.5*damage, BRUTE, "l_arm") - H.apply_damage(0.5*damage, BRUTE, "r_arm") - -/* -/obj/effect/decal/cleanable/blood - name = "Blood" - desc = "It's red and disgusting." - density = 0 - anchored = 1 - layer = 2 - icon = 'blood.dmi' - icon_state = "floor1" - random_icon_states = list("floor1", "floor2", "floor3", "floor4", "floor5", "floor6", "floor7") - var/list/viruses = list() - blood_DNA = list() - var/datum/disease2/disease/virus2 = null - var/OriginalMob = null - - Del() - for(var/datum/disease/D in viruses) - D.cure(0) - ..() -*/ - - // var/obj/effect/decal/cleanable/blood/B = new(src.loc) - // var/list/blood_DNA_temp[1] - // blood_DNA_temp[1] = list(H.dna.unique_enzymes, H.dna.b_type) - // B.blood_DNA = blood_DNA_temp - // B.virus2 = H.virus2 - // for(var/datum/disease/D in H.viruses) - // var/datum/disease/newDisease = new D.type - // B.viruses += newDisease - // newDisease.holder = B - - H:weakened = max(H:weakened,2) - H:updatehealth() - return ..() - - attackby() - //nothing - - proc/update() //Update the overlayss to make the openspace turf show what's down a level - if(!floorbelow) return - /*src.clearoverlays() - src.addoverlay(floorbelow) - for(var/obj/o in floorbelow.contents) - src.addoverlay(image(o, dir=o.dir, layer = TURF_LAYER+0.05*o.layer)) - var/image/I = image('ULIcons.dmi', "[min(max(floorbelow.LightLevelRed - 4, 0), 7)]-[min(max(floorbelow.LightLevelGreen - 4, 0), 7)]-[min(max(floorbelow.LightLevelBlue - 4, 0), 7)]") - I.layer = TURF_LAYER + 0.2 - src.addoverlay(I) - I = image('ULIcons.dmi', "1-1-1") - I.layer = TURF_LAYER + 0.2 - src.addoverlay(I)*/ - -var/maxZ = 6 -var/minZ = 2 - -// Maybe it's best to have this hardcoded for whatever we'd add to the map, in order to avoid exploits -// (such as mining base => admin station) -// Note that this assumes the ship's top is at z=1 and bottom at z=4 -/obj/item/weapon/tank/jetpack/proc/move_z(cardinal, mob/user as mob) - if (user.z > 1) - user << "\red There is nothing of interest in that direction." - return - if(allow_thrust(0.01, user)) - switch(cardinal) - if (UP) // Going up! - if(user.z > maxZ) // If we aren't at the very top of the ship - var/turf/T = locate(user.x, user.y, user.z - 1) - // You can only jetpack up if there's space above, and you're sitting on either hull (on the exterior), or space - //if(T && istype(T, /turf/space) && (istype(user.loc, /turf/space) || istype(user.loc, /turf/space/*/hull*/))) - //check through turf contents to make sure there's nothing blocking the way - if(T && istype(T, /turf/space)) - var/blocked = 0 - for(var/atom/A in T.contents) - if(T.density) - blocked = 1 - user << "\red You bump into [T.name]." - break - if(!blocked) - user.Move(T) - else - user << "\red You bump into the ship's plating." - else - user << "\red The ship's gravity well keeps you in orbit!" // Assuming the ship starts on z level 1, you don't want to go past it - - if (DOWN) // Going down! - if (user.z < 1) // If we aren't at the very bottom of the ship, or out in space - var/turf/T = locate(user.x, user.y, user.z + 1) - // You can only jetpack down if you're sitting on space and there's space down below, or hull - if(T && (istype(T, /turf/space) || istype(T, /turf/space/*/hull*/)) && istype(user.loc, /turf/space)) - var/blocked = 0 - for(var/atom/A in T.contents) - if(T.density) - blocked = 1 - user << "\red You bump into [T.name]." - break - if(!blocked) - user.Move(T) - else - user << "\red You bump into the ship's plating." - else - user << "\red The ship's gravity well keeps you in orbit!" - diff --git a/code/ZAS/Functions.dm b/code/ZAS/Functions.dm index 6d40eec83ed..81c9de64e0a 100644 --- a/code/ZAS/Functions.dm +++ b/code/ZAS/Functions.dm @@ -18,7 +18,7 @@ proc/FloodFill(turf/start) for(var/d in cardinal) var/turf/O = get_step(T,d) //Simple pass check. - if(istype(O) && !(O in open || O in closed || O in doors) && O.ZCanPass(T)) + if(istype(O) && !(O in open) && !(O in doors) && !(O in closed) && O.ZCanPass(T)) open += O else doors |= T diff --git a/code/setup.dm b/code/setup.dm index 7a2ee6fde6f..f58139c8bab 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -474,16 +474,4 @@ var/list/liftable_structures = list(\ #define ORGAN_DESTROYED 64 #define ORGAN_ROBOT 128 #define ORGAN_SPLINTED 256 -#define SALVED 512 - - /////////////////////////////////////////////// - //Important ZAS Functionality. 3D simulation// -/////////////////////////////////////////////// - -//Uncomment if you want it enabled -//#define ZAS_3D - -#ifdef ZAS_3D -var/list/adjacent_z_levels("1" = list("up" = 2, "down" = 7), "2" = list("down" = 1), "7" = list("up" = 1)) //Example. 2 is above 1 which is above 7. -#endif -//The above is for a future feature. \ No newline at end of file +#define SALVED 512 \ No newline at end of file diff --git a/code/setup_3d.dm b/code/setup_3d.dm new file mode 100644 index 00000000000..5b15584521f --- /dev/null +++ b/code/setup_3d.dm @@ -0,0 +1,20 @@ + /////////////////////////////////////////////// + //Important ZAS Functionality. 3D simulation// +/////////////////////////////////////////////// + +//Uncomment if you want it enabled +//#define ZAS_3D + +#ifdef ZAS_3D + +var/list/levels_3d = list(1,4,7) //To expediate calculations, just do "z in levels_3d" + +var/list/global_adjacent_z_levels = list("1" = list("up" = 2, "down" = 7), "2" = list("down" = 1), "7" = list("up" = 1)) //Example. 2 is above 1 which is above 7. + +//Commented out ones are incomplete. +//#include "TriDimension\Pipes.dm" //Example +#include "TriDimension\Structures.dm" +#include "TriDimension\Turfs.dm" +//#include "TriDimension\Movement.dm" + +#endif \ No newline at end of file From 4b1f394b2b71078d4e6d7a2b20fd0b2aed659d35 Mon Sep 17 00:00:00 2001 From: SkyMarshal Date: Sat, 11 Aug 2012 23:53:07 -0700 Subject: [PATCH 3/3] Made a whoopsie in the ladder code, now conforms to modular Z-levels. Signed-off-by: SkyMarshal --- code/TriDimension/Structures.dm | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/code/TriDimension/Structures.dm b/code/TriDimension/Structures.dm index c1aadc83525..2914f6a4ad9 100644 --- a/code/TriDimension/Structures.dm +++ b/code/TriDimension/Structures.dm @@ -24,11 +24,12 @@ . = ..() spawn(1) //Allow map to load if(!target) - target = locate() in locate(x,y,z-1) + var/list/adjacent_to_me = global_adjacent_z_levels["[z]"] + target = locate() in locate(x,y,adjacent_to_me["down"]) if (istype(target)) icon_state = top_icon_state else - target = locate() in locate(x,y,z+1) + target = locate() in locate(x,y,adjacent_to_me["up"]) if (istype(target)) icon_state = bottom_icon_state else @@ -52,7 +53,8 @@ attack_hand(var/mob/M) if(!target || !istype(target.loc, /turf)) del src - M.visible_message("\blue \The [M] climbs [target.z > z ? "up" : "down"] \the [src]!", "You climb [target.z > z ? "up" : "down"] \the [src]!", "You hear some grunting, and clanging of a metal ladder being used.") + var/list/adjacent_to_me = global_adjacent_z_levels["[z]"] + M.visible_message("\blue \The [M] climbs [target.z == adjacent_to_me["up"] ? "up" : "down"] \the [src]!", "You climb [target.z == adjacent_to_me["up"] ? "up" : "down"] \the [src]!", "You hear some grunting, and clanging of a metal ladder being used.") M.Move(target.loc) @@ -99,7 +101,8 @@ if(!target || !istype(target.loc, /turf)) del src if(M.z == z && get_dist(src,M) <= 1) - M.visible_message("\blue \The [M] scurries [target.z > z ? "up" : "down"] \the [src]!", "You scramble [target.z > z ? "up" : "down"] \the [src]!", "You hear some grunting, and a hatch sealing.") + var/list/adjacent_to_me = global_adjacent_z_levels["[z]"] + M.visible_message("\blue \The [M] scurries [target.z == adjacent_to_me["up"] ? "up" : "down"] \the [src]!", "You scramble [target.z == adjacent_to_me["up"] ? "up" : "down"] \the [src]!", "You hear some grunting, and a hatch sealing.") M.Move(target.loc) flick(top_icon_state_close,top_hatch) bottom_hatch.overlays -= green_overlay @@ -125,11 +128,12 @@ . = ..() spawn(1) if(!target) - target = locate() in locate(x,y,z+1) + var/list/adjacent_to_me = global_adjacent_z_levels["[z]"] + target = locate() in locate(x,y,adjacent_to_me["up"]) if(istype(target)) icon_state = bottom_icon_state else - target = locate() in locate(x,y,z-1) + target = locate() in locate(x,y,adjacent_to_me["down"]) if(istype(target)) icon_state = top_icon_state else