From ced6f13656b2e6d62c111f96af0c3515b31f9eec Mon Sep 17 00:00:00 2001 From: DJSnapshot Date: Fri, 20 Jun 2014 20:53:11 -0700 Subject: [PATCH 01/15] Removing automatic IPC whitelist in preparation for whitelisting and overhaul of IPCs. --- code/game/jobs/whitelist.dm | 2 -- 1 file changed, 2 deletions(-) diff --git a/code/game/jobs/whitelist.dm b/code/game/jobs/whitelist.dm index 2aaad4bde64..f8f3ee80a2c 100644 --- a/code/game/jobs/whitelist.dm +++ b/code/game/jobs/whitelist.dm @@ -36,8 +36,6 @@ var/list/whitelist = list() return 1 if(species == "human" || species == "Human") return 1 - if(species == "machine" || species == "Machine") - return 1 if(check_rights(R_ADMIN, 0)) return 1 if(!alien_whitelist) From 63f9b93ab064d8158d976c9eded264dc24d4698b Mon Sep 17 00:00:00 2001 From: Loganbacca Date: Sun, 22 Jun 2014 12:57:37 +1200 Subject: [PATCH 02/15] Preview icon render fix - Fixes #5254 - Changes organ render list to a structured list so we can control the render order --- code/modules/mob/new_player/preferences_setup.dm | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/code/modules/mob/new_player/preferences_setup.dm b/code/modules/mob/new_player/preferences_setup.dm index b32a4780b03..5bfca3a02c9 100644 --- a/code/modules/mob/new_player/preferences_setup.dm +++ b/code/modules/mob/new_player/preferences_setup.dm @@ -198,12 +198,7 @@ datum/preferences preview_icon.Blend(new /icon(icobase, "groin_[g]"), ICON_OVERLAY) preview_icon.Blend(new /icon(icobase, "head_[g]"), ICON_OVERLAY) - for(var/name in list("l_arm","r_arm","l_leg","r_leg","l_foot","r_foot","l_hand","r_hand")) - // make sure the organ is added to the list so it's drawn - if(organ_data[name] == null) - organ_data[name] = null - - for(var/name in organ_data) + for(var/name in list("r_arm","r_hand","r_leg","r_foot","l_leg","l_foot","l_arm","l_hand")) if(organ_data[name] == "amputated") continue var/icon/temp = new /icon(icobase, "[name]") @@ -216,7 +211,7 @@ datum/preferences if(current_species && (current_species.flags & HAS_TAIL)) var/icon/temp = new/icon("icon" = 'icons/effects/species.dmi', "icon_state" = "[current_species.tail]_s") preview_icon.Blend(temp, ICON_OVERLAY) - + // Skin color if(current_species && (current_species.flags & HAS_SKIN_COLOR)) preview_icon.Blend(rgb(r_skin, g_skin, b_skin), ICON_ADD) From 37e63dfcb08e9bf2473f1d78e03deab3e5b98ca1 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Sun, 22 Jun 2014 00:13:22 -0400 Subject: [PATCH 03/15] Fixes FEA temperature_expose() being used... ...instead of ZAS fire_act(). --- code/WorkInProgress/Susan/susan_desert_turfs.dm | 2 +- code/game/gamemodes/blob/theblob.dm | 2 +- code/game/gamemodes/events/biomass.dm | 2 +- code/game/gamemodes/events/spacevines.dm | 2 +- code/game/machinery/alarm.dm | 2 +- code/game/machinery/atmoalter/canister.dm | 2 +- code/game/machinery/doors/airlock.dm | 2 +- code/game/mecha/mecha.dm | 2 +- code/game/objects/effects/aliens.dm | 4 ++-- code/game/objects/effects/effect_system.dm | 2 +- code/game/objects/effects/glowshroom.dm | 2 +- code/game/objects/effects/spiders.dm | 2 +- code/game/objects/items/latexballoon.dm | 2 +- code/game/objects/items/stacks/sheets/leather.dm | 2 +- code/game/objects/structures/grille.dm | 2 +- code/game/objects/structures/mineral_doors.dm | 2 +- code/game/objects/structures/window.dm | 6 +++--- code/game/turfs/simulated/walls_mineral.dm | 2 +- code/modules/mob/living/carbon/alien/special/facehugger.dm | 2 +- code/modules/power/lighting.dm | 2 +- code/modules/reagents/reagent_dispenser.dm | 2 +- 21 files changed, 24 insertions(+), 24 deletions(-) diff --git a/code/WorkInProgress/Susan/susan_desert_turfs.dm b/code/WorkInProgress/Susan/susan_desert_turfs.dm index 947f6b67880..a52f90a4bc9 100644 --- a/code/WorkInProgress/Susan/susan_desert_turfs.dm +++ b/code/WorkInProgress/Susan/susan_desert_turfs.dm @@ -227,7 +227,7 @@ Alien plants should do something if theres a lot of poison del(src) -/obj/effect/alien/flesh/weeds/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) +/obj/effect/alien/flesh/weeds/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature > 300) health -= 5 healthcheck() diff --git a/code/game/gamemodes/blob/theblob.dm b/code/game/gamemodes/blob/theblob.dm index 4508c15ba07..51b321528ee 100644 --- a/code/game/gamemodes/blob/theblob.dm +++ b/code/game/gamemodes/blob/theblob.dm @@ -87,7 +87,7 @@ return 1 return 0 -/* temperature_expose(datum/gas_mixture/air, temperature, volume) Blob is currently fireproof +/* fire_act(datum/gas_mixture/air, temperature, volume) Blob is currently fireproof if(temperature > T0C+200) health -= 0.01 * temperature update() diff --git a/code/game/gamemodes/events/biomass.dm b/code/game/gamemodes/events/biomass.dm index d1508221f7c..3b48b971f01 100644 --- a/code/game/gamemodes/events/biomass.dm +++ b/code/game/gamemodes/events/biomass.dm @@ -154,7 +154,7 @@ return return -/obj/effect/biomass/temperature_expose(null, temp, volume) //hotspots kill biomass +/obj/effect/biomass/fire_act(null, temp, volume) //hotspots kill biomass del src diff --git a/code/game/gamemodes/events/spacevines.dm b/code/game/gamemodes/events/spacevines.dm index 3ff70acbdf4..b3af8195ca4 100644 --- a/code/game/gamemodes/events/spacevines.dm +++ b/code/game/gamemodes/events/spacevines.dm @@ -239,7 +239,7 @@ return return -/obj/effect/spacevine/temperature_expose(null, temp, volume) //hotspots kill vines +/obj/effect/spacevine/fire_act(null, temp, volume) //hotspots kill vines del src //Carn: Spacevines random event. diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm index c84f6b137a1..0c42cbbad6c 100644 --- a/code/game/machinery/alarm.dm +++ b/code/game/machinery/alarm.dm @@ -1338,7 +1338,7 @@ FIRE ALARM else icon_state = "fire0" -/obj/machinery/firealarm/temperature_expose(datum/gas_mixture/air, temperature, volume) +/obj/machinery/firealarm/fire_act(datum/gas_mixture/air, temperature, volume) if(src.detecting) if(temperature > T0C+200) src.alarm() // added check of detector status here diff --git a/code/game/machinery/atmoalter/canister.dm b/code/game/machinery/atmoalter/canister.dm index 107f67ee01e..16de2e497b5 100644 --- a/code/game/machinery/atmoalter/canister.dm +++ b/code/game/machinery/atmoalter/canister.dm @@ -110,7 +110,7 @@ update_flag overlays += "can-o3" return -/obj/machinery/portable_atmospherics/canister/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) +/obj/machinery/portable_atmospherics/canister/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature > temperature_resistance) health -= 5 healthcheck() diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 39b5ec9a538..5a2359ade8f 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -264,7 +264,7 @@ Airlock index -> wire color are { 9, 4, 6, 7, 5, 8, 1, 2, 3 }. icon = 'icons/obj/doors/Doorphoron.dmi' mineral = "phoron" -/obj/machinery/door/airlock/phoron/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) +/obj/machinery/door/airlock/phoron/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature > 300) PhoronBurn(exposed_temperature) diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 53bf77ce57e..e3465c3b7c3 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -618,7 +618,7 @@ check_for_internal_damage(list(MECHA_INT_FIRE,MECHA_INT_TEMP_CONTROL,MECHA_INT_CONTROL_LOST,MECHA_INT_SHORT_CIRCUIT),1) return -/obj/mecha/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) +/obj/mecha/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature>src.max_temperature) src.log_message("Exposed to dangerous temperature.",1) src.take_damage(5,"fire") diff --git a/code/game/objects/effects/aliens.dm b/code/game/objects/effects/aliens.dm index da510025e35..5e3ba542bfa 100644 --- a/code/game/objects/effects/aliens.dm +++ b/code/game/objects/effects/aliens.dm @@ -287,7 +287,7 @@ Alien plants should do something if theres a lot of poison del(src) -/obj/effect/alien/weeds/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) +/obj/effect/alien/weeds/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature > 300) health -= 5 healthcheck() @@ -469,7 +469,7 @@ Alien plants should do something if theres a lot of poison if(health <= 0) Burst() -/obj/effect/alien/egg/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) +/obj/effect/alien/egg/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature > 500) health -= 5 healthcheck() diff --git a/code/game/objects/effects/effect_system.dm b/code/game/objects/effects/effect_system.dm index 0eb8685aecd..dd5ee1f8b31 100644 --- a/code/game/objects/effects/effect_system.dm +++ b/code/game/objects/effects/effect_system.dm @@ -541,7 +541,7 @@ steam.start() -- spawns the effect // foam disolves when heated // except metal foams -/obj/effect/effect/foam/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) +/obj/effect/effect/foam/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(!metal && prob(max(0, exposed_temperature - 475))) flick("[icon_state]-disolve", src) diff --git a/code/game/objects/effects/glowshroom.dm b/code/game/objects/effects/glowshroom.dm index 425034ba485..39533b04831 100644 --- a/code/game/objects/effects/glowshroom.dm +++ b/code/game/objects/effects/glowshroom.dm @@ -154,7 +154,7 @@ else return -/obj/effect/glowshroom/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) +/obj/effect/glowshroom/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature > 300) endurance -= 5 CheckEndurance() diff --git a/code/game/objects/effects/spiders.dm b/code/game/objects/effects/spiders.dm index 522ff35af10..be54a95ba11 100644 --- a/code/game/objects/effects/spiders.dm +++ b/code/game/objects/effects/spiders.dm @@ -47,7 +47,7 @@ if(health <= 0) del(src) -/obj/effect/spider/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) +/obj/effect/spider/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature > 300) health -= 5 healthcheck() diff --git a/code/game/objects/items/latexballoon.dm b/code/game/objects/items/latexballoon.dm index 9b6895e0d9a..a923de6183f 100644 --- a/code/game/objects/items/latexballoon.dm +++ b/code/game/objects/items/latexballoon.dm @@ -38,7 +38,7 @@ /obj/item/latexballon/bullet_act() burst() -/obj/item/latexballon/temperature_expose(datum/gas_mixture/air, temperature, volume) +/obj/item/latexballon/fire_act(datum/gas_mixture/air, temperature, volume) if(temperature > T0C+100) burst() return diff --git a/code/game/objects/items/stacks/sheets/leather.dm b/code/game/objects/items/stacks/sheets/leather.dm index 8ba88796363..72339452e77 100644 --- a/code/game/objects/items/stacks/sheets/leather.dm +++ b/code/game/objects/items/stacks/sheets/leather.dm @@ -117,7 +117,7 @@ //Step two - washing..... it's actually in washing machine code. //Step three - drying -/obj/item/stack/sheet/wetleather/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) +/obj/item/stack/sheet/wetleather/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) ..() if(exposed_temperature >= drying_threshold_temperature) wetness-- diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index 97d7657d36d..bb50f1d63db 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -216,7 +216,7 @@ return 0 return 0 -/obj/structure/grille/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) +/obj/structure/grille/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(!destroyed) if(exposed_temperature > T0C + 1500) health -= 1 diff --git a/code/game/objects/structures/mineral_doors.dm b/code/game/objects/structures/mineral_doors.dm index 38f0563897d..c11a5a94e3f 100644 --- a/code/game/objects/structures/mineral_doors.dm +++ b/code/game/objects/structures/mineral_doors.dm @@ -198,7 +198,7 @@ TemperatureAct(100) ..() - temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) + fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature > 300) TemperatureAct(exposed_temperature) diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 8812b1ed4f5..2c9b755f563 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -361,7 +361,7 @@ return -/obj/structure/window/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) +/obj/structure/window/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature > T0C + 800) hit(round(exposed_volume / 100), 0) ..() @@ -381,7 +381,7 @@ shardtype = /obj/item/weapon/shard/phoron health = 120 -/obj/structure/window/phoronbasic/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) +/obj/structure/window/phoronbasic/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature > T0C + 32000) hit(round(exposed_volume / 1000), 0) ..() @@ -395,7 +395,7 @@ reinf = 1 health = 160 -/obj/structure/window/phoronreinforced/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) +/obj/structure/window/phoronreinforced/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) return /obj/structure/window/reinforced diff --git a/code/game/turfs/simulated/walls_mineral.dm b/code/game/turfs/simulated/walls_mineral.dm index 2d08a1dd65e..bd787d6ce21 100644 --- a/code/game/turfs/simulated/walls_mineral.dm +++ b/code/game/turfs/simulated/walls_mineral.dm @@ -111,7 +111,7 @@ for(var/obj/machinery/door/airlock/phoron/D in range(3,src)) D.ignite(temperature/4) -/turf/simulated/wall/mineral/phoron/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)//Doesn't fucking work because walls don't interact with air :( +/turf/simulated/wall/mineral/phoron/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)//Doesn't fucking work because walls don't interact with air :( if(exposed_temperature > 300) PhoronBurn(exposed_temperature) diff --git a/code/modules/mob/living/carbon/alien/special/facehugger.dm b/code/modules/mob/living/carbon/alien/special/facehugger.dm index f1561344386..4edcbd3dc7a 100644 --- a/code/modules/mob/living/carbon/alien/special/facehugger.dm +++ b/code/modules/mob/living/carbon/alien/special/facehugger.dm @@ -72,7 +72,7 @@ var/const/MAX_ACTIVE_TIME = 400 Die() return -/obj/item/clothing/mask/facehugger/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) +/obj/item/clothing/mask/facehugger/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature > 300) Die() return diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index 928c56b10cf..5419ab78b1a 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -618,7 +618,7 @@ // called when on fire -/obj/machinery/light/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) +/obj/machinery/light/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(prob(max(0, exposed_temperature - 673))) //0% at <400C, 100% at >500C broken() diff --git a/code/modules/reagents/reagent_dispenser.dm b/code/modules/reagents/reagent_dispenser.dm index fc738957acf..fd5821784ee 100644 --- a/code/modules/reagents/reagent_dispenser.dm +++ b/code/modules/reagents/reagent_dispenser.dm @@ -166,7 +166,7 @@ if(src) del(src) -/obj/structure/reagent_dispensers/fueltank/temperature_expose(datum/gas_mixture/air, temperature, volume) +/obj/structure/reagent_dispensers/fueltank/fire_act(datum/gas_mixture/air, temperature, volume) if(temperature > T0C+500) explode() return ..() From 86db41a5823a66701a76a4b23f36b7b870c5ce2b Mon Sep 17 00:00:00 2001 From: Chinsky Date: Sun, 22 Jun 2014 14:30:50 +0400 Subject: [PATCH 04/15] Merge branch 'master' of https://github.com/Baystation12/Baystation12 Merge branch 'master' of https://github.com/Baystation12/Baystation12 Optimizes crew console scanning to only look for mobs instead of ALL clothing items in the world. --- code/game/machinery/computer/crew.dm | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/code/game/machinery/computer/crew.dm b/code/game/machinery/computer/crew.dm index 49d12a48478..563f621ca41 100644 --- a/code/game/machinery/computer/crew.dm +++ b/code/game/machinery/computer/crew.dm @@ -107,13 +107,9 @@ /obj/machinery/computer/crew/proc/scan() - for(var/obj/item/clothing/under/C in world) - if((C.has_sensor) && (istype(C.loc, /mob/living/carbon/human))) - var/check = 0 - for(var/O in src.tracked) - if(O == C) - check = 1 - break - if(!check) - src.tracked.Add(C) + for(var/mob/living/carbon/human/H in mob_list) + if(istype(H.w_uniform, /obj/item/clothing/under)) + var/obj/item/clothing/under/C = H.w_uniform + if (C.has_sensor) + tracked |= C return 1 \ No newline at end of file From 191e21ead6b3a656d456020c9fd38bad915ea259 Mon Sep 17 00:00:00 2001 From: Mloc-Argent Date: Sun, 22 Jun 2014 15:25:23 +0100 Subject: [PATCH 05/15] atmos: fix everlasting fires Fires were checking against a non-reduced air sample for existance, so the reduced sample wasn't working in zburn when it failed the check. Also fixed volatilefuel not being scaled in the phoron reagent. Signed-off-by: Mloc-Argent --- code/ZAS/Fire.dm | 20 ++++++-------------- code/modules/reagents/Chemistry-Reagents.dm | 4 ++-- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/code/ZAS/Fire.dm b/code/ZAS/Fire.dm index 8b692c5b138..d4660e5a0e9 100644 --- a/code/ZAS/Fire.dm +++ b/code/ZAS/Fire.dm @@ -84,7 +84,7 @@ turf/simulated/hotspot_expose(exposed_temperature, exposed_volume, soh) air_contents.trace_gases.Remove(fuel) //check if there is something to combust - if(!air_contents.check_recombustability(liquid)) + if(!air_contents.check_combustability(liquid)) //del src RemoveFire() @@ -116,7 +116,7 @@ turf/simulated/hotspot_expose(exposed_temperature, exposed_volume, soh) var/datum/gas_mixture/acs = enemy_tile.return_air() var/obj/effect/decal/cleanable/liquid_fuel/liq = locate() in enemy_tile if(!acs) continue - if(!acs.check_recombustability(liq)) continue + if(!acs.check_combustability(liq)) continue //If extinguisher mist passed over the turf it's trying to spread to, don't spread and //reduce firelevel. if(enemy_tile.fire_protection > world.time-30) @@ -134,16 +134,8 @@ turf/simulated/hotspot_expose(exposed_temperature, exposed_volume, soh) ///////////////////////////////// FLOW HAS BEEN CREATED /// DONT DELETE THE FIRE UNTIL IT IS MERGED BACK OR YOU WILL DELETE AIR /////////////////////////////////////////////// if(flow) - - if(flow.check_recombustability(liquid)) - //Ensure flow temperature is higher than minimum fire temperatures. - //this creates some energy ex nihilo but is necessary to get a fire started - //lets just pretend this energy comes from the ignition source and dont mention this again - //flow.temperature = max(PHORON_MINIMUM_BURN_TEMPERATURE+0.1,flow.temperature) - - //burn baby burn! - - flow.zburn(liquid,1) + //burn baby burn! + flow.zburn(liquid,1) //merge the air back S.assume_air(flow) @@ -275,9 +267,9 @@ datum/gas_mixture/proc/check_combustability(obj/effect/decal/cleanable/liquid_fu if(oxygen && (phoron || fuel || liquid)) if(liquid) return 1 - if (phoron >= 0.1) + if(QUANTIZE(phoron * vsc.fire_consuption_rate) >= 0.1) return 1 - if(fuel && fuel.moles >= 0.1) + if(fuel && QUANTIZE(fuel.moles * vsc.fire_consuption_rate) >= 0.1) return 1 return 0 diff --git a/code/modules/reagents/Chemistry-Reagents.dm b/code/modules/reagents/Chemistry-Reagents.dm index fc2f420c0e6..46aafda18b2 100644 --- a/code/modules/reagents/Chemistry-Reagents.dm +++ b/code/modules/reagents/Chemistry-Reagents.dm @@ -1581,14 +1581,14 @@ datum var/turf/the_turf = get_turf(O) var/datum/gas_mixture/napalm = new var/datum/gas/volatile_fuel/fuel = new - fuel.moles = 5 + fuel.moles = volume napalm.trace_gases += fuel the_turf.assume_air(napalm) reaction_turf(var/turf/T, var/volume) src = null var/datum/gas_mixture/napalm = new var/datum/gas/volatile_fuel/fuel = new - fuel.moles = 5 + fuel.moles = volume napalm.trace_gases += fuel T.assume_air(napalm) return From 1c91b2984d1e675732ac45175f4c41857a503bb2 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Sun, 22 Jun 2014 14:18:52 -0400 Subject: [PATCH 06/15] Supply controller now holds a ref to it's shuttle Instead of having to look it up every time. --- code/game/machinery/status_display.dm | 4 +- code/game/objects/items/devices/PDA/cart.dm | 2 +- code/game/supplyshuttle.dm | 55 ++++++++++----------- code/modules/shuttles/shuttle.dm | 10 ---- code/modules/shuttles/shuttle_supply.dm | 3 ++ 5 files changed, 31 insertions(+), 43 deletions(-) diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm index 404c2d54ca4..ad0494ff31b 100644 --- a/code/game/machinery/status_display.dm +++ b/code/game/machinery/status_display.dm @@ -112,7 +112,7 @@ var/line1 = "SUPPLY" var/line2 = "" - var/datum/shuttle/ferry/supply/shuttle = supply_controller.get_shuttle() + var/datum/shuttle/ferry/supply/shuttle = supply_controller.shuttle if (!shuttle) line2 = "Error" else if(shuttle.has_eta()) @@ -171,7 +171,7 @@ return "" proc/get_supply_shuttle_timer() - var/datum/shuttle/ferry/supply/shuttle = supply_controller.get_shuttle() + var/datum/shuttle/ferry/supply/shuttle = supply_controller.shuttle if (!shuttle) return "Error" diff --git a/code/game/objects/items/devices/PDA/cart.dm b/code/game/objects/items/devices/PDA/cart.dm index 0f041ef5c9f..9262c943bfb 100644 --- a/code/game/objects/items/devices/PDA/cart.dm +++ b/code/game/objects/items/devices/PDA/cart.dm @@ -411,7 +411,7 @@ if(mode==47) var/supplyData[0] - var/datum/shuttle/ferry/supply/shuttle = supply_controller.get_shuttle() + var/datum/shuttle/ferry/supply/shuttle = supply_controller.shuttle if (shuttle) supplyData["shuttle_moving"] = shuttle.has_eta() supplyData["shuttle_eta"] = shuttle.eta_minutes() diff --git a/code/game/supplyshuttle.dm b/code/game/supplyshuttle.dm index aa4ecd007d5..e6836352ad7 100644 --- a/code/game/supplyshuttle.dm +++ b/code/game/supplyshuttle.dm @@ -143,22 +143,24 @@ var/list/mechtoys = list( var/list/supply_packs = list() //shuttle movement var/movetime = 1200 - var/shuttle_tag = "Supply" + var/datum/shuttle/ferry/supply/shuttle New() ordernum = rand(1,9000) + if (shuttle_tag in shuttles && istype(shuttles[shuttle_tag], /datum/shuttle/ferry/supply)) + shuttle = shuttles["Supply"] + + //still don't have the shuttle, so create one + if (!shuttle) + shuttle = new/datum/shuttle/ferry/supply() + shuttle.location = 1 + shuttle.warmup_time = 10 + shuttle.area_offsite = locate(/area/supply/dock) + shuttle.area_station = locate(/area/supply/station) + shuttle.docking_controller_tag = "supply_shuttle" + shuttle.dock_target_station = "cargo_bay" + shuttles["Supply"] = shuttle - proc/get_shuttle() - if (!shuttles || !(shuttle_tag in shuttles)) - return null - - var/datum/shuttle/ferry/supply/shuttle = shuttles[shuttle_tag] - - if (!istype(shuttle)) - return null - - return shuttle - //Supply shuttle ticker - handles supply point regenertion and shuttle travelling between centcomm and the station proc/process() for(var/typepath in (typesof(/datum/supply_packs) - /datum/supply_packs)) @@ -178,8 +180,7 @@ var/list/mechtoys = list( set background = 1 while(1) if(processing) - var/datum/shuttle/ferry/supply/shuttle = get_shuttle() - if (shuttle && shuttle.in_use) + if (shuttle.in_use) shuttle.process_shuttle() sleep(10) @@ -202,21 +203,18 @@ var/list/mechtoys = list( //Sellin proc/sell() - var/datum/shuttle/ferry/supply/shuttle_datum = get_shuttle() - if (!shuttle_datum) return - - var/area/shuttle = shuttle_datum.get_location_area() - if(!shuttle) return + var/area/area_shuttle = shuttle.get_location_area() + if(!area_shuttle) return var/phoron_count = 0 var/plat_count = 0 - for(var/atom/movable/MA in shuttle) + for(var/atom/movable/MA in area_shuttle) if(MA.anchored) continue // Must be in a crate! if(istype(MA,/obj/structure/closet/crate)) - callHook("sell_crate", list(MA, shuttle)) + callHook("sell_crate", list(MA, area_shuttle)) points += points_per_crate var/find_slip = 1 @@ -253,15 +251,12 @@ var/list/mechtoys = list( proc/buy() if(!shoppinglist.len) return - var/datum/shuttle/ferry/supply/shuttle_datum = get_shuttle() - if (!shuttle_datum) return - - var/area/shuttle = shuttle_datum.get_location_area() - if(!shuttle) return + var/area/area_shuttle = shuttle.get_location_area() + if(!area_shuttle) return var/list/clear_turfs = list() - for(var/turf/T in shuttle) + for(var/turf/T in area_shuttle) if(T.density || T.contents.len) continue clear_turfs += T @@ -339,7 +334,7 @@ var/list/mechtoys = list( if(temp) dat = temp else - var/datum/shuttle/ferry/supply/shuttle = supply_controller.get_shuttle() + var/datum/shuttle/ferry/supply/shuttle = supply_controller.shuttle if (shuttle) dat += {"
Supply shuttle
Location: [shuttle.has_eta() ? "Moving to station ([shuttle.eta_minutes()] Mins.)":shuttle.at_station() ? "Docked":"Away"]
@@ -466,7 +461,7 @@ var/list/mechtoys = list( if (temp) dat = temp else - var/datum/shuttle/ferry/supply/shuttle = supply_controller.get_shuttle() + var/datum/shuttle/ferry/supply/shuttle = supply_controller.shuttle if (shuttle) dat += "
Supply shuttle
" dat += "\nLocation: " @@ -525,7 +520,7 @@ var/list/mechtoys = list( if(!supply_controller) world.log << "## ERROR: Eek. The supply_controller controller datum is missing somehow." return - var/datum/shuttle/ferry/supply/shuttle = supply_controller.get_shuttle() + var/datum/shuttle/ferry/supply/shuttle = supply_controller.shuttle if (!shuttle) world.log << "## ERROR: Eek. The supply/shuttle datum is missing somehow." return diff --git a/code/modules/shuttles/shuttle.dm b/code/modules/shuttles/shuttle.dm index 471c4a77d39..274597ef4cf 100644 --- a/code/modules/shuttles/shuttle.dm +++ b/code/modules/shuttles/shuttle.dm @@ -125,16 +125,6 @@ var/global/list/shuttles var/datum/shuttle/ferry/shuttle - //Supply and escape shuttles. - shuttle = new/datum/shuttle/ferry/supply() - shuttle.location = 1 - shuttle.warmup_time = 10 - shuttle.area_offsite = locate(/area/supply/dock) - shuttle.area_station = locate(/area/supply/station) - shuttle.docking_controller_tag = "supply_shuttle" - shuttle.dock_target_station = "cargo_bay" - shuttles["Supply"] = shuttle - // Admin shuttles. shuttle = new() shuttle.location = 1 diff --git a/code/modules/shuttles/shuttle_supply.dm b/code/modules/shuttles/shuttle_supply.dm index f75193ea032..3d878bcb60a 100644 --- a/code/modules/shuttles/shuttle_supply.dm +++ b/code/modules/shuttles/shuttle_supply.dm @@ -58,6 +58,9 @@ if (!at_station()) //at centcom supply_controller.sell() +/datum/shuttle/ferry/emergency/long_jump(var/area/departing,var/area/destination,var/area/interim,var/travel_time) + short_jump(departing, destination) //long jumps are disabled + // returns 1 if the supply shuttle should be prevented from moving because it contains forbidden atoms /datum/shuttle/ferry/supply/proc/forbidden_atoms_check() if (!at_station()) From dc304026a92c7716be9f888fe61cea4f8db3a8fc Mon Sep 17 00:00:00 2001 From: mwerezak Date: Sun, 22 Jun 2014 18:10:56 -0400 Subject: [PATCH 07/15] shuttle_controller now uses a shuttle datum --- baystation12.dme | 1 + code/controllers/shuttle_controller.dm | 552 +++++------------- code/game/gamemodes/game_mode.dm | 2 +- code/game/gamemodes/gameticker.dm | 4 +- .../game/gamemodes/malfunction/malfunction.dm | 6 +- code/game/gamemodes/newobjective.dm | 12 +- code/game/gamemodes/nuclear/nuclear.dm | 2 +- code/game/gamemodes/objective.dm | 10 +- code/game/gamemodes/revolution/revolution.dm | 4 +- code/game/gamemodes/sandbox/sandbox.dm | 2 +- .../game/machinery/computer/communications.dm | 57 +- code/game/machinery/computer/shuttle.dm | 11 +- code/game/machinery/status_display.dm | 30 +- code/modules/admin/player_panel.dm | 10 +- code/modules/admin/topic.dm | 41 +- code/modules/admin/verbs/randomverbs.dm | 45 +- code/modules/admin/verbs/striketeam.dm | 2 +- .../admin/verbs/striketeam_syndicate.dm | 4 +- code/modules/mob/dead/observer/observer.dm | 4 +- code/modules/mob/living/carbon/alien/alien.dm | 4 +- code/modules/mob/living/carbon/human/human.dm | 4 +- code/modules/mob/living/silicon/ai/ai.dm | 2 +- code/modules/mob/living/silicon/ai/death.dm | 4 +- code/modules/mob/living/silicon/silicon.dm | 9 +- .../modules/mob/living/simple_animal/borer.dm | 4 +- code/modules/mob/new_player/new_player.dm | 11 +- code/modules/power/singularity/singularity.dm | 5 +- code/modules/shuttles/shuttle_console.dm | 77 ++- code/modules/shuttles/shuttle_emergency.dm | 69 +++ code/unused/hivebot/hivebot.dm | 9 +- code/unused/hivebot/mainframe.dm | 9 +- 31 files changed, 430 insertions(+), 576 deletions(-) create mode 100644 code/modules/shuttles/shuttle_emergency.dm diff --git a/baystation12.dme b/baystation12.dme index 43733732a07..2724174e374 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -1292,6 +1292,7 @@ #include "code\modules\shuttles\departmental.dm" #include "code\modules\shuttles\shuttle.dm" #include "code\modules\shuttles\shuttle_console.dm" +#include "code\modules\shuttles\shuttle_emergency.dm" #include "code\modules\shuttles\shuttle_specops.dm" #include "code\modules\shuttles\shuttle_supply.dm" #include "code\modules\shuttles\shuttles_multi.dm" diff --git a/code/controllers/shuttle_controller.dm b/code/controllers/shuttle_controller.dm index 8cdd12732d6..7ff76877102 100644 --- a/code/controllers/shuttle_controller.dm +++ b/code/controllers/shuttle_controller.dm @@ -5,429 +5,185 @@ // these define the time taken for the shuttle to get to SS13 // and the time before it leaves again -#define SHUTTLEARRIVETIME 600 // 10 minutes = 600 seconds -#define SHUTTLELEAVETIME 180 // 3 minutes = 180 seconds -#define SHUTTLETRANSITTIME 120 // 2 minutes = 120 seconds +#define SHUTTLE_PREPTIME 300 // 5 minutes = 300 seconds - after this time, the shuttle cannot be recalled +#define SHUTTLE_LEAVETIME 180 // 3 minutes = 180 seconds - the duration for which the shuttle will wait at the station +#define SHUTTLE_TRANSIT_DURATION 300 // 5 minutes = 300 seconds - how long it takes for the shuttle to get to the station +#define SHUTTLE_TRANSIT_DURATION_RETURN 120 // 2 minutes = 120 seconds - for some reason it takes less time to come back, go figure. var/global/datum/shuttle_controller/emergency_shuttle/emergency_shuttle -datum/shuttle_controller/emergency_shuttle - var/alert = 0 //0 = emergency, 1 = crew cycle +/datum/shuttle_controller/emergency_shuttle + var/datum/shuttle/ferry/shuttle + + var/launch_time //the time at which the shuttle will be launched + var/auto_recall = 0 //if set, the shuttle will be auto-recalled + var/auto_recall_time //the time at which the shuttle will be auto-recalled + var/evac = 0 //1 = emergency evacuation, 0 = crew transfer + var/wait_for_launch = 0 //if the shuttle is waiting to launch + + var/deny_shuttle = 0 //allows admins to prevent the shuttle from being called + var/departed = 0 //if the shuttle has left the station at least once - var/location = 0 //0 = somewhere far away (in spess), 1 = at SS13, 2 = returned from SS13 - var/online = 0 - var/direction = 1 //-1 = going back to central command, 1 = going to SS13, 2 = in transit to centcom (not recalled) +/datum/shuttle_controller/emergency_shuttle/New() + if ("Escape" in shuttles && istype(shuttles["Escape"], /datum/shuttle/ferry/emergency)) + shuttle = shuttles["Escape"] + + //still don't have the shuttle, so create one + if (!shuttle) + shuttle = new/datum/shuttle/ferry/emergency() + shuttle.location = 1 + shuttle.warmup_time = 10 + shuttle.area_offsite = locate(/area/shuttle/escape/centcom) + shuttle.area_station = locate(/area/shuttle/escape/station) + shuttle.area_transition = locate(/area/shuttle/escape/transit) + shuttle.travel_time = SHUTTLE_TRANSIT_DURATION + //shuttle.docking_controller_tag = "supply_shuttle" + //shuttle.dock_target_station = "cargo_bay" + shuttles["Escape"] = shuttle - var/endtime // timeofday that shuttle arrives - var/timelimit //important when the shuttle gets called for more than shuttlearrivetime - //timeleft = 360 //600 - var/fake_recall = 0 //Used in rounds to prevent "ON NOES, IT MUST [INSERT ROUND] BECAUSE SHUTTLE CAN'T BE CALLED" - - var/always_fake_recall = 0 - var/deny_shuttle = 0 //for admins not allowing it to be called. - var/departed = 0 - // call the shuttle - // if not called before, set the endtime to T+600 seconds - // otherwise if outgoing, switch to incoming - proc/incall(coeff = 1) - if(deny_shuttle && alert == 1) //crew transfer shuttle does not gets recalled by gamemode - return - if(endtime) - if(direction == -1) - setdirection(1) - else - settimeleft(get_shuttle_arrive_time()*coeff) - online = 1 - if(always_fake_recall) - fake_recall = rand(300,500) //turning on the red lights in hallways - if(alert == 0) - for(var/area/A in world) - if(istype(A, /area/hallway)) - A.readyalert() - - proc/get_shuttle_arrive_time() - // During mutiny rounds, the shuttle takes twice as long. - if(ticker && istype(ticker.mode,/datum/game_mode/mutiny)) - return SHUTTLEARRIVETIME * 2 - - return SHUTTLEARRIVETIME - -datum/shuttle_controller/emergency_shuttle/proc/shuttlealert(var/X) - alert = X - -datum/shuttle_controller/emergency_shuttle/proc/recall() - if(direction == 1) - var/timeleft = timeleft() - if(alert == 0) - if(timeleft >= get_shuttle_arrive_time()) - return - captain_announce("The emergency shuttle has been recalled.") - world << sound('sound/AI/shuttlerecalled.ogg') - setdirection(-1) - online = 1 - for(var/area/A in world) - if(istype(A, /area/hallway)) - A.readyreset() - return - else //makes it possible to send shuttle back. - captain_announce("The shuttle has been recalled.") - setdirection(-1) - online = 1 - alert = 0 // set alert back to 0 after an admin recall - return - - // returns the time (in seconds) before shuttle arrival - // note if direction = -1, gives a count-up to SHUTTLEARRIVETIME -datum/shuttle_controller/emergency_shuttle/proc/timeleft() - if(online) - var/timeleft = round((endtime - world.timeofday)/10 ,1) - if(direction == 1 || direction == 2) - return timeleft - else - return get_shuttle_arrive_time()-timeleft - else - return get_shuttle_arrive_time() - - // sets the time left to a given delay (in seconds) -datum/shuttle_controller/emergency_shuttle/proc/settimeleft(var/delay) - endtime = world.timeofday + delay * 10 - timelimit = delay - - // sets the shuttle direction - // 1 = towards SS13, -1 = back to centcom -datum/shuttle_controller/emergency_shuttle/proc/setdirection(var/dirn) - if(direction == dirn) - return - direction = dirn - // if changing direction, flip the timeleft by SHUTTLEARRIVETIME - var/ticksleft = endtime - world.timeofday - endtime = world.timeofday + (get_shuttle_arrive_time()*10 - ticksleft) - return - -datum/shuttle_controller/emergency_shuttle/proc/process() - -datum/shuttle_controller/emergency_shuttle/process() - if(!online) - return - var/timeleft = timeleft() - if(timeleft > 1e5) // midnight rollover protection - timeleft = 0 - switch(location) - if(0) - - /* --- Shuttle is in transit to Central Command from SS13 --- */ - if(direction == 2) - if(timeleft>0) - return 0 - - /* --- Shuttle has arrived at Centrcal Command --- */ - else - // turn off the star spawners - /* - for(var/obj/effect/starspawner/S in world) - S.spawning = 0 - */ - - location = 2 - - //main shuttle - var/area/start_location = locate(/area/shuttle/escape/transit) - var/area/end_location = locate(/area/shuttle/escape/centcom) - - start_location.move_contents_to(end_location, null, NORTH) - - for(var/obj/machinery/door/unpowered/shuttle/D in end_location) - spawn(0) - D.locked = 0 - D.open() - - for(var/mob/M in end_location) - if(M.client) - spawn(0) - if(M.buckled) - shake_camera(M, 4, 1) // buckled, not a lot of shaking - else - shake_camera(M, 10, 2) // unbuckled, HOLY SHIT SHAKE THE ROOM - if(istype(M, /mob/living/carbon)) - if(!M.buckled) - M.Weaken(5) - - //pods - start_location = locate(/area/shuttle/escape_pod1/transit) - end_location = locate(/area/shuttle/escape_pod1/centcom) - start_location.move_contents_to(end_location, null, NORTH) - - for(var/obj/machinery/door/D in machines) - if( get_area(D) == end_location ) - spawn(0) - D.open() - - for(var/mob/M in end_location) - if(M.client) - spawn(0) - if(M.buckled) - shake_camera(M, 4, 1) // buckled, not a lot of shaking - else - shake_camera(M, 10, 2) // unbuckled, HOLY SHIT SHAKE THE ROOM - if(istype(M, /mob/living/carbon)) - if(!M.buckled) - M.Weaken(5) - - start_location = locate(/area/shuttle/escape_pod2/transit) - end_location = locate(/area/shuttle/escape_pod2/centcom) - start_location.move_contents_to(end_location, null, NORTH) - - for(var/obj/machinery/door/D in machines) - if( get_area(D) == end_location ) - spawn(0) - D.open() - - for(var/mob/M in end_location) - if(M.client) - spawn(0) - if(M.buckled) - shake_camera(M, 4, 1) // buckled, not a lot of shaking - else - shake_camera(M, 10, 2) // unbuckled, HOLY SHIT SHAKE THE ROOM - if(istype(M, /mob/living/carbon)) - if(!M.buckled) - M.Weaken(5) - - start_location = locate(/area/shuttle/escape_pod3/transit) - end_location = locate(/area/shuttle/escape_pod3/centcom) - start_location.move_contents_to(end_location, null, NORTH) - - for(var/obj/machinery/door/D in machines) - if( get_area(D) == end_location ) - spawn(0) - D.open() - - for(var/mob/M in end_location) - if(M.client) - spawn(0) - if(M.buckled) - shake_camera(M, 4, 1) // buckled, not a lot of shaking - else - shake_camera(M, 10, 2) // unbuckled, HOLY SHIT SHAKE THE ROOM - if(istype(M, /mob/living/carbon)) - if(!M.buckled) - M.Weaken(5) - - start_location = locate(/area/shuttle/escape_pod5/transit) - end_location = locate(/area/shuttle/escape_pod5/centcom) - start_location.move_contents_to(end_location, null, EAST) - - for(var/obj/machinery/door/D in machines) - if( get_area(D) == end_location ) - spawn(0) - D.open() - - for(var/mob/M in end_location) - if(M.client) - spawn(0) - if(M.buckled) - shake_camera(M, 4, 1) // buckled, not a lot of shaking - else - shake_camera(M, 10, 2) // unbuckled, HOLY SHIT SHAKE THE ROOM - if(istype(M, /mob/living/carbon)) - if(!M.buckled) - M.Weaken(5) - - online = 0 - - return 1 - - /* --- Shuttle has docked centcom after being recalled --- */ - if(timeleft>timelimit) - online = 0 - direction = 1 - endtime = null - - return 0 - - else if((fake_recall != 0) && (timeleft <= fake_recall)) - recall() - fake_recall = 0 - return 0 - - /* --- Shuttle has docked with the station - begin countdown to transit --- */ - else if(timeleft <= 0) - location = 1 - var/area/start_location = locate(/area/shuttle/escape/centcom) - var/area/end_location = locate(/area/shuttle/escape/station) - - var/list/dstturfs = list() - var/throwy = world.maxy - - for(var/turf/T in end_location) - dstturfs += T - if(T.y < throwy) - throwy = T.y - - // hey you, get out of the way! - for(var/turf/T in dstturfs) - // find the turf to move things to - var/turf/D = locate(T.x, throwy - 1, 1) - //var/turf/E = get_step(D, SOUTH) - for(var/atom/movable/AM as mob|obj in T) - AM.Move(D) - // NOTE: Commenting this out to avoid recreating mass driver glitch - /* - spawn(0) - AM.throw_at(E, 1, 1) - return - */ - - if(istype(T, /turf/simulated)) - del(T) - - for(var/mob/living/carbon/bug in end_location) // If someone somehow is still in the shuttle's docking area... - bug.gib() - - for(var/mob/living/simple_animal/pest in end_location) // And for the other kind of bug... - pest.gib() - - start_location.move_contents_to(end_location) - settimeleft(SHUTTLELEAVETIME) - //send2irc("Server", "The Emergency Shuttle has docked with the station.") - captain_announce("The Emergency Shuttle has docked with the station. You have [round(timeleft()/60,1)] minutes to board the Emergency Shuttle.") - world << sound('sound/AI/shuttledock.ogg') - - return 1 - - if(1) - - // Just before it leaves, close the damn doors! - if(timeleft == 2 || timeleft == 1) - var/area/start_location = locate(/area/shuttle/escape/station) - for(var/obj/machinery/door/unpowered/shuttle/D in start_location) - spawn(0) - D.close() - D.locked = 1 - - if(timeleft>0) - return 0 - - /* --- Shuttle leaves the station, enters transit --- */ +/datum/shuttle_controller/emergency_shuttle/proc/process() + if (wait_for_launch) + if (auto_recall && can_recall() && world.time >= auto_recall_time) + recall() + if (world.time >= launch_time) //time to launch the shuttle + + //set the travel time + if (!shuttle.location) //at station + shuttle.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN + departed = 1 //technically we haven't left yet, but this should be good enough + //TODO launch pods else + shuttle.travel_time = SHUTTLE_TRANSIT_DURATION + + shuttle.launch(src) - // Turn on the star effects +//called when the shuttle has arrived. +/datum/shuttle_controller/emergency_shuttle/proc/shuttle_arrived() + if (!shuttle.location) //at station + launch_time = world.time + SHUTTLE_LEAVETIME + wait_for_launch = 1 //get ready to return - /* // kinda buggy atm, i'll fix this later - for(var/obj/effect/starspawner/S in world) - if(!S.spawning) - spawn() S.startspawn() - */ +//returns the time left until the shuttle arrives at it's destination, in ticks +/datum/shuttle_controller/emergency_shuttle/proc/estimate_arrival_time() + var/eta = launch_time + shuttle.travel_time + return (eta - world.time) - departed = 1 // It's going! - location = 0 // in deep space - direction = 2 // heading to centcom +//returns the time left until the shuttle launches, in ticks +/datum/shuttle_controller/emergency_shuttle/proc/estimate_launch_time() + return (launch_time - world.time) - //main shuttle - var/area/start_location = locate(/area/shuttle/escape/station) - var/area/end_location = locate(/area/shuttle/escape/transit) +/datum/shuttle_controller/emergency_shuttle/proc/has_eta() + return (wait_for_launch || shuttle.moving_status != SHUTTLE_IDLE) - settimeleft(SHUTTLETRANSITTIME) - start_location.move_contents_to(end_location, null, NORTH) +//returns 1 if the shuttle has gone to the station and come back at least once, +//used for game completion checking purposes +/datum/shuttle_controller/emergency_shuttle/proc/returned() + return 0 //TODO - // Close shuttle doors, lock - for(var/obj/machinery/door/unpowered/shuttle/D in end_location) - spawn(0) - D.close() - D.locked = 1 +//returns 1 if the shuttle is not idle at centcom +/datum/shuttle_controller/emergency_shuttle/proc/online() + if (!shuttle.location) //not at centcom + return 1 + if (wait_for_launch || shuttle.moving_status != SHUTTLE_IDLE) + return 1 + return 0 - // Some aesthetic turbulance shaking - for(var/mob/M in end_location) - if(M.client) - spawn(0) - if(M.buckled) - shake_camera(M, 4, 1) // buckled, not a lot of shaking - else - shake_camera(M, 10, 2) // unbuckled, HOLY SHIT SHAKE THE ROOM - if(istype(M, /mob/living/carbon)) - if(!M.buckled) - M.Weaken(5) +//returns 1 if the shuttle is currently in transit (or just leaving) to the station +/datum/shuttle_controller/emergency_shuttle/proc/going_to_station() + return (!shuttle.direction && shuttle.moving_status != SHUTTLE_IDLE) - //pods - start_location = locate(/area/shuttle/escape_pod1/station) - end_location = locate(/area/shuttle/escape_pod1/transit) - start_location.move_contents_to(end_location, null, NORTH) - for(var/obj/machinery/door/D in end_location) - spawn(0) - D.close() +//returns 1 if the shuttle is currently in transit (or just leaving) to centcom +/datum/shuttle_controller/emergency_shuttle/proc/going_to_centcom() + return (shuttle.direction && shuttle.moving_status != SHUTTLE_IDLE) - for(var/mob/M in end_location) - if(M.client) - spawn(0) - if(M.buckled) - shake_camera(M, 4, 1) // buckled, not a lot of shaking - else - shake_camera(M, 10, 2) // unbuckled, HOLY SHIT SHAKE THE ROOM - if(istype(M, /mob/living/carbon)) - if(!M.buckled) - M.Weaken(5) +//returns 1 if the shuttle is docked at the station and waiting to leave +/datum/shuttle_controller/emergency_shuttle/proc/waiting_to_leave() + if (shuttle.location) + return 0 //not at station + if (!wait_for_launch) + return 0 //not going anywhere + if (shuttle.moving_status != SHUTTLE_IDLE) + return 0 //shuttle is doing stuff + return 1 - start_location = locate(/area/shuttle/escape_pod2/station) - end_location = locate(/area/shuttle/escape_pod2/transit) - start_location.move_contents_to(end_location, null, NORTH) - for(var/obj/machinery/door/D in end_location) - spawn(0) - D.close() +//so we don't have emergency_shuttle.shuttle.location everywhere +/datum/shuttle_controller/emergency_shuttle/proc/location() + if (!shuttle) + return 1 //if we dont have a shuttle datum, just act like it's at centcom + return shuttle.location - for(var/mob/M in end_location) - if(M.client) - spawn(0) - if(M.buckled) - shake_camera(M, 4, 1) // buckled, not a lot of shaking - else - shake_camera(M, 10, 2) // unbuckled, HOLY SHIT SHAKE THE ROOM - if(istype(M, /mob/living/carbon)) - if(!M.buckled) - M.Weaken(5) +//calls the shuttle for an emergency evacuation +/datum/shuttle_controller/emergency_shuttle/proc/call_evac() + if(!can_call()) return + + //set the launch timer + launch_time = world.time + get_shuttle_prep_time() + auto_recall_time = world.time + rand(300,500) + wait_for_launch = 1 + + evac = 1 + captain_announce("An emergency evacuation shuttle has been called. It will arrive in approximately [round(estimate_arrival_time()/60)] minutes.") + world << sound('sound/AI/shuttlecalled.ogg') + for(var/area/A in world) + if(istype(A, /area/hallway)) + A.readyalert() - start_location = locate(/area/shuttle/escape_pod3/station) - end_location = locate(/area/shuttle/escape_pod3/transit) - start_location.move_contents_to(end_location, null, NORTH) - for(var/obj/machinery/door/D in end_location) - spawn(0) - D.close() +//calls the shuttle for a routine crew transfer +/datum/shuttle_controller/emergency_shuttle/proc/call_transfer() + if(!can_call()) return - for(var/mob/M in end_location) - if(M.client) - spawn(0) - if(M.buckled) - shake_camera(M, 4, 1) // buckled, not a lot of shaking - else - shake_camera(M, 10, 2) // unbuckled, HOLY SHIT SHAKE THE ROOM - if(istype(M, /mob/living/carbon)) - if(!M.buckled) - M.Weaken(5) + //set the launch timer + launch_time = world.time + get_shuttle_prep_time() + auto_recall_time = world.time + rand(100,SHUTTLE_PREPTIME-30) + wait_for_launch = 1 + + captain_announce("A crew transfer has been initiated. The shuttle has been called. It will arrive in [round(estimate_arrival_time()/60)] minutes.") - start_location = locate(/area/shuttle/escape_pod5/station) - end_location = locate(/area/shuttle/escape_pod5/transit) - start_location.move_contents_to(end_location, null, EAST) - for(var/obj/machinery/door/D in end_location) - spawn(0) - D.close() +//recalls the shuttle +/datum/shuttle_controller/emergency_shuttle/proc/recall() + if (!can_recall()) return - for(var/mob/M in end_location) - if(M.client) - spawn(0) - if(M.buckled) - shake_camera(M, 4, 1) // buckled, not a lot of shaking - else - shake_camera(M, 10, 2) // unbuckled, HOLY SHIT SHAKE THE ROOM - if(istype(M, /mob/living/carbon)) - if(!M.buckled) - M.Weaken(5) + wait_for_launch = 0 + shuttle.cancel_launch(src) - captain_announce("The Emergency Shuttle has left the station. Estimate [round(timeleft()/60,1)] minutes until the shuttle docks at Central Command.") + if (evac) + captain_announce("The emergency shuttle has been recalled.") + world << sound('sound/AI/shuttlerecalled.ogg') + + for(var/area/A in world) + if(istype(A, /area/hallway)) + A.readyreset() + evac = 0 + else + captain_announce("The scheduled crew transfer has been cancelled.") - return 1 +/datum/shuttle_controller/emergency_shuttle/proc/can_call() + if (deny_shuttle) + return 0 + if (shuttle.moving_status != SHUTTLE_IDLE || !shuttle.location) //must be idle at centcom + return 0 + if (wait_for_launch) //already launching + return 0 + return 1 - else - return 1 +//this only returns 0 if it would absolutely make no sense to recall +//e.g. the shuttle is already at the station or wasn't called to begin with +//other reasons for the shuttle not being recallable should be handled elsewhere +/datum/shuttle_controller/emergency_shuttle/proc/can_recall() + if (shuttle.moving_status == SHUTTLE_INTRANSIT) //if the shuttle is already in transit then it's too late + return 0 + if (!shuttle.location) //already at the station. + return 0 + if (!wait_for_launch) //we weren't going anywhere, anyways... + return 0 + return 1 +/datum/shuttle_controller/emergency_shuttle/proc/get_shuttle_prep_time() + // During mutiny rounds, the shuttle takes twice as long. + if(ticker && istype(ticker.mode,/datum/game_mode/mutiny)) + return SHUTTLE_PREPTIME * 3 //15 minutes + + return SHUTTLE_PREPTIME /* Some slapped-together star effects for maximum spess immershuns. Basically consists of a diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index e98f4e42992..dd483fc07f3 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -125,7 +125,7 @@ Implants; /datum/game_mode/proc/check_finished() //to be called by ticker - if(emergency_shuttle.location==2 || station_was_nuked) + if(emergency_shuttle.returned() || station_was_nuked) return 1 return 0 diff --git a/code/game/gamemodes/gameticker.dm b/code/game/gamemodes/gameticker.dm index 18f6d114106..f53a09313c3 100644 --- a/code/game/gamemodes/gameticker.dm +++ b/code/game/gamemodes/gameticker.dm @@ -315,10 +315,10 @@ var/global/datum/controller/gameticker/ticker var/game_finished = 0 var/mode_finished = 0 if (config.continous_rounds) - game_finished = (emergency_shuttle.location == 2 || mode.station_was_nuked) + game_finished = (emergency_shuttle.returned() || mode.station_was_nuked) mode_finished = (!post_game && mode.check_finished()) else - game_finished = (mode.check_finished() || (emergency_shuttle.location == 2 && emergency_shuttle.alert == 1)) + game_finished = (mode.check_finished() || (emergency_shuttle.returned() && emergency_shuttle.evac == 1)) mode_finished = game_finished if(!mode.explosion_in_progress && game_finished && (mode_finished || post_game)) diff --git a/code/game/gamemodes/malfunction/malfunction.dm b/code/game/gamemodes/malfunction/malfunction.dm index eccf013fff7..1f6f40176c0 100644 --- a/code/game/gamemodes/malfunction/malfunction.dm +++ b/code/game/gamemodes/malfunction/malfunction.dm @@ -67,7 +67,7 @@ AI_mind.current.icon_state = "ai-malf2" */ if(emergency_shuttle) - emergency_shuttle.always_fake_recall = 1 + emergency_shuttle.auto_recall = 1 spawn (rand(waittime_l, waittime_h)) send_intercept() ..() @@ -136,7 +136,7 @@ if (is_malf_ai_dead()) if(config.continous_rounds) if(emergency_shuttle) - emergency_shuttle.always_fake_recall = 0 + emergency_shuttle.auto_recall = 0 malf_mode_declared = 0 else return 1 @@ -206,7 +206,7 @@ /datum/game_mode/malfunction/declare_completion() var/malf_dead = is_malf_ai_dead() - var/crew_evacuated = (emergency_shuttle.location==2) + var/crew_evacuated = (emergency_shuttle.returned()) if ( station_captured && station_was_nuked) feedback_set_details("round_end_result","win - AI win - nuke") diff --git a/code/game/gamemodes/newobjective.dm b/code/game/gamemodes/newobjective.dm index 30791aefccd..e58801a329d 100644 --- a/code/game/gamemodes/newobjective.dm +++ b/code/game/gamemodes/newobjective.dm @@ -267,7 +267,7 @@ datum explanation_text = "Frame [target.current.real_name], the [target.assigned_role] for a crime and make sure they are arrested and brought back to the Centcom station alive. We'll handle the rest from there." check_completion() - if(emergency_shuttle.location<2) + if(!emergency_shuttle.returned()) return 0 if(target.current.stat == 2) return 0 @@ -313,7 +313,7 @@ datum explanation_text = "[target.current.real_name], the [target.assigned_role] is a [pick("relative of a","friend of a","") + pick("high ranking","important","well-liked")] Syndicate [pick("Leader","Officer","Agent","sympathiser")]. Make sure they get off the station safely, while minimizing intervention." check_completion() - if(emergency_shuttle.location<2) + if(!emergency_shuttle.returned()) return 0 if(target.current.stat == 2) @@ -477,7 +477,7 @@ datum explanation_text = "Hijack the emergency shuttle by escaping alone." check_completion() - if(emergency_shuttle.location<2) + if(!emergency_shuttle.returned()) return 0 if(!owner.current || owner.current.stat == 2) @@ -512,7 +512,7 @@ datum explanation_text = "Escape on the shuttle alive, without being arrested." check_completion() - if(emergency_shuttle.location<2) + if(!emergency_shuttle.returned()) return 0 if(!owner.current || owner.current.stat ==2) @@ -1224,7 +1224,7 @@ datum check_completion() if(!istype(owner.current, /mob/living/silicon)) return 0 - if(emergency_shuttle.location<2) + if(!emergency_shuttle.returned()) return 0 if(!owner.current) return 0 @@ -1447,7 +1447,7 @@ datum/objective/silence explanation_text = "Do not allow anyone to escape the station. Only allow the shuttle to be called when everyone is dead and your story is the only one left." check_completion() - if(emergency_shuttle.location<2) + if(!emergency_shuttle.returned()) return 0 var/area/shuttle = locate(/area/shuttle/escape/centcom) diff --git a/code/game/gamemodes/nuclear/nuclear.dm b/code/game/gamemodes/nuclear/nuclear.dm index 9d86d2a3683..1677f272220 100644 --- a/code/game/gamemodes/nuclear/nuclear.dm +++ b/code/game/gamemodes/nuclear/nuclear.dm @@ -277,7 +277,7 @@ if(!is_type_in_list(disk_area, centcom_areas)) disk_rescued = 0 break - var/crew_evacuated = (emergency_shuttle.location==2) + var/crew_evacuated = (emergency_shuttle.returned()) //var/operatives_are_dead = is_operatives_are_dead() diff --git a/code/game/gamemodes/objective.dm b/code/game/gamemodes/objective.dm index 848f247db91..5112a51187c 100644 --- a/code/game/gamemodes/objective.dm +++ b/code/game/gamemodes/objective.dm @@ -285,7 +285,7 @@ datum/objective/hijack check_completion() if(!owner.current || owner.current.stat) return 0 - if(emergency_shuttle.location<2) + if(!emergency_shuttle.returned()) return 0 if(issilicon(owner.current)) return 0 @@ -307,7 +307,7 @@ datum/objective/block check_completion() if(!istype(owner.current, /mob/living/silicon)) return 0 - if(emergency_shuttle.location<2) + if(!emergency_shuttle.returned()) return 0 if(!owner.current) return 0 @@ -325,7 +325,7 @@ datum/objective/silence explanation_text = "Do not allow anyone to escape the station. Only allow the shuttle to be called when everyone is dead and your story is the only one left." check_completion() - if(emergency_shuttle.location<2) + if(!emergency_shuttle.returned()) return 0 for(var/mob/living/player in player_list) @@ -350,7 +350,7 @@ datum/objective/escape return 0 if(isbrain(owner.current)) return 0 - if(emergency_shuttle.location<2) + if(!emergency_shuttle.returned()) return 0 if(!owner.current || owner.current.stat ==2) return 0 @@ -709,7 +709,7 @@ datum/objective/absorb explanation_text = "Our knowledge must live on. Make sure at least 5 acolytes escape on the shuttle to spread their work on an another station." check_completion() - if(emergency_shuttle.location<2) + if(!emergency_shuttle.returned()) return 0 var/cultists_escaped = 0 diff --git a/code/game/gamemodes/revolution/revolution.dm b/code/game/gamemodes/revolution/revolution.dm index f6199dcb167..0a32c1ed456 100644 --- a/code/game/gamemodes/revolution/revolution.dm +++ b/code/game/gamemodes/revolution/revolution.dm @@ -91,7 +91,7 @@ greet_revolutionary(rev_mind) modePlayer += head_revolutionaries if(emergency_shuttle) - emergency_shuttle.always_fake_recall = 1 + emergency_shuttle.auto_recall = 1 spawn (rand(waittime_l, waittime_h)) send_intercept() ..() @@ -175,7 +175,7 @@ if(config.continous_rounds) if(finished != 0) if(emergency_shuttle) - emergency_shuttle.always_fake_recall = 0 + emergency_shuttle.auto_recall = 0 return ..() if(finished != 0) return 1 diff --git a/code/game/gamemodes/sandbox/sandbox.dm b/code/game/gamemodes/sandbox/sandbox.dm index 475c3d22aa5..e3c270678df 100644 --- a/code/game/gamemodes/sandbox/sandbox.dm +++ b/code/game/gamemodes/sandbox/sandbox.dm @@ -18,4 +18,4 @@ /datum/game_mode/sandbox/post_setup() ..() if(emergency_shuttle) - emergency_shuttle.always_fake_recall = 1 + emergency_shuttle.auto_recall = 1 diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index 9d499e168c8..9af0cff2a80 100644 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -119,7 +119,7 @@ if("callshuttle2") if(src.authenticated) call_shuttle_proc(usr) - if(emergency_shuttle.online) + if(emergency_shuttle.online()) post_status("shuttle") src.state = STATE_DEFAULT if("cancelshuttle") @@ -284,8 +284,8 @@ user.set_machine(src) var/dat = "Communications Console" - if (emergency_shuttle.online && emergency_shuttle.location==0) - var/timeleft = emergency_shuttle.timeleft() + if (emergency_shuttle.has_eta()) + var/timeleft = emergency_shuttle.estimate_arrival_time() dat += "Emergency shuttle\n
\nETA: [timeleft / 60 % 60]:[add_zero(num2text(timeleft % 60), 2)]
" if (istype(user, /mob/living/silicon)) @@ -309,8 +309,8 @@ dat += "
\[ Restore Backup Routing Data \]" dat += "
\[ Change alert level \]" - if(emergency_shuttle.location==0) - if (emergency_shuttle.online) + if(!emergency_shuttle.location()) + if (emergency_shuttle.online()) dat += "
\[ Cancel Shuttle Call \]" else dat += "
\[ Call Emergency Shuttle \]" @@ -377,7 +377,7 @@ var/dat = "" switch(src.aistate) if(STATE_DEFAULT) - if(emergency_shuttle.location==0 && !emergency_shuttle.online) + if(!emergency_shuttle.location() && !emergency_shuttle.online()) dat += "
\[ Call Emergency Shuttle \]" dat += "
\[ Message List \]" dat += "
\[ Set Status Display \]" @@ -424,22 +424,26 @@ PS.allowedtocall = !(PS.allowedtocall) /proc/call_shuttle_proc(var/mob/user) - if ((!( ticker ) || emergency_shuttle.location)) + if ((!( ticker ) || !emergency_shuttle.location())) return if(sent_strike_team == 1) user << "Centcom will not allow the shuttle to be called. Consider all contracts terminated." return - if(world.time < 6000) // Ten minute grace period to let the game get going without lolmetagaming. -- TLE - user << "The emergency shuttle is refueling. Please wait another [round((6000-world.time)/600)] minutes before trying again." + if(emergency_shuttle.deny_shuttle) + user << "The emergency shuttle may not be sent at this time. Please try again later." return - if(emergency_shuttle.direction == -1) + if(world.time < 6000) // Ten minute grace period to let the game get going without lolmetagaming. -- TLE + user << "The emergency shuttle is refueling. Please wait another [round((6000-world.time)/60)] minutes before trying again." + return + + if(emergency_shuttle.going_to_centcom()) user << "The emergency shuttle may not be called while returning to CentCom." return - if(emergency_shuttle.online) + if(emergency_shuttle.online()) user << "The emergency shuttle is already on its way." return @@ -447,23 +451,22 @@ user << "Under directive 7-10, [station_name()] is quarantined until further notice." return - emergency_shuttle.incall() + emergency_shuttle.call_evac() log_game("[key_name(user)] has called the shuttle.") message_admins("[key_name_admin(user)] has called the shuttle.", 1) - captain_announce("The emergency shuttle has been called. It will arrive in [round(emergency_shuttle.timeleft()/60)] minutes.") - world << sound('sound/AI/shuttlecalled.ogg') + return /proc/init_shift_change(var/mob/user, var/force = 0) - if ((!( ticker ) || emergency_shuttle.location)) + if ((!( ticker ) || !emergency_shuttle.location())) return - if(emergency_shuttle.direction == -1) + if(emergency_shuttle.going_to_centcom()) user << "The shuttle may not be called while returning to CentCom." return - if(emergency_shuttle.online) + if(emergency_shuttle.online()) user << "The shuttle is already on its way." return @@ -478,32 +481,30 @@ return if(world.time < 54000) // 30 minute grace period to let the game get going - user << "The shuttle is refueling. Please wait another [round((54000-world.time)/600)] minutes before trying again."//may need to change "/600" + user << "The shuttle is refueling. Please wait another [round((54000-world.time)/60)] minutes before trying again." return if(ticker.mode.name == "revolution" || ticker.mode.name == "AI malfunction" || ticker.mode.name == "sandbox") //New version pretends to call the shuttle but cause the shuttle to return after a random duration. - emergency_shuttle.fake_recall = rand(300,500) + emergency_shuttle.auto_recall = 1 if(ticker.mode.name == "blob" || ticker.mode.name == "epidemic") user << "Under directive 7-10, [station_name()] is quarantined until further notice." return - emergency_shuttle.shuttlealert(1) - emergency_shuttle.incall() + emergency_shuttle.call_transfer() log_game("[key_name(user)] has called the shuttle.") message_admins("[key_name_admin(user)] has called the shuttle.", 1) - captain_announce("A crew transfer has been initiated. The shuttle has been called. It will arrive in [round(emergency_shuttle.timeleft()/60)] minutes.") return /proc/cancel_call_proc(var/mob/user) - if ((!( ticker ) || emergency_shuttle.location || emergency_shuttle.direction == 0 || emergency_shuttle.timeleft() < 300)) + if (!( ticker ) || !emergency_shuttle.can_recall()) return if((ticker.mode.name == "blob")||(ticker.mode.name == "meteor")) return - if(emergency_shuttle.direction != -1 && emergency_shuttle.online) //check that shuttle isn't already heading to centcomm + if(!emergency_shuttle.going_to_centcom()) //check that shuttle isn't already heading to centcomm emergency_shuttle.recall() log_game("[key_name(user)] has recalled the shuttle.") message_admins("[key_name_admin(user)] has recalled the shuttle.", 1) @@ -549,11 +550,9 @@ if(ticker.mode.name == "revolution" || ticker.mode.name == "AI malfunction" || sent_strike_team) return ..() - emergency_shuttle.incall(2) + emergency_shuttle.call_evac() log_game("All the AIs, comm consoles and boards are destroyed. Shuttle called.") message_admins("All the AIs, comm consoles and boards are destroyed. Shuttle called.", 1) - captain_announce("The emergency shuttle has been called. It will arrive in [round(emergency_shuttle.timeleft()/60)] minutes.") - world << sound('sound/AI/shuttlecalled.ogg') ..() @@ -574,10 +573,8 @@ if(ticker.mode.name == "revolution" || ticker.mode.name == "AI malfunction" || sent_strike_team) return ..() - emergency_shuttle.incall(2) + emergency_shuttle.call_evac() log_game("All the AIs, comm consoles and boards are destroyed. Shuttle called.") message_admins("All the AIs, comm consoles and boards are destroyed. Shuttle called.", 1) - captain_announce("The emergency shuttle has been called. It will arrive in [round(emergency_shuttle.timeleft()/60)] minutes.") - world << sound('sound/AI/shuttlecalled.ogg') ..() diff --git a/code/game/machinery/computer/shuttle.dm b/code/game/machinery/computer/shuttle.dm index 978db653f94..9d8b1da6f94 100644 --- a/code/game/machinery/computer/shuttle.dm +++ b/code/game/machinery/computer/shuttle.dm @@ -8,7 +8,7 @@ attackby(var/obj/item/weapon/card/W as obj, var/mob/user as mob) if(stat & (BROKEN|NOPOWER)) return - if ((!( istype(W, /obj/item/weapon/card) ) || !( ticker ) || emergency_shuttle.location != 1 || !( user ))) return + if ((!( istype(W, /obj/item/weapon/card) ) || !( ticker ) || emergency_shuttle.location() || !( user ))) return if (istype(W, /obj/item/weapon/card/id)||istype(W, /obj/item/device/pda)) if (istype(W, /obj/item/device/pda)) var/obj/item/device/pda/pda = W @@ -27,7 +27,7 @@ return 0 var/choice = alert(user, text("Would you like to (un)authorize a shortened launch time? [] authorization\s are still needed. Use abort to cancel all authorizations.", src.auth_need - src.authorized.len), "Shuttle Launch", "Authorize", "Repeal", "Abort") - if(emergency_shuttle.location != 1 && user.get_active_hand() != W) + if(emergency_shuttle.location() && user.get_active_hand() != W) return 0 switch(choice) if("Authorize") @@ -41,8 +41,7 @@ message_admins("[key_name_admin(user)] has launched the shuttle") log_game("[user.ckey] has launched the shuttle early") world << "\blue Alert: Shuttle launch time shortened to 10 seconds!" - emergency_shuttle.online = 1 - emergency_shuttle.settimeleft(10) + emergency_shuttle.launch_time = min(world.time + 100, emergency_shuttle.launch_time) //src.authorized = null del(src.authorized) src.authorized = list( ) @@ -59,11 +58,11 @@ else if (istype(W, /obj/item/weapon/card/emag) && !emagged) var/choice = alert(user, "Would you like to launch the shuttle?","Shuttle control", "Launch", "Cancel") - if(!emagged && emergency_shuttle.location == 1 && user.get_active_hand() == W) + if(!emagged && !emergency_shuttle.location() && user.get_active_hand() == W) switch(choice) if("Launch") world << "\blue Alert: Shuttle launch time shortened to 10 seconds!" - emergency_shuttle.settimeleft( 10 ) + emergency_shuttle.launch_time = min(world.time + 100, emergency_shuttle.launch_time) emagged = 1 if("Cancel") return diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm index ad0494ff31b..533460907a1 100644 --- a/code/game/machinery/status_display.dm +++ b/code/game/machinery/status_display.dm @@ -74,13 +74,15 @@ if(0) //blank remove_display() if(1) //emergency shuttle timer - if(emergency_shuttle.online) - var/line1 - var/line2 = get_shuttle_timer() - if(emergency_shuttle.location == 1) - line1 = "-ETD-" - else - line1 = "-ETA-" + if(emergency_shuttle.waiting_to_leave()) + var/line1 = "-ETD-" + var/line2 = get_shuttle_timer_departure() + if(length(line2) > CHARS_PER_LINE) + line2 = "Error!" + update_display(line1, line2) + else if(emergency_shuttle.has_eta()) + var/line1 = "-ETA-" + var/line2 = get_shuttle_timer_arrival() if(length(line2) > CHARS_PER_LINE) line2 = "Error!" update_display(line1, line2) @@ -111,7 +113,7 @@ if(4) // supply shuttle timer var/line1 = "SUPPLY" var/line2 = "" - + var/datum/shuttle/ferry/supply/shuttle = supply_controller.shuttle if (!shuttle) line2 = "Error" @@ -164,8 +166,14 @@ if(maptext != new_text) maptext = new_text - proc/get_shuttle_timer() - var/timeleft = emergency_shuttle.timeleft() + proc/get_shuttle_timer_arrival() + var/timeleft = emergency_shuttle.estimate_arrival_time() + if(timeleft) + return "[add_zero(num2text((timeleft / 60) % 60),2)]:[add_zero(num2text(timeleft % 60), 2)]" + return "" + + proc/get_shuttle_timer_departure() + var/timeleft = emergency_shuttle.estimate_launch_time() if(timeleft) return "[add_zero(num2text((timeleft / 60) % 60),2)]:[add_zero(num2text(timeleft % 60), 2)]" return "" @@ -174,7 +182,7 @@ var/datum/shuttle/ferry/supply/shuttle = supply_controller.shuttle if (!shuttle) return "Error" - + if(shuttle.has_eta()) var/timeleft = round((shuttle.arrive_time - world.time) / 10,1) if(timeleft < 0) diff --git a/code/modules/admin/player_panel.dm b/code/modules/admin/player_panel.dm index 132352bfc58..977239f92f5 100644 --- a/code/modules/admin/player_panel.dm +++ b/code/modules/admin/player_panel.dm @@ -397,15 +397,15 @@ dat += "Current Game Mode: [ticker.mode.name]
" dat += "Round Duration: [round(world.time / 36000)]:[add_zero(world.time / 600 % 60, 2)]:[world.time / 100 % 6][world.time / 100 % 10]
" dat += "Emergency shuttle
" - if (!emergency_shuttle.online) + if (!emergency_shuttle.online()) dat += "Call Shuttle
" else - var/timeleft = emergency_shuttle.timeleft() - switch(emergency_shuttle.location) - if(0) + var/timeleft = emergency_shuttle.estimate_launch_time() + switch(emergency_shuttle.location()) + if(1) dat += "ETA: [(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]
" dat += "Send Back
" - if(1) + if(0) dat += "ETA: [(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]
" dat += "[ticker.delay_end ? "End Round Normally" : "Delay Round End"]
" if(ticker.mode.syndicates.len) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 6ec90e50c5e..dcbbf837b29 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -214,36 +214,37 @@ switch(href_list["call_shuttle"]) if("1") - if ((!( ticker ) || emergency_shuttle.location)) + if ((!( ticker ) || !emergency_shuttle.location())) return - emergency_shuttle.incall() - captain_announce("The emergency shuttle has been called. It will arrive in [round(emergency_shuttle.timeleft()/60)] minutes.") - log_admin("[key_name(usr)] called the Emergency Shuttle") - message_admins("\blue [key_name_admin(usr)] called the Emergency Shuttle to the station", 1) + if (emergency_shuttle.can_call()) + emergency_shuttle.call_evac() + log_admin("[key_name(usr)] called the Emergency Shuttle") + message_admins("\blue [key_name_admin(usr)] called the Emergency Shuttle to the station", 1) if("2") - if ((!( ticker ) || emergency_shuttle.location || emergency_shuttle.direction == 0)) + if (!( ticker ) || !emergency_shuttle.location()) return - switch(emergency_shuttle.direction) - if(-1) - emergency_shuttle.incall() - captain_announce("The emergency shuttle has been called. It will arrive in [round(emergency_shuttle.timeleft()/60)] minutes.") - log_admin("[key_name(usr)] called the Emergency Shuttle") - message_admins("\blue [key_name_admin(usr)] called the Emergency Shuttle to the station", 1) - if(1) - emergency_shuttle.recall() - log_admin("[key_name(usr)] sent the Emergency Shuttle back") - message_admins("\blue [key_name_admin(usr)] sent the Emergency Shuttle back", 1) + if (emergency_shuttle.can_call()) + emergency_shuttle.call_evac() + log_admin("[key_name(usr)] called the Emergency Shuttle") + message_admins("\blue [key_name_admin(usr)] called the Emergency Shuttle to the station", 1) + + else if (emergency_shuttle.can_recall()) + emergency_shuttle.recall() + log_admin("[key_name(usr)] sent the Emergency Shuttle back") + message_admins("\blue [key_name_admin(usr)] sent the Emergency Shuttle back", 1) href_list["secretsadmin"] = "check_antagonist" else if(href_list["edit_shuttle_time"]) if(!check_rights(R_SERVER)) return - emergency_shuttle.settimeleft( input("Enter new shuttle duration (seconds):","Edit Shuttle Timeleft", emergency_shuttle.timeleft() ) as num ) - log_admin("[key_name(usr)] edited the Emergency Shuttle's timeleft to [emergency_shuttle.timeleft()]") - captain_announce("The emergency shuttle has been called. It will arrive in [round(emergency_shuttle.timeleft()/60)] minutes.") - message_admins("\blue [key_name_admin(usr)] edited the Emergency Shuttle's timeleft to [emergency_shuttle.timeleft()]", 1) + var/new_time_left = input("Enter new shuttle launch duration (seconds):","Edit Shuttle Timeleft", emergency_shuttle.estimate_launch_time() ) as num + + emergency_shuttle.launch_time = world.time + new_time_left*10 + + log_admin("[key_name(usr)] edited the Emergency Shuttle's timeleft to [new_time_left]") + message_admins("\blue [key_name_admin(usr)] edited the Emergency Shuttle's timeleft to [new_time_left*10]", 1) href_list["secretsadmin"] = "check_antagonist" else if(href_list["delay_round_end"]) diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index 06e702bc173..1ce5b057eeb 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -73,7 +73,7 @@ var/age = alert(src, "Age check", "Show accounts yonger then _____ days","7", "30" , "All") - if(age == "All") + if(age == "All") age = 9999999 else age = text2num(age) @@ -91,7 +91,7 @@ continue if(C.player_age < age) msg += "[key_name(C, 1, 1, highlight_special_characters)]: account is [C.player_age] days old
" - + if(missing_ages) src << "Some accounts did not have proper ages set in their clients. This function requires database to be present" @@ -264,7 +264,7 @@ Ccomp's first proc. /client/proc/get_ghosts(var/notify = 0,var/what = 2) // what = 1, return ghosts ass list. - // what = 2, return mob list + // what = 2, return mob list var/list/mobs = list() var/list/ghosts = list() @@ -300,22 +300,22 @@ Ccomp's first proc. src << "Hrm, appears you didn't select a ghost" // Sanity check, if no ghosts in the list we don't want to edit a null variable and cause a runtime error. return - var/mob/dead/observer/G = ghosts[target] - if(G.has_enabled_antagHUD && config.antag_hud_restricted) + var/mob/dead/observer/G = ghosts[target] + if(G.has_enabled_antagHUD && config.antag_hud_restricted) var/response = alert(src, "Are you sure you wish to allow this individual to play?","Ghost has used AntagHUD","Yes","No") - if(response == "No") return + if(response == "No") return G.timeofdeath=-19999 /* time of death is checked in /mob/verb/abandon_mob() which is the Respawn verb. timeofdeath is used for bodies on autopsy but since we're messing with a ghost I'm pretty sure there won't be an autopsy. */ - G.has_enabled_antagHUD = 2 + G.has_enabled_antagHUD = 2 G.can_reenter_corpse = 1 G:show_message(text("\blue You may now respawn. You should roleplay as if you learned nothing about the round during your time with the dead."), 1) log_admin("[key_name(usr)] allowed [key_name(G)] to bypass the 30 minute respawn limit") message_admins("Admin [key_name_admin(usr)] allowed [key_name_admin(G)] to bypass the 30 minute respawn limit", 1) - + /client/proc/toggle_antagHUD_use() set category = "Server" set name = "Toggle antagHUD usage" @@ -331,7 +331,7 @@ Ccomp's first proc. if(g.antagHUD) g.antagHUD = 0 // Disable it on those that have it enabled g.has_enabled_antagHUD = 2 // We'll allow them to respawn - g << "\red The Administrator has disabled AntagHUD " + g << "\red The Administrator has disabled AntagHUD " config.antag_hud_allowed = 0 src << "\red AntagHUD usage has been disabled" action = "disabled" @@ -343,8 +343,8 @@ Ccomp's first proc. config.antag_hud_allowed = 1 action = "enabled" src << "\blue AntagHUD usage has been enabled" - - + + log_admin("[key_name(usr)] has [action] antagHUD usage for observers") message_admins("Admin [key_name_admin(usr)] has [action] antagHUD usage for observers", 1) @@ -361,7 +361,7 @@ Ccomp's first proc. for(var/mob/dead/observer/g in get_ghosts()) g << "\blue The administrator has lifted restrictions on joining the round if you use AntagHUD" action = "lifted restrictions" - config.antag_hud_restricted = 0 + config.antag_hud_restricted = 0 src << "\blue AntagHUD restrictions have been lifted" else for(var/mob/dead/observer/g in get_ghosts()) @@ -375,7 +375,7 @@ Ccomp's first proc. log_admin("[key_name(usr)] has [action] on joining the round if they use AntagHUD") message_admins("Admin [key_name_admin(usr)] has [action] on joining the round if they use AntagHUD", 1) - + @@ -883,7 +883,7 @@ Traitors and the like can also be revived with the previous role mostly intact. set category = "Admin" set name = "Call Shuttle" - if ((!( ticker ) || emergency_shuttle.location)) + if ((!( ticker ) || emergency_shuttle.location())) return if(!check_rights(R_ADMIN)) return @@ -891,16 +891,21 @@ Traitors and the like can also be revived with the previous role mostly intact. var/confirm = alert(src, "You sure?", "Confirm", "Yes", "No") if(confirm != "Yes") return + var/choice if(ticker.mode.name == "revolution" || ticker.mode.name == "AI malfunction" || ticker.mode.name == "confliction") - var/choice = input("The shuttle will just return if you call it. Call anyway?") in list("Confirm", "Cancel") + choice = input("The shuttle will just return if you call it. Call anyway?") in list("Confirm", "Cancel") if(choice == "Confirm") - emergency_shuttle.fake_recall = rand(300,500) + emergency_shuttle.auto_recall = 1 //enable auto-recall else return - emergency_shuttle.incall() - captain_announce("The emergency shuttle has been called. It will arrive in [round(emergency_shuttle.timeleft()/60)] minutes.") - world << sound('sound/AI/shuttlecalled.ogg') + choice = input("Is this an emergency evacuation or a crew transfer?") in list("Emergency", "Crew Transfer") + if (choice == "Emergency") + emergency_shuttle.call_evac() + else + emergency_shuttle.call_transfer() + + feedback_add_details("admin_verb","CSHUT") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! log_admin("[key_name(usr)] admin-called the emergency shuttle.") message_admins("\blue [key_name_admin(usr)] admin-called the emergency shuttle.", 1) @@ -914,7 +919,7 @@ Traitors and the like can also be revived with the previous role mostly intact. if(alert(src, "You sure?", "Confirm", "Yes", "No") != "Yes") return - if(!ticker || emergency_shuttle.location || emergency_shuttle.direction == 0) + if(!ticker || !emergency_shuttle.can_recall()) return emergency_shuttle.recall() diff --git a/code/modules/admin/verbs/striketeam.dm b/code/modules/admin/verbs/striketeam.dm index 92de9fff491..cf5b94322d5 100644 --- a/code/modules/admin/verbs/striketeam.dm +++ b/code/modules/admin/verbs/striketeam.dm @@ -30,7 +30,7 @@ var/global/sent_strike_team = 0 sent_strike_team = 1 - if (emergency_shuttle.direction == 1 && emergency_shuttle.online == 1) + if (emergency_shuttle.can_recall()) emergency_shuttle.recall() var/commando_number = commandos_possible //for selecting a leader diff --git a/code/modules/admin/verbs/striketeam_syndicate.dm b/code/modules/admin/verbs/striketeam_syndicate.dm index e8c446d966e..bd1b1707f6b 100644 --- a/code/modules/admin/verbs/striketeam_syndicate.dm +++ b/code/modules/admin/verbs/striketeam_syndicate.dm @@ -35,8 +35,8 @@ var/global/sent_syndicate_strike_team = 0 sent_syndicate_strike_team = 1 - if (emergency_shuttle.direction == 1 && emergency_shuttle.online == 1) - emergency_shuttle.recall() + //if (emergency_shuttle.can_recall()) + // emergency_shuttle.recall() //why, exactly? Admins can do this themselves. var/syndicate_commando_number = syndicate_commandos_possible //for selecting a leader var/syndicate_leader_selected = 0 //when the leader is chosen. The last person spawned. diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index df0edf4b1a8..2386c5f5247 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -216,8 +216,8 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp if(ticker.mode:malf_mode_declared) stat(null, "Time left: [max(ticker.mode:AI_win_timeleft/(ticker.mode:apcs/3), 0)]") if(emergency_shuttle) - if(emergency_shuttle.online && emergency_shuttle.location < 2) - var/timeleft = emergency_shuttle.timeleft() + if(emergency_shuttle.has_eta() && !emergency_shuttle.returned()) + var/timeleft = emergency_shuttle.estimate_arrival_time() if (timeleft) stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]") diff --git a/code/modules/mob/living/carbon/alien/alien.dm b/code/modules/mob/living/carbon/alien/alien.dm index c0214abd9f0..89e9cff6545 100644 --- a/code/modules/mob/living/carbon/alien/alien.dm +++ b/code/modules/mob/living/carbon/alien/alien.dm @@ -159,8 +159,8 @@ stat(null, "Plasma Stored: [getPlasma()]/[max_plasma]") if(emergency_shuttle) - if(emergency_shuttle.online && emergency_shuttle.location < 2) - var/timeleft = emergency_shuttle.timeleft() + if(emergency_shuttle.has_eta() && !emergency_shuttle.returned()) + var/timeleft = emergency_shuttle.estimate_arrival_time() if (timeleft) stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]") diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 2925449d0ed..7cdcfca0520 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -171,8 +171,8 @@ if(ticker.mode:malf_mode_declared) stat(null, "Time left: [max(ticker.mode:AI_win_timeleft/(ticker.mode:apcs/3), 0)]") if(emergency_shuttle) - if(emergency_shuttle.online && emergency_shuttle.location < 2) - var/timeleft = emergency_shuttle.timeleft() + if(emergency_shuttle.has_eta() && !emergency_shuttle.returned()) + var/timeleft = emergency_shuttle.estimate_arrival_time() if (timeleft) stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]") diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index c98421d4243..bccb370c6fc 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -291,7 +291,7 @@ var/list/ai_list = list() call_shuttle_proc(src) // hack to display shuttle timer - if(emergency_shuttle.online) + if(emergency_shuttle.online()) var/obj/machinery/computer/communications/C = locate() in machines if(C) C.post_status("shuttle") diff --git a/code/modules/mob/living/silicon/ai/death.dm b/code/modules/mob/living/silicon/ai/death.dm index 6e2fb560b3f..c9541858467 100644 --- a/code/modules/mob/living/silicon/ai/death.dm +++ b/code/modules/mob/living/silicon/ai/death.dm @@ -39,11 +39,9 @@ callshuttle = 0 if(callshuttle == 3) //if all three conditions are met - emergency_shuttle.incall(2) + emergency_shuttle.call_evac() log_game("All the AIs, comm consoles and boards are destroyed. Shuttle called.") message_admins("All the AIs, comm consoles and boards are destroyed. Shuttle called.", 1) - captain_announce("The emergency shuttle has been called. It will arrive in [round(emergency_shuttle.timeleft()/60)] minutes.") - world << sound('sound/AI/shuttlecalled.ogg') if(explosive) spawn(10) diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index 19ed4be3c2c..8e1cf220d84 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -97,10 +97,11 @@ // this function displays the shuttles ETA in the status panel if the shuttle has been called /mob/living/silicon/proc/show_emergency_shuttle_eta() - if(emergency_shuttle.online && emergency_shuttle.location < 2) - var/timeleft = emergency_shuttle.timeleft() - if (timeleft) - stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]") + if(emergency_shuttle) + if(emergency_shuttle.has_eta() && !emergency_shuttle.returned()) + var/timeleft = emergency_shuttle.estimate_arrival_time() + if (timeleft) + stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]") // This adds the basic clock, shuttle recall timer, and malf_ai info to all silicon lifeforms diff --git a/code/modules/mob/living/simple_animal/borer.dm b/code/modules/mob/living/simple_animal/borer.dm index b78c037bbc4..f8faad0635d 100644 --- a/code/modules/mob/living/simple_animal/borer.dm +++ b/code/modules/mob/living/simple_animal/borer.dm @@ -146,8 +146,8 @@ statpanel("Status") if(emergency_shuttle) - if(emergency_shuttle.online && emergency_shuttle.location < 2) - var/timeleft = emergency_shuttle.timeleft() + if(emergency_shuttle.has_eta() && !emergency_shuttle.returned()) + var/timeleft = emergency_shuttle.estimate_arrival_time() if (timeleft) stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]") diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index d869d4ba366..1bc7730b362 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -329,12 +329,13 @@ dat += "Round Duration: [round(hours)]h [round(mins)]m
" if(emergency_shuttle) //In case Nanotrasen decides reposess CentComm's shuttles. - if(emergency_shuttle.direction == 2) //Shuttle is going to centcomm, not recalled + if(emergency_shuttle.going_to_centcom()) //Shuttle is going to centcomm, not recalled dat += "The station has been evacuated.
" - if(emergency_shuttle.direction == 1 && emergency_shuttle.timeleft() < 300 && emergency_shuttle.alert == 0) // Emergency shuttle is past the point of no recall - dat += "The station is currently undergoing evacuation procedures.
" - if(emergency_shuttle.direction == 1 && emergency_shuttle.alert == 1) // Crew transfer initiated - dat += "The station is currently undergoing crew transfer procedures.
" + if(emergency_shuttle.online()) + if (emergency_shuttle.evac) // Emergency shuttle is past the point of no recall + dat += "The station is currently undergoing evacuation procedures.
" + else // Crew transfer initiated + dat += "The station is currently undergoing crew transfer procedures.
" dat += "Choose from the following open positions:
" for(var/datum/job/job in job_master.occupations) diff --git a/code/modules/power/singularity/singularity.dm b/code/modules/power/singularity/singularity.dm index 900d0c2b174..e71157be7e7 100644 --- a/code/modules/power/singularity/singularity.dm +++ b/code/modules/power/singularity/singularity.dm @@ -475,8 +475,9 @@ var/global/list/uneatable = list( /obj/machinery/singularity/narsie/large/New() ..() world << "NAR-SIE HAS RISEN" - if(emergency_shuttle) - emergency_shuttle.incall(0.5) // Cannot recall + if(emergency_shuttle && emergency_shuttle.can_call()) + emergency_shuttle.call_evac() + emergency_shuttle.launch_time = 0 // Cannot recall /obj/machinery/singularity/narsie/process() eat() diff --git a/code/modules/shuttles/shuttle_console.dm b/code/modules/shuttles/shuttle_console.dm index 13f8884be3b..e1ae517a4c1 100644 --- a/code/modules/shuttles/shuttle_console.dm +++ b/code/modules/shuttles/shuttle_console.dm @@ -6,11 +6,15 @@ /datum/shuttle/ferry var/location = 0 //0 = at area_station, 1 = at area_offsite + var/direction = 0 //0 = going to station, 1 = going to offsite. var/process_state = IDLE_STATE - + //this mutex ensures that only one console is processing the shuttle's controls at a time - var/obj/machinery/computer/shuttle_control/in_use = null - + var/obj/machinery/computer/shuttle_control/in_use = null //this doesn't have to be a console... + + var/area_transition + var/travel_time = 0 + var/area_station var/area_offsite //TODO: change location to a string and use a mapping for area and dock targets. @@ -25,7 +29,8 @@ destination = get_location_area(!location) if(!origin) origin = get_location_area(location) - + + direction = !location ..(origin, destination) /datum/shuttle/ferry/long_jump(var/area/departing,var/area/destination,var/area/interim,var/travel_time) @@ -36,7 +41,8 @@ destination = get_location_area(!location) if(!departing) departing = get_location_area(location) - + + direction = !location ..(departing, destination, interim, travel_time) /datum/shuttle/ferry/move(var/area/origin,var/area/destination) @@ -44,16 +50,20 @@ destination = get_location_area(!location) if(!origin) origin = get_location_area(location) - + if (docking_controller && !docking_controller.undocked()) docking_controller.force_undock() ..(origin, destination) - location = !location + + + if (destination == area_station) location = 0 + if (destination == area_offsite) location = 1 + //if this is a long_jump retain the location we were last at until we get to the new one /datum/shuttle/ferry/proc/get_location_area(location_id = null) if (isnull(location_id)) location_id = location - + if (!location_id) return area_station return area_offsite @@ -62,12 +72,12 @@ switch(process_state) if (WAIT_LAUNCH) if (skip_docking_checks() || docking_controller.can_launch()) - - //once you have a transition area, making ferry shuttles have a transition would merely requre replacing this with - //if (transition_area) long_jump(...) - //else short_jump () - short_jump() - + + if (travel_time && area_transition) + long_jump(null, null, area_transition, travel_time) + else + short_jump() + process_state = WAIT_ARRIVE if (WAIT_ARRIVE) if (moving_status == SHUTTLE_IDLE) @@ -77,6 +87,7 @@ if (skip_docking_checks() || docking_controller.docked()) process_state = IDLE_STATE in_use = null //release lock + arrived() /datum/shuttle/ferry/current_dock_target() var/dock_target @@ -89,42 +100,42 @@ /datum/shuttle/ferry/proc/launch(var/obj/machinery/computer/shuttle_control/user) if (!can_launch()) return - + in_use = user //obtain an exclusive lock on the shuttle - + process_state = WAIT_LAUNCH undock() /datum/shuttle/ferry/proc/force_launch(var/obj/machinery/computer/shuttle_control/user) if (!can_force()) return - + in_use = user //obtain an exclusive lock on the shuttle - + short_jump() - + process_state = WAIT_ARRIVE /datum/shuttle/ferry/proc/cancel_launch(var/obj/machinery/computer/shuttle_control/user) if (!can_cancel()) return - + moving_status = SHUTTLE_IDLE process_state = WAIT_FINISH - + if (docking_controller && !docking_controller.undocked()) docking_controller.force_undock() - + spawn(10) dock() - + return /datum/shuttle/ferry/proc/can_launch() if (moving_status != SHUTTLE_IDLE) return 0 - + if (in_use) return 0 - + return 1 /datum/shuttle/ferry/proc/can_force() @@ -137,6 +148,10 @@ return 1 return 0 +//This gets called when the shuttle finishes arriving at it's destination +//This can be used by subtypes to do things when the shuttle arrives. +/datum/shuttle/ferry/proc/arrived() + return //do nothing for now /obj/machinery/computer/shuttle_control @@ -145,7 +160,7 @@ icon_state = "shuttle" req_access = list(access_engine) circuit = null - + var/shuttle_tag // Used to coordinate data in shuttle controller. var/hacked = 0 // Has been emagged, no access restrictions. var/launch_override = 0 @@ -156,11 +171,11 @@ /obj/machinery/computer/shuttle_control/process() if (!shuttles || !(shuttle_tag in shuttles)) return - + var/datum/shuttle/ferry/shuttle = shuttles[shuttle_tag] if (!istype(shuttle)) return - + if (shuttle.in_use == src) shuttle.process_shuttle() @@ -168,7 +183,7 @@ var/datum/shuttle/ferry/shuttle = shuttles[shuttle_tag] if (!istype(shuttle)) return - + if (shuttle.in_use == src) shuttle.in_use = null //shuttle may not dock properly if this gets deleted while in transit, but its not a big deal @@ -206,7 +221,7 @@ shuttle_status = "Proceeding to destination." if(WAIT_FINISH) shuttle_status = "Arriving at destination now." - + data = list( "shuttle_status" = shuttle_status, "shuttle_state" = shuttle_state, @@ -237,7 +252,7 @@ var/datum/shuttle/ferry/shuttle = shuttles[shuttle_tag] if (!istype(shuttle)) return - + if(href_list["move"]) shuttle.launch(src) if(href_list["force"]) diff --git a/code/modules/shuttles/shuttle_emergency.dm b/code/modules/shuttles/shuttle_emergency.dm new file mode 100644 index 00000000000..1116b666c26 --- /dev/null +++ b/code/modules/shuttles/shuttle_emergency.dm @@ -0,0 +1,69 @@ + + + +/datum/shuttle/ferry/emergency + //pass + +/datum/shuttle/ferry/emergency/arrived() + emergency_shuttle.shuttle_arrived() + +/* +/datum/shuttle/ferry/emergency/move() + if (!location) //leaving the station + emergency_shuttle.departed = 1 + ..() +*/ + +/datum/shuttle/ferry/escape_pod + //pass + +/datum/shuttle/ferry/escape_pod/can_launch() + if(location) + return 0 //it's a one-way trip. + return ..() + +/datum/shuttle/ferry/escape_pod/can_force() + return 0 + +/datum/shuttle/ferry/escape_pod/can_cancel() + return 0 + +//TODO replace this with proper door controllers +/datum/shuttle/ferry/escape_pod/move(var/area/origin,var/area/destination) + for(var/obj/machinery/door/D in origin) + spawn(0) + D.close() + + ..(origin, destination) //might need to adjust shuttle/move so that it can take into account the direction argument to area/move_contents_to, I dunno. + + for(var/obj/machinery/door/D in destination) + spawn(0) + D.open() + +//Escape pod garbage, copied from the controller +/* + //pods + start_location = locate(/area/shuttle/escape_pod1/station) + end_location = locate(/area/shuttle/escape_pod1/transit) + end_location = locate(/area/shuttle/escape_pod1/centcom) + start_location.move_contents_to(end_location, null, NORTH) + + start_location = locate(/area/shuttle/escape_pod2/station) + end_location = locate(/area/shuttle/escape_pod2/transit) + end_location = locate(/area/shuttle/escape_pod2/centcom) + start_location.move_contents_to(end_location, null, NORTH) + + start_location = locate(/area/shuttle/escape_pod3/station) + end_location = locate(/area/shuttle/escape_pod3/transit) + end_location = locate(/area/shuttle/escape_pod3/centcom) + start_location.move_contents_to(end_location, null, NORTH) + + //There is no pod 4, apparently. + + start_location = locate(/area/shuttle/escape_pod5/station) + end_location = locate(/area/shuttle/escape_pod5/transit) + end_location = locate(/area/shuttle/escape_pod5/centcom) + start_location.move_contents_to(end_location, null, EAST) + + +*/ \ No newline at end of file diff --git a/code/unused/hivebot/hivebot.dm b/code/unused/hivebot/hivebot.dm index 4cfb4ad9d2c..cf764c088b4 100644 --- a/code/unused/hivebot/hivebot.dm +++ b/code/unused/hivebot/hivebot.dm @@ -43,10 +43,11 @@ ..() statpanel("Status") if (src.client.statpanel == "Status") - if(emergency_shuttle.online && emergency_shuttle.location < 2) - var/timeleft = emergency_shuttle.timeleft() - if (timeleft) - stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]") + if(emergency_shuttle) + if(emergency_shuttle.has_eta() && !emergency_shuttle.returned()) + var/timeleft = emergency_shuttle.estimate_arrival_time() + if (timeleft) + stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]") /* if(ticker.mode.name == "AI malfunction") stat(null, "Points left until the AI takes over: [AI_points]/[AI_points_win]") diff --git a/code/unused/hivebot/mainframe.dm b/code/unused/hivebot/mainframe.dm index bef86752dbe..6e07b5b4576 100644 --- a/code/unused/hivebot/mainframe.dm +++ b/code/unused/hivebot/mainframe.dm @@ -23,10 +23,11 @@ ..() statpanel("Status") if (src.client.statpanel == "Status") - if(emergency_shuttle.online && emergency_shuttle.location < 2) - var/timeleft = emergency_shuttle.timeleft() - if (timeleft) - stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]") + if(emergency_shuttle) + if(emergency_shuttle.has_eta() && !emergency_shuttle.returned()) + var/timeleft = emergency_shuttle.estimate_arrival_time() + if (timeleft) + stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]") /* if(ticker.mode.name == "AI malfunction") stat(null, "Points left until the AI takes over: [AI_points]/[AI_points_win]") From e1d495b9ead08a68b08674ff2ec9e7dbd29fd5f6 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Sun, 22 Jun 2014 18:11:10 -0400 Subject: [PATCH 08/15] Fix for supply controller update --- code/game/supplyshuttle.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/supplyshuttle.dm b/code/game/supplyshuttle.dm index e6836352ad7..4ce6d25b7c7 100644 --- a/code/game/supplyshuttle.dm +++ b/code/game/supplyshuttle.dm @@ -147,7 +147,7 @@ var/list/mechtoys = list( New() ordernum = rand(1,9000) - if (shuttle_tag in shuttles && istype(shuttles[shuttle_tag], /datum/shuttle/ferry/supply)) + if ("Supply" in shuttles && istype(shuttles["Supply"], /datum/shuttle/ferry/supply)) shuttle = shuttles["Supply"] //still don't have the shuttle, so create one From caece105dc7063dd8b879857c6a8c182cc1b2d49 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Sun, 22 Jun 2014 18:19:07 -0400 Subject: [PATCH 09/15] Adds escape pods to the controller --- code/controllers/shuttle_controller.dm | 53 +++++++++++++++++++++- code/modules/shuttles/shuttle_emergency.dm | 30 +----------- 2 files changed, 52 insertions(+), 31 deletions(-) diff --git a/code/controllers/shuttle_controller.dm b/code/controllers/shuttle_controller.dm index 7ff76877102..3bd74103f93 100644 --- a/code/controllers/shuttle_controller.dm +++ b/code/controllers/shuttle_controller.dm @@ -14,6 +14,7 @@ var/global/datum/shuttle_controller/emergency_shuttle/emergency_shuttle /datum/shuttle_controller/emergency_shuttle var/datum/shuttle/ferry/shuttle + var/list/escape_pods var/launch_time //the time at which the shuttle will be launched var/auto_recall = 0 //if set, the shuttle will be auto-recalled @@ -40,6 +41,50 @@ var/global/datum/shuttle_controller/emergency_shuttle/emergency_shuttle //shuttle.docking_controller_tag = "supply_shuttle" //shuttle.dock_target_station = "cargo_bay" shuttles["Escape"] = shuttle + + if (!escape_pods) + escape_pods = list() + + var/datum/shuttle/ferry/escape_pod/pod + + pod = new() + pod.location = 0 + pod.warmup_time = 0 + pod.area_station = locate(/area/shuttle/escape_pod1/station) + pod.area_offsite = locate(/area/shuttle/escape_pod1/centcom) + pod.area_transition = locate(/area/shuttle/escape_pod1/transit) + pod.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN + escape_pods += pod + + pod = new() + pod.location = 0 + pod.warmup_time = 0 + pod.area_station = locate(/area/shuttle/escape_pod2/station) + pod.area_offsite = locate(/area/shuttle/escape_pod2/centcom) + pod.area_transition = locate(/area/shuttle/escape_pod2/transit) + pod.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN + escape_pods += pod + + pod = new() + pod.location = 0 + pod.warmup_time = 0 + pod.area_station = locate(/area/shuttle/escape_pod3/station) + pod.area_offsite = locate(/area/shuttle/escape_pod3/centcom) + pod.area_transition = locate(/area/shuttle/escape_pod3/transit) + pod.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN + escape_pods += pod + + //There is no pod 4, apparently. + + pod = new() + pod.location = 0 + pod.warmup_time = 0 + pod.area_station = locate(/area/shuttle/escape_pod5/station) + pod.area_offsite = locate(/area/shuttle/escape_pod5/centcom) + pod.area_transition = locate(/area/shuttle/escape_pod5/transit) + pod.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN + escape_pods += pod + /datum/shuttle_controller/emergency_shuttle/proc/process() if (wait_for_launch) @@ -49,9 +94,13 @@ var/global/datum/shuttle_controller/emergency_shuttle/emergency_shuttle //set the travel time if (!shuttle.location) //at station - shuttle.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN departed = 1 //technically we haven't left yet, but this should be good enough - //TODO launch pods + + //launch the pods! + for (var/datum/shuttle/ferry/escape_pod/pod in escape_pods) + pod.launch(src) + + shuttle.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN else shuttle.travel_time = SHUTTLE_TRANSIT_DURATION diff --git a/code/modules/shuttles/shuttle_emergency.dm b/code/modules/shuttles/shuttle_emergency.dm index 1116b666c26..a30647e017b 100644 --- a/code/modules/shuttles/shuttle_emergency.dm +++ b/code/modules/shuttles/shuttle_emergency.dm @@ -38,32 +38,4 @@ for(var/obj/machinery/door/D in destination) spawn(0) - D.open() - -//Escape pod garbage, copied from the controller -/* - //pods - start_location = locate(/area/shuttle/escape_pod1/station) - end_location = locate(/area/shuttle/escape_pod1/transit) - end_location = locate(/area/shuttle/escape_pod1/centcom) - start_location.move_contents_to(end_location, null, NORTH) - - start_location = locate(/area/shuttle/escape_pod2/station) - end_location = locate(/area/shuttle/escape_pod2/transit) - end_location = locate(/area/shuttle/escape_pod2/centcom) - start_location.move_contents_to(end_location, null, NORTH) - - start_location = locate(/area/shuttle/escape_pod3/station) - end_location = locate(/area/shuttle/escape_pod3/transit) - end_location = locate(/area/shuttle/escape_pod3/centcom) - start_location.move_contents_to(end_location, null, NORTH) - - //There is no pod 4, apparently. - - start_location = locate(/area/shuttle/escape_pod5/station) - end_location = locate(/area/shuttle/escape_pod5/transit) - end_location = locate(/area/shuttle/escape_pod5/centcom) - start_location.move_contents_to(end_location, null, EAST) - - -*/ \ No newline at end of file + D.open() \ No newline at end of file From b0cc1f6789613b0c3e4cc5ecd51bea390776e0eb Mon Sep 17 00:00:00 2001 From: mwerezak Date: Sun, 22 Jun 2014 18:36:43 -0400 Subject: [PATCH 10/15] Forgot to process shuttles --- code/controllers/shuttle_controller.dm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/code/controllers/shuttle_controller.dm b/code/controllers/shuttle_controller.dm index 3bd74103f93..467637714a1 100644 --- a/code/controllers/shuttle_controller.dm +++ b/code/controllers/shuttle_controller.dm @@ -105,6 +105,13 @@ var/global/datum/shuttle_controller/emergency_shuttle/emergency_shuttle shuttle.travel_time = SHUTTLE_TRANSIT_DURATION shuttle.launch(src) + + //process the shuttles + if (shuttle.in_use) + shuttle.process_shuttle() + for (var/datum/shuttle/ferry/escape_pod/pod in escape_pods) + if (pod.in_use) + pod.process_shuttle() //called when the shuttle has arrived. /datum/shuttle_controller/emergency_shuttle/proc/shuttle_arrived() From 71351bd2858b77bbe2f9301f2e9e42738d756496 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Sun, 22 Jun 2014 20:40:08 -0400 Subject: [PATCH 11/15] Some fixes --- code/controllers/shuttle_controller.dm | 112 ++++++++++-------------- code/game/supplyshuttle.dm | 13 --- code/modules/admin/verbs/randomverbs.dm | 2 +- code/modules/shuttles/shuttle.dm | 27 ++++++ 4 files changed, 76 insertions(+), 78 deletions(-) diff --git a/code/controllers/shuttle_controller.dm b/code/controllers/shuttle_controller.dm index 467637714a1..83baa847104 100644 --- a/code/controllers/shuttle_controller.dm +++ b/code/controllers/shuttle_controller.dm @@ -25,65 +25,48 @@ var/global/datum/shuttle_controller/emergency_shuttle/emergency_shuttle var/deny_shuttle = 0 //allows admins to prevent the shuttle from being called var/departed = 0 //if the shuttle has left the station at least once -/datum/shuttle_controller/emergency_shuttle/New() - if ("Escape" in shuttles && istype(shuttles["Escape"], /datum/shuttle/ferry/emergency)) - shuttle = shuttles["Escape"] +/datum/shuttle_controller/emergency_shuttle/proc/setup_pods() + escape_pods = list() - //still don't have the shuttle, so create one - if (!shuttle) - shuttle = new/datum/shuttle/ferry/emergency() - shuttle.location = 1 - shuttle.warmup_time = 10 - shuttle.area_offsite = locate(/area/shuttle/escape/centcom) - shuttle.area_station = locate(/area/shuttle/escape/station) - shuttle.area_transition = locate(/area/shuttle/escape/transit) - shuttle.travel_time = SHUTTLE_TRANSIT_DURATION - //shuttle.docking_controller_tag = "supply_shuttle" - //shuttle.dock_target_station = "cargo_bay" - shuttles["Escape"] = shuttle + var/datum/shuttle/ferry/escape_pod/pod - if (!escape_pods) - escape_pods = list() - - var/datum/shuttle/ferry/escape_pod/pod - - pod = new() - pod.location = 0 - pod.warmup_time = 0 - pod.area_station = locate(/area/shuttle/escape_pod1/station) - pod.area_offsite = locate(/area/shuttle/escape_pod1/centcom) - pod.area_transition = locate(/area/shuttle/escape_pod1/transit) - pod.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN - escape_pods += pod + pod = new() + pod.location = 0 + pod.warmup_time = 0 + pod.area_station = locate(/area/shuttle/escape_pod1/station) + pod.area_offsite = locate(/area/shuttle/escape_pod1/centcom) + pod.area_transition = locate(/area/shuttle/escape_pod1/transit) + pod.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN + escape_pods += pod - pod = new() - pod.location = 0 - pod.warmup_time = 0 - pod.area_station = locate(/area/shuttle/escape_pod2/station) - pod.area_offsite = locate(/area/shuttle/escape_pod2/centcom) - pod.area_transition = locate(/area/shuttle/escape_pod2/transit) - pod.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN - escape_pods += pod - - pod = new() - pod.location = 0 - pod.warmup_time = 0 - pod.area_station = locate(/area/shuttle/escape_pod3/station) - pod.area_offsite = locate(/area/shuttle/escape_pod3/centcom) - pod.area_transition = locate(/area/shuttle/escape_pod3/transit) - pod.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN - escape_pods += pod - - //There is no pod 4, apparently. - - pod = new() - pod.location = 0 - pod.warmup_time = 0 - pod.area_station = locate(/area/shuttle/escape_pod5/station) - pod.area_offsite = locate(/area/shuttle/escape_pod5/centcom) - pod.area_transition = locate(/area/shuttle/escape_pod5/transit) - pod.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN - escape_pods += pod + pod = new() + pod.location = 0 + pod.warmup_time = 0 + pod.area_station = locate(/area/shuttle/escape_pod2/station) + pod.area_offsite = locate(/area/shuttle/escape_pod2/centcom) + pod.area_transition = locate(/area/shuttle/escape_pod2/transit) + pod.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN + escape_pods += pod + + pod = new() + pod.location = 0 + pod.warmup_time = 0 + pod.area_station = locate(/area/shuttle/escape_pod3/station) + pod.area_offsite = locate(/area/shuttle/escape_pod3/centcom) + pod.area_transition = locate(/area/shuttle/escape_pod3/transit) + pod.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN + escape_pods += pod + + //There is no pod 4, apparently. + + pod = new() + pod.location = 0 + pod.warmup_time = 0 + pod.area_station = locate(/area/shuttle/escape_pod5/station) + pod.area_offsite = locate(/area/shuttle/escape_pod5/centcom) + pod.area_transition = locate(/area/shuttle/escape_pod5/transit) + pod.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN + escape_pods += pod /datum/shuttle_controller/emergency_shuttle/proc/process() @@ -91,6 +74,7 @@ var/global/datum/shuttle_controller/emergency_shuttle/emergency_shuttle if (auto_recall && can_recall() && world.time >= auto_recall_time) recall() if (world.time >= launch_time) //time to launch the shuttle + wait_for_launch = 0 //set the travel time if (!shuttle.location) //at station @@ -116,17 +100,17 @@ var/global/datum/shuttle_controller/emergency_shuttle/emergency_shuttle //called when the shuttle has arrived. /datum/shuttle_controller/emergency_shuttle/proc/shuttle_arrived() if (!shuttle.location) //at station - launch_time = world.time + SHUTTLE_LEAVETIME + launch_time = world.time + SHUTTLE_LEAVETIME*10 wait_for_launch = 1 //get ready to return -//returns the time left until the shuttle arrives at it's destination, in ticks +//returns the time left until the shuttle arrives at it's destination, in seconds /datum/shuttle_controller/emergency_shuttle/proc/estimate_arrival_time() var/eta = launch_time + shuttle.travel_time - return (eta - world.time) + return (eta - world.time)/10 -//returns the time left until the shuttle launches, in ticks +//returns the time left until the shuttle launches, in seconds /datum/shuttle_controller/emergency_shuttle/proc/estimate_launch_time() - return (launch_time - world.time) + return (launch_time - world.time)/10 /datum/shuttle_controller/emergency_shuttle/proc/has_eta() return (wait_for_launch || shuttle.moving_status != SHUTTLE_IDLE) @@ -173,8 +157,8 @@ var/global/datum/shuttle_controller/emergency_shuttle/emergency_shuttle if(!can_call()) return //set the launch timer - launch_time = world.time + get_shuttle_prep_time() - auto_recall_time = world.time + rand(300,500) + launch_time = world.time + get_shuttle_prep_time()*10 + auto_recall_time = rand(world.time + 300, launch_time - 300) wait_for_launch = 1 evac = 1 @@ -190,7 +174,7 @@ var/global/datum/shuttle_controller/emergency_shuttle/emergency_shuttle //set the launch timer launch_time = world.time + get_shuttle_prep_time() - auto_recall_time = world.time + rand(100,SHUTTLE_PREPTIME-30) + auto_recall_time = rand(world.time + 300, launch_time - 300) wait_for_launch = 1 captain_announce("A crew transfer has been initiated. The shuttle has been called. It will arrive in [round(estimate_arrival_time()/60)] minutes.") diff --git a/code/game/supplyshuttle.dm b/code/game/supplyshuttle.dm index 4ce6d25b7c7..e2dfe3b4423 100644 --- a/code/game/supplyshuttle.dm +++ b/code/game/supplyshuttle.dm @@ -147,19 +147,6 @@ var/list/mechtoys = list( New() ordernum = rand(1,9000) - if ("Supply" in shuttles && istype(shuttles["Supply"], /datum/shuttle/ferry/supply)) - shuttle = shuttles["Supply"] - - //still don't have the shuttle, so create one - if (!shuttle) - shuttle = new/datum/shuttle/ferry/supply() - shuttle.location = 1 - shuttle.warmup_time = 10 - shuttle.area_offsite = locate(/area/supply/dock) - shuttle.area_station = locate(/area/supply/station) - shuttle.docking_controller_tag = "supply_shuttle" - shuttle.dock_target_station = "cargo_bay" - shuttles["Supply"] = shuttle //Supply shuttle ticker - handles supply point regenertion and shuttle travelling between centcomm and the station proc/process() diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index 1ce5b057eeb..ce2a2800bbc 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -883,7 +883,7 @@ Traitors and the like can also be revived with the previous role mostly intact. set category = "Admin" set name = "Call Shuttle" - if ((!( ticker ) || emergency_shuttle.location())) + if ((!( ticker ) || !emergency_shuttle.location())) return if(!check_rights(R_ADMIN)) return diff --git a/code/modules/shuttles/shuttle.dm b/code/modules/shuttles/shuttle.dm index 274597ef4cf..abc02e90f84 100644 --- a/code/modules/shuttles/shuttle.dm +++ b/code/modules/shuttles/shuttle.dm @@ -124,6 +124,33 @@ var/global/list/shuttles shuttles = list() var/datum/shuttle/ferry/shuttle + + // Escape shuttle and pods + shuttle = new/datum/shuttle/ferry/emergency() + shuttle.location = 1 + shuttle.warmup_time = 10 + shuttle.area_offsite = locate(/area/shuttle/escape/centcom) + shuttle.area_station = locate(/area/shuttle/escape/station) + shuttle.area_transition = locate(/area/shuttle/escape/transit) + shuttle.travel_time = SHUTTLE_TRANSIT_DURATION + //shuttle.docking_controller_tag = "supply_shuttle" + //shuttle.dock_target_station = "cargo_bay" + shuttles["Escape"] = shuttle + + emergency_shuttle.shuttle = shuttle + emergency_shuttle.setup_pods() + + // Supply shuttle + shuttle = new/datum/shuttle/ferry/supply() + shuttle.location = 1 + shuttle.warmup_time = 10 + shuttle.area_offsite = locate(/area/supply/dock) + shuttle.area_station = locate(/area/supply/station) + shuttle.docking_controller_tag = "supply_shuttle" + shuttle.dock_target_station = "cargo_bay" + shuttles["Supply"] = shuttle + + supply_controller.shuttle = shuttle // Admin shuttles. shuttle = new() From 81f0f868b462812f14963c32f02ff920d62e71fd Mon Sep 17 00:00:00 2001 From: mwerezak Date: Mon, 23 Jun 2014 01:55:43 -0400 Subject: [PATCH 12/15] Minor shuttle fixes and cleanup Readds the missing "shuttle has left the station" message, improves the ETA calculation and reorganizes the procs in shuttle_controller.dm --- code/controllers/shuttle_controller.dm | 104 +++++++++++---------- code/game/machinery/status_display.dm | 12 +-- code/modules/shuttles/shuttle.dm | 2 +- code/modules/shuttles/shuttle_emergency.dm | 18 ++-- 4 files changed, 74 insertions(+), 62 deletions(-) diff --git a/code/controllers/shuttle_controller.dm b/code/controllers/shuttle_controller.dm index 83baa847104..11678a7d91c 100644 --- a/code/controllers/shuttle_controller.dm +++ b/code/controllers/shuttle_controller.dm @@ -13,7 +13,7 @@ var/global/datum/shuttle_controller/emergency_shuttle/emergency_shuttle /datum/shuttle_controller/emergency_shuttle - var/datum/shuttle/ferry/shuttle + var/datum/shuttle/ferry/emergency/shuttle var/list/escape_pods var/launch_time //the time at which the shuttle will be launched @@ -71,15 +71,13 @@ var/global/datum/shuttle_controller/emergency_shuttle/emergency_shuttle /datum/shuttle_controller/emergency_shuttle/proc/process() if (wait_for_launch) - if (auto_recall && can_recall() && world.time >= auto_recall_time) + if (auto_recall && world.time >= auto_recall_time) recall() if (world.time >= launch_time) //time to launch the shuttle wait_for_launch = 0 //set the travel time - if (!shuttle.location) //at station - departed = 1 //technically we haven't left yet, but this should be good enough - + if (!shuttle.location) //leaving from the station //launch the pods! for (var/datum/shuttle/ferry/escape_pod/pod in escape_pods) pod.launch(src) @@ -103,49 +101,6 @@ var/global/datum/shuttle_controller/emergency_shuttle/emergency_shuttle launch_time = world.time + SHUTTLE_LEAVETIME*10 wait_for_launch = 1 //get ready to return -//returns the time left until the shuttle arrives at it's destination, in seconds -/datum/shuttle_controller/emergency_shuttle/proc/estimate_arrival_time() - var/eta = launch_time + shuttle.travel_time - return (eta - world.time)/10 - -//returns the time left until the shuttle launches, in seconds -/datum/shuttle_controller/emergency_shuttle/proc/estimate_launch_time() - return (launch_time - world.time)/10 - -/datum/shuttle_controller/emergency_shuttle/proc/has_eta() - return (wait_for_launch || shuttle.moving_status != SHUTTLE_IDLE) - -//returns 1 if the shuttle has gone to the station and come back at least once, -//used for game completion checking purposes -/datum/shuttle_controller/emergency_shuttle/proc/returned() - return 0 //TODO - -//returns 1 if the shuttle is not idle at centcom -/datum/shuttle_controller/emergency_shuttle/proc/online() - if (!shuttle.location) //not at centcom - return 1 - if (wait_for_launch || shuttle.moving_status != SHUTTLE_IDLE) - return 1 - return 0 - -//returns 1 if the shuttle is currently in transit (or just leaving) to the station -/datum/shuttle_controller/emergency_shuttle/proc/going_to_station() - return (!shuttle.direction && shuttle.moving_status != SHUTTLE_IDLE) - -//returns 1 if the shuttle is currently in transit (or just leaving) to centcom -/datum/shuttle_controller/emergency_shuttle/proc/going_to_centcom() - return (shuttle.direction && shuttle.moving_status != SHUTTLE_IDLE) - -//returns 1 if the shuttle is docked at the station and waiting to leave -/datum/shuttle_controller/emergency_shuttle/proc/waiting_to_leave() - if (shuttle.location) - return 0 //not at station - if (!wait_for_launch) - return 0 //not going anywhere - if (shuttle.moving_status != SHUTTLE_IDLE) - return 0 //shuttle is doing stuff - return 1 - //so we don't have emergency_shuttle.shuttle.location everywhere /datum/shuttle_controller/emergency_shuttle/proc/location() if (!shuttle) @@ -224,6 +179,59 @@ var/global/datum/shuttle_controller/emergency_shuttle/emergency_shuttle return SHUTTLE_PREPTIME * 3 //15 minutes return SHUTTLE_PREPTIME + + +/* + These procs are not really used by the controller itself, but are for other parts of the + game whose logic depends on the emergency shuttle. +*/ + +//returns the time left until the shuttle arrives at it's destination, in seconds +/datum/shuttle_controller/emergency_shuttle/proc/estimate_arrival_time() + var/eta + if (isnull(shuttle.jump_time)) + eta = launch_time + shuttle.travel_time + else + eta = shuttle.jump_time + shuttle.travel_time + return (eta - world.time)/10 + +//returns the time left until the shuttle launches, in seconds +/datum/shuttle_controller/emergency_shuttle/proc/estimate_launch_time() + return (launch_time - world.time)/10 + +/datum/shuttle_controller/emergency_shuttle/proc/has_eta() + return (wait_for_launch || shuttle.moving_status != SHUTTLE_IDLE) + +//returns 1 if the shuttle has gone to the station and come back at least once, +//used for game completion checking purposes +/datum/shuttle_controller/emergency_shuttle/proc/returned() + return (departed && shuttle.moving_status != SHUTTLE_IDLE && shuttle.location) //we've gone to the station at least once, no longer in transit and are idle back at centcom + +//returns 1 if the shuttle is not idle at centcom +/datum/shuttle_controller/emergency_shuttle/proc/online() + if (!shuttle.location) //not at centcom + return 1 + if (wait_for_launch || shuttle.moving_status != SHUTTLE_IDLE) + return 1 + return 0 + +//returns 1 if the shuttle is currently in transit (or just leaving) to the station +/datum/shuttle_controller/emergency_shuttle/proc/going_to_station() + return (!shuttle.direction && shuttle.moving_status != SHUTTLE_IDLE) + +//returns 1 if the shuttle is currently in transit (or just leaving) to centcom +/datum/shuttle_controller/emergency_shuttle/proc/going_to_centcom() + return (shuttle.direction && shuttle.moving_status != SHUTTLE_IDLE) + +//returns 1 if the shuttle is docked at the station and waiting to leave +/datum/shuttle_controller/emergency_shuttle/proc/waiting_to_leave() + if (shuttle.location) + return 0 //not at station + if (!wait_for_launch) + return 0 //not going anywhere + if (shuttle.moving_status != SHUTTLE_IDLE) + return 0 //shuttle is doing stuff + return 1 /* Some slapped-together star effects for maximum spess immershuns. Basically consists of a diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm index 533460907a1..ea145b54440 100644 --- a/code/game/machinery/status_display.dm +++ b/code/game/machinery/status_display.dm @@ -168,15 +168,15 @@ proc/get_shuttle_timer_arrival() var/timeleft = emergency_shuttle.estimate_arrival_time() - if(timeleft) - return "[add_zero(num2text((timeleft / 60) % 60),2)]:[add_zero(num2text(timeleft % 60), 2)]" - return "" + if(timeleft < 0) + return "" + return "[add_zero(num2text((timeleft / 60) % 60),2)]:[add_zero(num2text(timeleft % 60), 2)]" proc/get_shuttle_timer_departure() var/timeleft = emergency_shuttle.estimate_launch_time() - if(timeleft) - return "[add_zero(num2text((timeleft / 60) % 60),2)]:[add_zero(num2text(timeleft % 60), 2)]" - return "" + if(timeleft < 0) + return "" + return "[add_zero(num2text((timeleft / 60) % 60),2)]:[add_zero(num2text(timeleft % 60), 2)]" proc/get_supply_shuttle_timer() var/datum/shuttle/ferry/supply/shuttle = supply_controller.shuttle diff --git a/code/modules/shuttles/shuttle.dm b/code/modules/shuttles/shuttle.dm index abc02e90f84..3d6e421f5b6 100644 --- a/code/modules/shuttles/shuttle.dm +++ b/code/modules/shuttles/shuttle.dm @@ -101,7 +101,7 @@ var/global/list/shuttles for(var/mob/living/simple_animal/pest in destination) pest.gib() - origin.move_contents_to(destination) + origin.move_contents_to(destination) //might need to use the "direction" argument here, I dunno. for(var/mob/M in destination) if(M.client) diff --git a/code/modules/shuttles/shuttle_emergency.dm b/code/modules/shuttles/shuttle_emergency.dm index a30647e017b..b03734507d4 100644 --- a/code/modules/shuttles/shuttle_emergency.dm +++ b/code/modules/shuttles/shuttle_emergency.dm @@ -1,18 +1,22 @@ - /datum/shuttle/ferry/emergency - //pass + var/jump_time = null //the time at which the shuttle last jumped. Used for ETAs /datum/shuttle/ferry/emergency/arrived() emergency_shuttle.shuttle_arrived() -/* -/datum/shuttle/ferry/emergency/move() +/datum/shuttle/ferry/emergency/move(var/area/origin,var/area/destination) + if (destination == area_transition) + jump_time = world.time + else + jump_time = null + if (!location) //leaving the station emergency_shuttle.departed = 1 - ..() -*/ + captain_announce("The Emergency Shuttle has left the station. Estimate [round(emergency_shuttle.estimate_arrival_time()/60,1)] minutes until the shuttle docks at Central Command.") + ..(origin, destination) + /datum/shuttle/ferry/escape_pod //pass @@ -34,7 +38,7 @@ spawn(0) D.close() - ..(origin, destination) //might need to adjust shuttle/move so that it can take into account the direction argument to area/move_contents_to, I dunno. + ..(origin, destination) for(var/obj/machinery/door/D in destination) spawn(0) From e225661c2c486027b5b9f9b6d864ecd604c26671 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Mon, 23 Jun 2014 02:53:09 -0400 Subject: [PATCH 13/15] Fixes #5193 --- code/modules/mob/living/living.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 4447c5f225c..98659018861 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -431,7 +431,8 @@ else stop_pulling() . = ..() - if ((s_active && !( s_active in contents ) )) + + if (s_active && !( s_active in contents ) && get_turf(s_active) != get_turf(src)) //check !( s_active in contents ) first so we hopefully don't have to call get_turf() so much. s_active.close(src) if(update_slimes) From 3aa3c4166cb7b722c0b3ac22ce7530b44421662a Mon Sep 17 00:00:00 2001 From: Loganbacca Date: Mon, 23 Jun 2014 19:53:58 +1200 Subject: [PATCH 14/15] Cargo train update - Cleans up some old code - Fixes some bugs - Adds keys to start the engine --- code/modules/vehicles/cargo_train.dm | 151 ++++++++++++++++----------- code/modules/vehicles/train.dm | 30 +++--- code/modules/vehicles/vehicle.dm | 8 +- icons/obj/vehicles.dmi | Bin 6970 -> 7183 bytes 4 files changed, 110 insertions(+), 79 deletions(-) diff --git a/code/modules/vehicles/cargo_train.dm b/code/modules/vehicles/cargo_train.dm index f3d56b48670..ba6318588ff 100644 --- a/code/modules/vehicles/cargo_train.dm +++ b/code/modules/vehicles/cargo_train.dm @@ -1,8 +1,9 @@ /obj/vehicle/train/cargo/engine name = "cargo train tug" + desc = "A ridable electric car designed for pulling cargo trolleys." icon = 'icons/obj/aibots.dmi' icon_state = "mulebot1" //mulebot icons until I get some proper icons - on = 1 + on = 0 powered = 1 locked = 0 @@ -13,6 +14,14 @@ var/car_limit = 3 //how many cars an engine can pull before performance degrades active_engines = 1 + var/obj/item/weapon/key/cargo_train/key + +/obj/item/weapon/key/cargo_train + name = "key" + desc = "A keyring with a small steel key, and a yellow fob reading \"Choo Choo!\"." + icon = 'icons/obj/vehicles.dmi' + icon_state = "train_keys" + w_class = 1 /obj/vehicle/train/cargo/trolley name = "cargo train trolley" @@ -34,16 +43,14 @@ ..() cell = new /obj/item/weapon/cell/high verbs -= /atom/movable/verb/pull - -/obj/vehicle/train/cargo/engine/initialize() - ..() + key = new() /obj/vehicle/train/cargo/engine/Move() if(on && cell.charge < power_use) turn_off() update_stats() if(load && is_train_head()) - load << "The drive motor briefly whines, then crawls to a stop." + load << "The drive motor briefly whines, then drones to a stop." if(is_train_head() && !on) return 0 @@ -57,6 +64,16 @@ else ..() +/obj/vehicle/train/cargo/engine/attackby(obj/item/weapon/W as obj, mob/user as mob) + if(istype(W, /obj/item/weapon/key/cargo_train)) + if(!key) + user.drop_item() + key = W + W.loc = src + verbs += /obj/vehicle/train/cargo/engine/verb/remove_key + return + ..() + /obj/vehicle/train/cargo/update_icon() if(open) icon_state = "mulebot-hatch" @@ -94,6 +111,13 @@ //------------------------------------------- // Train procs //------------------------------------------- +/obj/vehicle/train/cargo/engine/turn_on() + if(!key) + return + else + ..() + update_stats() + /obj/vehicle/train/cargo/RunOver(var/mob/living/carbon/human/H) var/list/parts = list("head", "chest", "l_leg", "r_leg", "l_arm", "r_arm") @@ -121,39 +145,6 @@ //------------------------------------------- // Interaction procs //------------------------------------------- -/obj/vehicle/train/cargo/trolley/verb/rotate() - set name = "Rotate" - set category = "Object" - set src in view(1) - - if(anchored) - usr << "You cannot turn the trolley while it is latched onto a train." - return - - var/cur_dir = null - switch(dir) - if(NORTH) - cur_dir = "North" - if(SOUTH) - cur_dir = "South" - if(EAST) - cur_dir = "East" - if(WEST) - cur_dir = "West" - - var/new_dir = input("Select a new direction:", "Rotate", cur_dir) in list("North", "South", "East", "West") - - switch(new_dir) - if("North") - dir = NORTH - if("South") - dir = SOUTH - if("East") - dir = EAST - if("West") - dir = WEST - - /obj/vehicle/train/cargo/engine/relaymove(mob/user, direction) if(user != load) return 0 @@ -167,24 +158,37 @@ else return ..() -/obj/vehicle/train/cargo/engine/verb/climb_down(mob/user as mob) - set name = "Exit vehicle" - set category = "Object" - set src in range(0) - - if(!load) - return - if(user != load) - return - - unload(user) +/obj/vehicle/train/cargo/engine/examine() + ..() + if(!istype(usr, /mob/living/carbon/human)) + return + + if(get_dist(usr,src) <= 1) + usr << "The power light is [on ? "on" : "off"].\nThere are[key ? "" : " no"] keys in the ignition." + +/obj/vehicle/train/cargo/engine/verb/check_power() + set name = "Check power level" + set category = "Object" + set src in view(1) + + if(!istype(usr, /mob/living/carbon/human)) + return + + if(!cell) + usr << "There is no power cell installed in [src]." + return + + usr << "The power meter reads [round(cell.percent(), 0.01)]%" /obj/vehicle/train/cargo/engine/verb/start_engine() set name = "Start engine" set category = "Object" set src in view(1) + if(!istype(usr, /mob/living/carbon/human)) + return + if(on) usr << "The engine is already running." return @@ -203,6 +207,9 @@ set category = "Object" set src in view(1) + if(!istype(usr, /mob/living/carbon/human)) + return + if(!on) usr << "The engine is already stopped." return @@ -211,20 +218,26 @@ if (!on) usr << "You stop [src]'s engine." -//------------------------------------------- -// Latching/unlatching procs -//------------------------------------------- -/obj/vehicle/train/cargo/trolley/attach_to(obj/vehicle/train/T, mob/user) - ..() - if (lead) - //This is now part of a train, anchor it so it cant be pushed around - anchored = 1 +/obj/vehicle/train/cargo/engine/verb/remove_key() + set name = "Remove key" + set category = "Object" + set src in view(1) -/obj/vehicle/train/cargo/trolley/unattach(mob/user) - ..() - if (!lead && !tow) - //if this carriage isn't part of a train anymore; unanchor it so it can be pushed around - anchored = 0 + if(!istype(usr, /mob/living/carbon/human)) + return + + if(!key || (load && load != usr)) + return + + if(on) + turn_off() + + key.loc = usr.loc + if(!usr.get_active_hand()) + usr.put_in_hands(key) + key = null + + verbs -= /obj/vehicle/train/cargo/engine/verb/remove_key //------------------------------------------- // Loading/unloading procs @@ -260,9 +273,21 @@ update_move_delay() +/obj/vehicle/train/cargo/trolley/update_train_stats() + ..() + + if(!lead && !tow) + anchored = 0 + if(verbs.Find(/atom/movable/verb/pull)) + return + else + verbs += /atom/movable/verb/pull + else + anchored = 1 + verbs -= /atom/movable/verb/pull /obj/vehicle/train/cargo/engine/proc/update_move_delay() - if(!is_train_head()) + if(!is_train_head() || !on) move_delay = initial(move_delay) //so that engines that have been turned off don't lag behind else move_delay = max(0, (-car_limit * active_engines) + train_length - active_engines) //limits base overweight so you cant overspeed trains diff --git a/code/modules/vehicles/train.dm b/code/modules/vehicles/train.dm index b1c725214ff..faad42d1cc2 100644 --- a/code/modules/vehicles/train.dm +++ b/code/modules/vehicles/train.dm @@ -67,8 +67,9 @@ return 0 if(user != load) - if(user in src) //for handling players stuck in src - unload(user, direction, 1) + if(user in src) //for handling players stuck in src - this shouldn't happen - but just in case it does + user.loc = T + contents -= user return 1 return 0 @@ -81,19 +82,19 @@ /obj/vehicle/train/MouseDrop_T(var/atom/movable/C, mob/user as mob) if(!usr.canmove || usr.stat || usr.restrained() || !Adjacent(usr) || !user.Adjacent(C)) return - if(istype(C,/obj/vehicle/train)) - latch(C) + latch(C, user) else if(!load(C)) user << "\red You were unable to load [C] on [src]." /obj/vehicle/train/attack_hand(mob/user as mob) - if(!user.canmove || user.stat || user.restrained() || !Adjacent(user)) + if(user.stat || user.restrained() || !Adjacent(user)) return 0 if(user != load && (user in src)) - unload(user, null, 1) //for handling players stuck in src + user.loc = loc //for handling players stuck in src + contents -= user else if(load) unload(user) //unload if loaded else if(!load) @@ -106,6 +107,9 @@ set desc = "Unhitches this train from the one in front of it." set category = "Object" set src in view(1) + + if(!istype(usr, /mob/living/carbon/human)) + return if(!usr.canmove || usr.stat || usr.restrained() || !Adjacent(usr)) return @@ -130,12 +134,13 @@ if (T.tow) user << "\red [T] is already towing something." return - //latch with src as the follower lead = T T.tow = src + dir = lead.dir - user << "\blue You hitch [src] to [T]." + if(user) + user << "\blue You hitch [src] to [T]." update_stats() @@ -152,15 +157,12 @@ user << "\blue You unhitch [src] from [lead]." lead = null -/obj/vehicle/train/proc/latch(mob/user, obj/vehicle/train/T) + update_stats() + +/obj/vehicle/train/proc/latch(obj/vehicle/train/T, mob/user) if(!istype(T) || !Adjacent(T)) return 0 - /* --- commented out until we get directional sprites --- - if(dir != T.dir) //cars need to be inline to latch - return 0 - */ - var/T_dir = get_dir(src, T) //figure out where T is wrt src if(dir == T_dir) //if car is ahead diff --git a/code/modules/vehicles/vehicle.dm b/code/modules/vehicles/vehicle.dm index 416cd159ce6..27ce16d113d 100644 --- a/code/modules/vehicles/vehicle.dm +++ b/code/modules/vehicles/vehicle.dm @@ -1,7 +1,7 @@ /obj/vehicle name = "vehicle" icon = 'icons/obj/vehicles.dmi' - layer = OBJ_LAYER - 0.1 //so it sits below objects + layer = MOB_LAYER + 0.1 //so it sits above objects including mobs density = 1 anchored = 1 animate_movement=1 @@ -275,6 +275,7 @@ if(load_item_visible) C.pixel_x += load_offset_x C.pixel_y += load_offset_y + C.layer = layer + 0.1 //so it sits above the vehicle if(ismob(C)) var/mob/M = C @@ -284,7 +285,10 @@ return 1 -/obj/vehicle/proc/unload(var/mob/user, var/direction, var/exception = 0) +/obj/vehicle/proc/unload(var/mob/user, var/direction) + if(!load) + return + var/turf/dest = null //find a turf to unload to diff --git a/icons/obj/vehicles.dmi b/icons/obj/vehicles.dmi index fd6daee8bd4b59531061149219c3ccd5e641631f..699a37298359c7275f214f65755bc33340922cd8 100644 GIT binary patch literal 7183 zcmZ8`by!s07w#ECIvl!Y08v^RksP{1I;5mSFcENop`=S1=>{oDg+aQN5J3cKkknzw zq3`kc-GAl#~YrSi&ckeSN%0N$@f|QvQ000V24HZLhMEz^TH^9C}-hKoe z3jB@DU#K`ecX;OZ>>VGJl7eRx zQPt$By-TW>Cl%*2Y;nyM80XQn2+Sa4UUxfrt}m42BY~)|cO9q1 zX9iz%J$w6DqM@N{lq)j@FNx7Ev)K)OL(P?0wlX<>f?8BhY)d#;kvY4R=^He8bhP{r zRQruxFvs@-D-{Q;$~ZcCEi#{B_3r)SgpKC`ivjSr0yJ-Nm(Jq;nE8a~3vwH|um29n zq`8VmW20RgE5ENtA2}!gz?^9RoSyss-H}PoEKl&Ub~7ovXcvvB77PC`fivS*CMKy~ zu!I48K!Xb!Ij|bp_sF4}NPlkYMYmTAKG3~f=au=;&BYja#7RraoBO)m#-}=6l0Jlb ziyKM;AcPqm{gCo-pza1U|5;#%ZDnO;$iS-o3%}mgr&2k3KDzATjDqkLnFG9ytqBRL zw)yxcQnBU&X>{|NnT$8XwVz0_wyu}Q{@6*~zZpUw&^A9Bw){kDd}^vMH{o^w6i=dl z?vH74nIZ3;7cFyNahwopxaoVkU+q?z#W|T^CbF*ZzA+ISFZ~nYj#FV=#7t|i( z*<@*gyq}}j`$zLM=qiUahIuzxGCgpoy<$o*;7OUpIjPtdE0PZK7iPFL9#(9e zBjrENd#UDB7?V~QNAq&<=1#dg`N_ekvh}#TmxT>0Xz_vp&Lj;rdCsIrT4I8Xy&OGm zSy)1$SFST>lHJAL<0YTA<%3fL5K!!;1RY9f?Z`j#&OU`=_r~iRB@sRLebhaVY7hg;gn{HHXk_<^uWYLvYoef$EX?IX zh4UsM+^dB}uS~26T29*uhLti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du_I3>E&RE+U-->{kDvLkBjQA;5Fp~@rTo{)TY)Xh z@07IedPnN$M$Opt+bq%I&9u|H4BQ|}{pv+lERu7!VVNB0n2t55e$&ZLe{&|%in^r2 zNq*5e!;o6&e_cMR6!J@PHuTNnUn;NPc&e-`A4l(2_*!x!w6w_owx7IcDpMsyEH9l$ z;BqTtwz8sF0b+*h?-3gUOCjNSSJ-0>#WBONC~!#t@R0%x#B<|gg)P44(d?fM&CV%j z7{MPJDB5U1x_f&(8)j6&O4ZoQ($Ft|glDVgCNn`%QPG|FtWlc%p`(}bU2_~w!WTO~ zdQJ${;AUoK2rImE)5Xuudul3Uq3?!TpEX6xoEFIcxjML8IVJX+Ys}*yWwF1w#Zyfv z7A8{Ymz&G>-OJLlf2;v7+H6lPyb4q~n;LQ>4Kmr@I}L2pVUTJ}xPSos>prf}kj%0= zkR*vx4)i?)ZadGi0S>A6aEXYk&enP0Uj7((!|zGX-LvT$Cel|o$MAs+cO!CRzD@Xz zNp=G4vOAz0Nj+-Xrr|2k(No`@7ab@MGj${BXB*oTE$=u9N~i8!i?D`h%77th0q$a@c(FR_g!tivQ0|{+EFD71c8su8RFY3;r1fJd; Date: Mon, 23 Jun 2014 21:44:51 +1200 Subject: [PATCH 15/15] Fixes incorrect cable coil colours --- code/modules/power/cable.dm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index d64dd4ccfb3..e693cc11f13 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -228,6 +228,8 @@ src.amount = length if (param_color) color = param_color + else + color = item_color pixel_x = rand(-2,2) pixel_y = rand(-2,2) updateicon() @@ -236,6 +238,7 @@ /obj/item/weapon/cable_coil/proc/updateicon() if (!color) color = pick(COLOR_RED, COLOR_BLUE, COLOR_GREEN, COLOR_ORANGE, COLOR_WHITE, COLOR_PINK, COLOR_YELLOW, COLOR_CYAN) + item_color = color if(amount == 1) icon_state = "coil1" name = "cable piece"