mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 19:47:22 +01:00
Fixed a gamebreaking bug
Conflicts: code/game/turfs/turf.dm code/modules/mob/living/carbon/human/life.dm maps/tgstation.2.1.0.0.1.dmm
This commit is contained in:
@@ -0,0 +1,297 @@
|
||||
// honk
|
||||
|
||||
/client/verb/make_pod()
|
||||
set name = "makin da pood"
|
||||
set category = "Mapping"
|
||||
if(!holder)
|
||||
return
|
||||
new /obj/spacepod/civilian(get_turf(usr))
|
||||
/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 = MOB_LAYER
|
||||
infra_luminosity = 15
|
||||
var/mob/living/carbon/occupant
|
||||
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
|
||||
|
||||
/obj/spacepod/New()
|
||||
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))
|
||||
|
||||
/obj/spacepod/civilian
|
||||
icon_state = "pod_civ"
|
||||
desc = "A sleek civilian space pod."
|
||||
/obj/spacepod/random
|
||||
icon_state = "pod_civ"
|
||||
// placeholder
|
||||
/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)
|
||||
if(battery && battery.charge)
|
||||
src.dir = direction
|
||||
switch(direction)
|
||||
if(1)
|
||||
if(inertia_dir == 2)
|
||||
inertia_dir = 0
|
||||
return 0
|
||||
if(2)
|
||||
if(inertia_dir == 1)
|
||||
inertia_dir = 0
|
||||
return 0
|
||||
if(4)
|
||||
if(inertia_dir == 8)
|
||||
inertia_dir = 0
|
||||
return 0
|
||||
if(8)
|
||||
if(inertia_dir == 4)
|
||||
inertia_dir = 0
|
||||
return 0
|
||||
step(src, direction)
|
||||
if(istype(src.loc, /turf/space))
|
||||
inertia_dir = direction
|
||||
else
|
||||
user << "<span class='warning'>She's dead, Jim</span>"
|
||||
return 0
|
||||
battery.use(3)
|
||||
Reference in New Issue
Block a user