Adds podbay doors to the pods that can be opened using the button, or from within the pod. Also includes other map fixes.

This commit is contained in:
Markolie
2014-11-23 22:44:00 +01:00
parent 8e44118a78
commit 3a9d45c2d6
11 changed files with 481 additions and 258 deletions
@@ -1,222 +0,0 @@
/obj/structure/spacepod_frame
density = 1
opacity = 0
anchored = 1
layer = 3.9
icon = 'icons/48x48/pod_construction.dmi'
icon_state = "pod_1"
var/datum/construction/construct
/obj/structure/spacepod_frame/New()
..()
bound_width = 64
bound_height = 64
construct = new /datum/construction/reversible2/pod(src)
dir = EAST
/obj/structure/spacepod_frame/attackby(obj/item/W as obj, mob/user as mob)
if(!construct || !construct.action(W, user))
..()
return
/obj/structure/spacepod_frame/attack_hand()
return
/////////////////////////////////
// CONSTRUCTION STEPS
/////////////////////////////////
/datum/construction/reversible2/pod
result = /obj/spacepod/civilian
base_icon="pod"
//taskpath = /datum/job_objective/make_pod
steps = list(
// 1. Initial state
list(
"desc" = "An empty pod frame.",
state_next = list(
"key" = /obj/item/stack/cable_coil,
"vis_msg" = "{USER} wires the {HOLDER}.",
"self_msg" = "You wire the {HOLDER}."
)
),
// 2. Crudely Wired
list(
"desc" = "A crudely-wired pod frame.",
state_prev = list(
"key" = /obj/item/weapon/wirecutters,
"vis_msg" = "{USER} cuts out the {HOLDER}'s wiring.",
"self_msg" = "You remove the {HOLDER}'s wiring."
),
state_next = list(
"key" = /obj/item/weapon/screwdriver,
"vis_msg" = "{USER} adjusts the wiring.",
"self_msg" = "You adjust the {HOLDER}'s wiring."
)
),
// 3. Cleanly wired
list(
"desc" = "A wired pod frame.",
state_prev = list(
"key" = /obj/item/weapon/screwdriver,
"vis_msg" = "{USER} unclips {HOLDER}'s wiring harnesses.",
"self_msg" = "You unclip {HOLDER}'s wiring harnesses."
),
state_next = list(
"key" = /obj/item/weapon/circuitboard/mecha/pod,
"vis_msg" = "{USER} inserts the mainboard into the {HOLDER}.",
"self_msg" = "You insert the mainboard into the {HOLDER}.",
"delete" = 1
)
),
// 4. Circuit added
list(
"desc" = "A wired pod frame with a loose mainboard.",
state_prev = list(
"key" = /obj/item/weapon/crowbar,
"vis_msg" = "{USER} pries out the mainboard.",
"self_msg" = "You pry out the mainboard.",
"spawn" = /obj/item/weapon/circuitboard/mecha/pod,
"amount" = 1
),
state_next = list(
"key" = /obj/item/weapon/screwdriver,
"vis_msg" = "{USER} secures the mainboard.",
"self_msg" = "You secure the mainboard."
)
),
// 5. Circuit secured
list(
"desc" = "A wired pod frame with a secured mainboard.",
state_prev = list(
"key" = /obj/item/weapon/screwdriver,
"vis_msg" = "{USER} unsecures the mainboard.",
"self_msg" = "You unscrew the mainboard from the {HOLDER}."
),
state_next = list(
"key" = /obj/item/pod_parts/core,
"vis_msg" = "{USER} inserts the core into the {HOLDER}.",
"self_msg" = "You carefully insert the core into the {HOLDER}.",
"delete" = 1
)
),
// 6. Core inserted
list(
"desc" = "A naked space pod with a loose core.",
state_prev = list(
"key" = /obj/item/weapon/crowbar,
"vis_msg" = "{USER} delicately removes the core from the {HOLDER} with a crowbar.",
"self_msg" = "You delicately remove the core from the {HOLDER} with a crowbar.",
"spawn" = /obj/item/pod_parts/core,
"amount" = 1
),
state_next = list(
"key" = /obj/item/weapon/wrench,
"vis_msg" = "{USER} secures the core's bolts.",
"self_msg" = "You secure the core's bolts."
)
),
// 7. Core secured
list(
"desc" = "A naked space pod with an exposed core. How lewd.",
state_prev = list(
"key" = /obj/item/weapon/wrench,
"vis_msg" = "{USER} unsecures the {HOLDER}'s core.",
"self_msg" = "You unsecure the {HOLDER}'s core."
),
state_next = list(
"key" = /obj/item/stack/sheet/metal,
"amount" = 5,
"vis_msg" = "{USER} frabricates a pressure bulkhead for the {HOLDER}.",
"self_msg" = "You frabricate a pressure bulkhead for the {HOLDER}."
)
),
// 8. Bulkhead added
list(
"desc" = "A space pod with loose bulkhead panelling exposed.",
state_prev = list(
"key" = /obj/item/weapon/crowbar,
"vis_msg" = "{USER} pops the {HOLDER}'s bulkhead panelling loose.",
"self_msg" = "You pop the {HOLDER}'s bulkhead panelling loose.",
"spawn" = /obj/item/stack/sheet/metal,
"amount" = 5,
),
state_next = list(
"key" = /obj/item/weapon/wrench,
"vis_msg" = "{USER} secures the {HOLDER}'s bulkhead panelling.",
"self_msg" = "You secure the {HOLDER}'s bulkhead panelling."
)
),
// 9. Bulkhead secured with bolts
list(
"desc" = "A space pod with unwelded bulkhead panelling exposed.",
state_prev = list(
"key" = /obj/item/weapon/wrench,
"vis_msg" = "{USER} unbolts the {HOLDER}'s bulkhead panelling.",
"self_msg" = "You unbolt the {HOLDER}'s bulkhead panelling."
),
state_next = list(
"key" = /obj/item/weapon/weldingtool,
"vis_msg" = "{USER} seals the {HOLDER}'s bulkhead panelling with a weld.",
"self_msg" = "You seal the {HOLDER}'s bulkhead panelling with a weld."
)
),
// 10. Welded bulkhead
list(
"desc" = "A space pod with sealed bulkhead panelling exposed.",
state_prev = list(
"key" = /obj/item/weapon/weldingtool,
"vis_msg" = "{USER} cuts the {HOLDER}'s bulkhead panelling loose.",
"self_msg" = "You cut the {HOLDER}'s bulkhead panelling loose."
),
state_next = list(
"key" = /obj/item/stack/sheet/plasteel,
"amount" = 5,
"vis_msg" = "{USER} installs the {HOLDER}'s plasteel armor.",
"self_msg" = "You install the {HOLDER}'s plasteel armor."
)
),
// 11. Loose armor
list(
"desc" = "A space pod with unsecured armor.",
state_prev = list(
"key" = /obj/item/weapon/crowbar,
"vis_msg" = "{USER} pries off {HOLDER}'s armor.",
"self_msg" = "You pry off {HOLDER}'s armor."
),
state_next = list(
"key" = /obj/item/weapon/wrench,
"vis_msg" = "{USER} bolts down the {HOLDER}'s armor.",
"self_msg" = "You bolt down the {HOLDER}'s armor."
)
),
// 12. Bolted-down armor
list(
"desc" = "A space pod with unsecured armor.",
state_prev = list(
"key" = /obj/item/weapon/wrench,
"vis_msg" = "{USER} unsecures the {HOLDER}'s armor.",
"self_msg" = "You unsecure the {HOLDER}'s armor."
),
state_next = list(
"key" = /obj/item/weapon/weldingtool,
"vis_msg" = "{USER} welds the {HOLDER}'s armor.",
"self_msg" = "You weld the {HOLDER}'s armor."
)
)
// EOF
)
spawn_result(mob/user as mob)
..()
feedback_inc("spacepod_created",1)
return
@@ -1,113 +0,0 @@
/obj/item/device/spacepod_equipment/weaponry/proc/fire_weapons()
if(my_atom.next_firetime > world.time)
usr << "<span class='warning'>Your weapons are recharging.</span>"
return
var/turf/firstloc
var/turf/secondloc
if(!my_atom.equipment_system || !my_atom.equipment_system.weapon_system)
usr << "<span class='warning'>Missing equipment or weapons.</span>"
my_atom.verbs -= text2path("[type]/proc/fire_weapons")
return
my_atom.battery.use(shot_cost)
var/olddir
for(var/i = 0; i < shots_per; i++)
if(olddir != dir)
switch(dir)
if(NORTH)
firstloc = get_step(src, NORTH)
secondloc = get_step(firstloc,EAST)
if(SOUTH)
firstloc = get_turf(src)
secondloc = get_step(firstloc,EAST)
if(EAST)
firstloc = get_turf(src)
firstloc = get_step(firstloc, EAST)
secondloc = get_step(firstloc,NORTH)
if(WEST)
firstloc = get_turf(src)
secondloc = get_step(firstloc,NORTH)
olddir = dir
var/obj/item/projectile/projone = new projectile_type(firstloc)
var/obj/item/projectile/projtwo = new projectile_type(secondloc)
projone.starting = get_turf(src)
projone.shot_from = src
projone.firer = usr
projone.def_zone = "chest"
projtwo.starting = get_turf(src)
projtwo.shot_from = src
projtwo.firer = usr
projtwo.def_zone = "chest"
spawn()
playsound(src, fire_sound, 50, 1)
projone.dumbfire(dir)
projtwo.dumbfire(dir)
sleep(1)
my_atom.next_firetime = world.time + fire_delay
/datum/spacepod/equipment
var/obj/spacepod/my_atom
var/obj/item/device/spacepod_equipment/weaponry/weapon_system // weapons system
//var/obj/item/device/spacepod_equipment/engine/engine_system // engine system
//var/obj/item/device/spacepod_equipment/shield/shield_system // shielding system
/datum/spacepod/equipment/New(var/obj/spacepod/SP)
..()
if(istype(SP))
my_atom = SP
/obj/item/device/spacepod_equipment
name = "equipment"
var/obj/spacepod/my_atom
// base item for spacepod weapons
/obj/item/device/spacepod_equipment/weaponry
name = "pod weapon"
desc = "You shouldn't be seeing this"
icon = 'icons/pods/ship.dmi'
icon_state = "blank"
var/projectile_type
var/shot_cost = 0
var/shots_per = 1
var/fire_sound
var/fire_delay = 10
/obj/item/device/spacepod_equipment/weaponry/taser
name = "\improper taser system"
desc = "A weak taser system for space pods, fires electrodes that shock upon impact."
icon_state = "pod_taser"
projectile_type = "/obj/item/projectile/energy/electrode"
shot_cost = 10
fire_sound = "sound/weapons/Taser.ogg"
/obj/item/device/spacepod_equipment/weaponry/taser/proc/fire_weapon_system()
set category = "Spacepod"
set name = "Fire Taser System"
set desc = "Fire ze tasers!"
set src = usr.loc
fire_weapons()
/obj/item/device/spacepod_equipment/weaponry/taser/burst
name = "\improper taser system"
desc = "A weak taser system for space pods, this one fires 3 at a time."
icon_state = "pod_b_taser"
shot_cost = 20
shots_per = 3
/obj/item/device/spacepod_equipment/weaponry/laser
name = "\improper laser system"
desc = "A weak laser system for space pods, fires concentrated bursts of energy"
icon_state = "pod_w_laser"
projectile_type = "/obj/item/projectile/beam"
shot_cost = 15
fire_sound = 'sound/weapons/Laser.ogg'
fire_delay = 25
/obj/item/device/spacepod_equipment/weaponry/laser/proc/fire_weapon_system()
set category = "Spacepod"
set name = "Fire Laser System"
set desc = "Fire ze lasers!"
set src = usr.loc
fire_weapons()
@@ -1,10 +0,0 @@
/obj/item/pod_parts
parent_type = /obj/item/mecha_parts
icon = 'icons/pods/equipment.dmi'
/obj/item/pod_parts/core
name="Space Pod Core"
icon_state = "core"
construction_cost = list("iron"=5000,"uranium"=1000,"plasma"=5000)
flags = FPRINT | CONDUCT
origin_tech = "programming=2;materials=3;bluespace=2;engineering=3"
@@ -1,493 +0,0 @@
// honk
#define DAMAGE 1
#define FIRE 2
/obj/spacepod
name = "\improper space pod"
desc = "A space pod meant for space travel."
icon = 'icons/48x48/pods.dmi'
density = 1 //Dense. To raise the heat.
opacity = 0
anchored = 1
unacidable = 1
layer = 3.9
infra_luminosity = 15
var/mob/living/carbon/occupant
var/datum/spacepod/equipment/equipment_system
var/obj/item/weapon/cell/high/battery
var/datum/gas_mixture/cabin_air
var/obj/machinery/portable_atmospherics/canister/internal_tank
var/datum/effect/effect/system/ion_trail_follow/space_trail/ion_trail
var/use_internal_tank = 0
var/datum/global_iterator/pr_int_temp_processor //normalizes internal air mixture temperature
var/datum/global_iterator/pr_give_air //moves air from tank to cabin
var/inertia_dir = 0
var/hatch_open = 0
var/next_firetime = 0
var/list/pod_overlays
var/health = 400
/obj/spacepod/New()
. = ..()
if(!pod_overlays)
pod_overlays = new/list(2)
pod_overlays[DAMAGE] = image(icon, icon_state="pod_damage")
pod_overlays[FIRE] = image(icon, icon_state="pod_fire")
bound_width = 64
bound_height = 64
dir = EAST
battery = new()
add_cabin()
add_airtank()
src.ion_trail = new /datum/effect/effect/system/ion_trail_follow/space_trail()
src.ion_trail.set_up(src)
src.ion_trail.start()
src.use_internal_tank = 1
pr_int_temp_processor = new /datum/global_iterator/pod_preserve_temp(list(src))
pr_give_air = new /datum/global_iterator/pod_tank_give_air(list(src))
equipment_system = new(src)
/obj/spacepod/proc/update_icons()
if(!pod_overlays)
pod_overlays = new/list(2)
pod_overlays[DAMAGE] = image(icon, icon_state="pod_damage")
pod_overlays[FIRE] = image(icon, icon_state="pod_fire")
if(health <= round(initial(health)/2))
overlays += pod_overlays[DAMAGE]
if(health <= round(initial(health)/4))
overlays += pod_overlays[FIRE]
else
overlays -= pod_overlays[FIRE]
else
overlays -= pod_overlays[DAMAGE]
/obj/spacepod/bullet_act(var/obj/item/projectile/P)
if(P.damage && !P.nodamage)
deal_damage(P.damage)
/obj/spacepod/proc/deal_damage(var/damage)
var/oldhealth = health
health = max(0, health - damage)
var/percentage = (health / initial(health)) * 100
if(occupant && oldhealth > health && percentage <= 25 && percentage > 0)
var/sound/S = sound('sound/effects/engine_alert2.ogg')
S.wait = 0 //No queue
S.channel = 0 //Any channel
S.volume = 50
occupant << S
if(occupant && oldhealth > health && !health)
var/sound/S = sound('sound/effects/engine_alert1.ogg')
S.wait = 0
S.channel = 0
S.volume = 50
occupant << S
if(!health)
spawn(0)
if(occupant)
occupant << "<big><span class='warning'>Critical damage to the vessel detected, core explosion imminent!</span></big>"
for(var/i = 10, i >= 0; --i)
if(occupant)
occupant << "<span class='warning'>[i]</span>"
if(i == 0)
explosion(loc, 2, 4, 8)
sleep(10)
update_icons()
/obj/spacepod/ex_act(severity)
switch(severity)
if(1)
var/mob/living/carbon/human/H = occupant
if(H)
H.loc = get_turf(src)
H.ex_act(severity + 1)
H << "<span class='warning'>You are forcefully thrown from \the [src]!</span>"
del(ion_trail)
del(src)
if(2)
deal_damage(100)
if(3)
if(prob(40))
deal_damage(50)
/obj/spacepod/attackby(obj/item/W as obj, mob/user as mob)
if(iscrowbar(W))
hatch_open = !hatch_open
user << "<span class='notice'>You [hatch_open ? "open" : "close"] the maintenance hatch.</span>"
if(istype(W, /obj/item/weapon/cell))
if(!hatch_open)
return ..()
if(battery)
user << "<span class='notice'>The pod already has a battery.</span>"
return
user.drop_item(W)
battery = W
W.loc = src
return
if(istype(W, /obj/item/device/spacepod_equipment))
if(!hatch_open)
return ..()
if(!equipment_system)
user << "<span class='warning'>The pod has no equipment datum, yell at pomf</span>"
return
if(istype(W, /obj/item/device/spacepod_equipment/weaponry))
if(equipment_system.weapon_system)
user << "<span class='notice'>The pod already has a weapon system, remove it first.</span>"
return
else
user << "<span class='notice'>You insert \the [W] into the equipment system.</span>"
user.drop_item(W)
W.loc = equipment_system
equipment_system.weapon_system = W
equipment_system.weapon_system.my_atom = src
var/path = text2path("[W.type]/proc/fire_weapon_system")
if(path)
verbs += path//obj/spacepod/proc/fire_weapons
return
/obj/spacepod/attack_hand(mob/user as mob)
if(!hatch_open)
return ..()
if(!equipment_system || !istype(equipment_system))
user << "<span class='warning'>The pod has no equpment datum, or is the wrong type, yell at pomf.</span>"
return
var/list/possible = list()
if(battery)
possible.Add("Energy Cell")
if(equipment_system.weapon_system)
possible.Add("Weapon System")
/* Not yet implemented
if(equipment_system.engine_system)
possible.Add("Engine System")
if(equipment_system.shield_system)
possible.Add("Shield System")
*/
var/obj/item/device/spacepod_equipment/SPE
switch(input(user, "Remove which equipment?", null, null) as null|anything in possible)
if("Energy Cell")
if(user.put_in_any_hand_if_possible(battery))
user << "<span class='notice'>You remove \the [battery] from the space pod</span>"
battery = null
if("Weapon System")
SPE = equipment_system.weapon_system
if(user.put_in_any_hand_if_possible(SPE))
user << "<span class='notice'>You remove \the [SPE] from the equipment system.</span>"
SPE.my_atom = null
equipment_system.weapon_system = null
else
user << "<span class='warning'>You need an open hand to do that.</span>"
/*
if("engine system")
SPE = equipment_system.engine_system
if(user.put_in_any_hand_if_possible(SPE))
user << "<span class='notice'>You remove \the [SPE] from the equipment system.</span>"
equipment_system.engine_system = null
else
user << "<span class='warning'>You need an open hand to do that.</span>"
if("shield system")
SPE = equipment_system.shield_system
if(user.put_in_any_hand_if_possible(SPE))
user << "<span class='notice'>You remove \the [SPE] from the equipment system.</span>"
equipment_system.shield_system = null
else
user << "<span class='warning'>You need an open hand to do that.</span>"
*/
return
/obj/spacepod/civilian
icon_state = "pod_civ"
desc = "A sleek civilian space pod."
/obj/spacepod/random
icon_state = "pod_civ"
// placeholder
/obj/spacepod/sec
name = "\improper security spacepod"
desc = "An armed security spacepod."
icon_state = "pod_mil"
/obj/spacepod/sec/New()
..()
var/obj/item/device/spacepod_equipment/weaponry/taser/burst/T = new /obj/item/device/spacepod_equipment/weaponry/taser/burst
T.loc = equipment_system
equipment_system.weapon_system = T
equipment_system.weapon_system.my_atom = T
var/path = text2path("[T.type]/proc/fire_weapon_system")
if(path)
verbs += path//obj/spacepod/proc/fire_weapons
return
/obj/spacepod/random/New()
..()
icon_state = pick("pod_civ", "pod_black", "pod_mil", "pod_synd", "pod_gold", "pod_industrial")
switch(icon_state)
if("pod_civ")
desc = "A sleek civilian space pod."
if("pod_black")
desc = "An all black space pod with no insignias."
if("pod_mil")
desc = "A dark grey space pod brandishing the Nanotrasen Military insignia"
if("pod_synd")
desc = "A menacing military space pod with Fuck NT stenciled onto the side"
if("pod_gold")
desc = "A civilian space pod with a gold body, must have cost somebody a pretty penny"
if("pod_industrial")
desc = "A rough looking space pod meant for industrial work"
/obj/spacepod/verb/toggle_internal_tank()
set name = "Toggle internal airtank usage"
set category = "Spacepod"
set src = usr.loc
set popup_menu = 0
if(usr!=src.occupant)
return
use_internal_tank = !use_internal_tank
src.occupant << "<span class='notice'>Now taking air from [use_internal_tank?"internal airtank":"environment"].</span>"
return
/obj/spacepod/proc/add_cabin()
cabin_air = new
cabin_air.temperature = T20C
cabin_air.volume = 200
cabin_air.oxygen = O2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature)
cabin_air.nitrogen = N2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature)
return cabin_air
/obj/spacepod/proc/add_airtank()
internal_tank = new /obj/machinery/portable_atmospherics/canister/air(src)
return internal_tank
/obj/spacepod/proc/get_turf_air()
var/turf/T = get_turf(src)
if(T)
. = T.return_air()
return
/obj/spacepod/remove_air(amount)
if(use_internal_tank)
return cabin_air.remove(amount)
else
var/turf/T = get_turf(src)
if(T)
return T.remove_air(amount)
return
/obj/spacepod/return_air()
if(use_internal_tank)
return cabin_air
return get_turf_air()
/obj/spacepod/proc/return_pressure()
. = 0
if(use_internal_tank)
. = cabin_air.return_pressure()
else
var/datum/gas_mixture/t_air = get_turf_air()
if(t_air)
. = t_air.return_pressure()
return
/obj/spacepod/proc/return_temperature()
. = 0
if(use_internal_tank)
. = cabin_air.return_temperature()
else
var/datum/gas_mixture/t_air = get_turf_air()
if(t_air)
. = t_air.return_temperature()
return
/obj/spacepod/proc/moved_inside(var/mob/living/carbon/human/H as mob)
if(H && H.client && H in range(1))
H.reset_view(src)
/*
H.client.perspective = EYE_PERSPECTIVE
H.client.eye = src
*/
H.stop_pulling()
H.forceMove(src)
src.occupant = H
src.add_fingerprint(H)
src.forceMove(src.loc)
//dir = dir_in
playsound(src, 'sound/machines/windowdoor.ogg', 50, 1)
return 1
else
return 0
/obj/spacepod/MouseDrop_T(mob/M as mob, mob/user as mob)
if(M != user)
return
move_inside(M, user)
/obj/spacepod/verb/move_inside()
set category = "Object"
set name = "Enter Pod"
set src in oview(1)
if(usr.restrained() || usr.stat || usr.weakened || usr.stunned || usr.paralysis || usr.resting) //are you cuffed, dying, lying, stunned or other
return
if (usr.stat || !ishuman(usr))
return
if (src.occupant)
usr << "\blue <B>The [src.name] is already occupied!</B>"
return
/*
if (usr.abiotic())
usr << "\blue <B>Subject cannot have abiotic items on.</B>"
return
*/
for(var/mob/living/carbon/slime/M in range(1,usr))
if(M.Victim == usr)
usr << "You're too busy getting your life sucked out of you."
return
// usr << "You start climbing into [src.name]"
visible_message("\blue [usr] starts to climb into [src.name]")
if(enter_after(40,usr))
if(!src.occupant)
moved_inside(usr)
else if(src.occupant!=usr)
usr << "[src.occupant] was faster. Try better next time, loser."
else
usr << "You stop entering the exosuit."
return
/obj/spacepod/verb/exit_pod()
set name = "Exit pod"
set category = "Spacepod"
set src = usr.loc
if(usr != src.occupant)
return
inertia_dir = 0 // engage reverse thruster and power down pod
src.occupant.loc = src.loc
src.occupant = null
usr << "<span class='notice'>You climb out of the pod</span>"
return
/obj/spacepod/proc/enter_after(delay as num, var/mob/user as mob, var/numticks = 5)
var/delayfraction = delay/numticks
var/turf/T = user.loc
for(var/i = 0, i<numticks, i++)
sleep(delayfraction)
if(!src || !user || !user.canmove || !(user.loc == T))
return 0
return 1
/datum/global_iterator/pod_preserve_temp //normalizing cabin air temperature to 20 degrees celsium
delay = 20
process(var/obj/spacepod/spacepod)
if(spacepod.cabin_air && spacepod.cabin_air.return_volume() > 0)
var/delta = spacepod.cabin_air.temperature - T20C
spacepod.cabin_air.temperature -= max(-10, min(10, round(delta/4,0.1)))
return
/datum/global_iterator/pod_tank_give_air
delay = 15
process(var/obj/spacepod/spacepod)
if(spacepod.internal_tank)
var/datum/gas_mixture/tank_air = spacepod.internal_tank.return_air()
var/datum/gas_mixture/cabin_air = spacepod.cabin_air
var/release_pressure = ONE_ATMOSPHERE
var/cabin_pressure = cabin_air.return_pressure()
var/pressure_delta = min(release_pressure - cabin_pressure, (tank_air.return_pressure() - cabin_pressure)/2)
var/transfer_moles = 0
if(pressure_delta > 0) //cabin pressure lower than release pressure
if(tank_air.return_temperature() > 0)
transfer_moles = pressure_delta*cabin_air.return_volume()/(cabin_air.return_temperature() * R_IDEAL_GAS_EQUATION)
var/datum/gas_mixture/removed = tank_air.remove(transfer_moles)
cabin_air.merge(removed)
else if(pressure_delta < 0) //cabin pressure higher than release pressure
var/datum/gas_mixture/t_air = spacepod.get_turf_air()
pressure_delta = cabin_pressure - release_pressure
if(t_air)
pressure_delta = min(cabin_pressure - t_air.return_pressure(), pressure_delta)
if(pressure_delta > 0) //if location pressure is lower than cabin pressure
transfer_moles = pressure_delta*cabin_air.return_volume()/(cabin_air.return_temperature() * R_IDEAL_GAS_EQUATION)
var/datum/gas_mixture/removed = cabin_air.remove(transfer_moles)
if(t_air)
t_air.merge(removed)
else //just delete the cabin gas, we're in space or some shit
del(removed)
else
return stop()
return
/obj/spacepod/Move(NewLoc, Dir = 0, step_x = 0, step_y = 0)
..()
if(dir == 1 || dir == 4)
src.loc.Entered(src)
/obj/spacepod/proc/Process_Spacemove(var/check_drift = 0, mob/user)
var/dense_object = 0
if(!user)
for(var/direction in list(NORTH, NORTHEAST, EAST))
var/turf/cardinal = get_step(src, direction)
if(istype(cardinal, /turf/space))
continue
dense_object++
break
if(!dense_object)
return 0
inertia_dir = 0
return 1
/obj/spacepod/relaymove(mob/user, direction)
var/moveship = 1
if(battery && battery.charge >= 3 && health)
src.dir = direction
switch(direction)
if(1)
if(inertia_dir == 2)
inertia_dir = 0
moveship = 0
if(2)
if(inertia_dir == 1)
inertia_dir = 0
moveship = 0
if(4)
if(inertia_dir == 8)
inertia_dir = 0
moveship = 0
if(8)
if(inertia_dir == 4)
inertia_dir = 0
moveship = 0
if(moveship)
step(src, direction)
if(istype(src.loc, /turf/space))
inertia_dir = direction
else
if(!battery)
user << "<span class='warning'>No energy cell detected.</span>"
else if(battery.charge < 3)
user << "<span class='warning'>Not enough charge left.</span>"
else if(!health)
user << "<span class='warning'>She's dead, Jim</span>"
else
user << "<span class='warning'>Unknown error has occurred, yell at pomf.</span>"
return 0
battery.charge = max(0, battery.charge - 3)
/obj/effect/landmark/spacepod/random
name = "spacepod spawner"
invisibility = 101
icon = 'icons/mob/screen1.dmi'
icon_state = "x"
anchored = 1
/obj/effect/landmark/spacepod/random/New()
..()
#undef DAMAGE
#undef FIRE