Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions code/controllers/configuration/entries/game_options.dm
Original file line number Diff line number Diff line change
Expand Up @@ -401,3 +401,10 @@

/datum/config_entry/number/engine_type
config_entry_value = 3

//Shuttle size limiter
/datum/config_entry/number/max_shuttle_count
config_entry_value = 6

/datum/config_entry/number/max_shuttle_size
config_entry_value = 250
1 change: 1 addition & 0 deletions code/controllers/subsystem/shuttle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ SUBSYSTEM_DEF(shuttle)

var/list/mobile = list()
var/list/stationary = list()
var/list/beacons = list()
var/list/transit = list()

var/list/transit_requesters = list()
Expand Down
4 changes: 4 additions & 0 deletions code/game/area/areas/shuttles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@
/area/shuttle/custom
name = "Custom player shuttle"

/area/shuttle/custom/powered
name = "Custom Powered player shuttle"
requires_power = FALSE

/area/shuttle/arrival
name = "Arrival Shuttle"
unique = TRUE // SSjob refers to this area for latejoiners
Expand Down
33 changes: 33 additions & 0 deletions code/game/machinery/shuttle/custom_shuttle.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/obj/machinery/shuttle
name = "shuttle component"
desc = "Something for shuttles."
density = TRUE
obj_integrity = 250
max_integrity = 250
icon = 'icons/turf/shuttle.dmi'
icon_state = "burst_plasma"
idle_power_usage = 150
circuit = /obj/item/circuitboard/machine/shuttle/engine
var/icon_state_closed = "burst_plasma"
var/icon_state_open = "burst_plasma_open"
var/icon_state_off = "burst_plasma_off"

/obj/machinery/shuttle/Initialize()
. = ..()
GLOB.custom_shuttle_machines += src

/obj/machinery/shuttle/Destroy()
. = ..()
GLOB.custom_shuttle_machines -= src

/obj/machinery/shuttle/attackby(obj/item/I, mob/living/user, params)
if(default_deconstruction_screwdriver(user, icon_state_open, icon_state_closed, I))
return
if(default_pry_open(I))
return
if(panel_open)
if(default_change_direction_wrench(user, I))
return
if(default_deconstruction_crowbar(I))
return
return ..()
140 changes: 140 additions & 0 deletions code/game/machinery/shuttle/shuttle_engine.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
//-----------------------------------------------
//-------------Engine Thrusters------------------
//-----------------------------------------------

#define ENGINE_HEAT_TARGET 600
#define ENGINE_HEATING_POWER 5000000

/obj/machinery/shuttle/engine
name = "shuttle thruster"
desc = "A thruster for shuttles."
density = TRUE
obj_integrity = 250
max_integrity = 250
icon = 'icons/turf/shuttle.dmi'
icon_state = "burst_plasma"
idle_power_usage = 150
circuit = /obj/item/circuitboard/machine/shuttle/engine
var/thrust = 0
var/fuel_use = 0
var/bluespace_capable = TRUE
var/cooldown = 0
var/thruster_active = FALSE
var/datum/weakref/attached_heater

/obj/machinery/shuttle/engine/plasma
name = "plasma thruster"
desc = "A thruster that burns plasma stored in an adjacent plasma thruster heater."
icon_state = "burst_plasma"
icon_state_off = "burst_plasma_off"

idle_power_usage = 0
circuit = /obj/item/circuitboard/machine/shuttle/engine/plasma
thrust = 25
fuel_use = 0.24
bluespace_capable = FALSE
cooldown = 45

/obj/machinery/shuttle/engine/void
name = "void thruster"
desc = "A thruster using technology to breach voidspace for propulsion."
icon_state = "burst_void"
icon_state_off = "burst_void"
icon_state_closed = "burst_void"
icon_state_open = "burst_void_open"
idle_power_usage = 0
circuit = /obj/item/circuitboard/machine/shuttle/engine/void
thrust = 400
fuel_use = 0
bluespace_capable = TRUE
cooldown = 90

/obj/machinery/shuttle/engine/Initialize()
. = ..()
check_setup()

/obj/machinery/shuttle/engine/on_construction()
. = ..()
check_setup()

/obj/machinery/shuttle/engine/proc/check_setup()
var/heater_turf
switch(dir)
if(NORTH)
heater_turf = get_offset_target_turf(src, 0, 1)
if(SOUTH)
heater_turf = get_offset_target_turf(src, 0, -1)
if(EAST)
heater_turf = get_offset_target_turf(src, 1, 0)
if(WEST)
heater_turf = get_offset_target_turf(src, -1, 0)
if(!heater_turf)
attached_heater = null
update_engine()
return
attached_heater = null
for(var/obj/machinery/atmospherics/components/unary/shuttle/heater/as_heater in heater_turf)
if(as_heater.dir != dir)
continue
if(as_heater.panel_open)
continue
if(!as_heater.anchored)
continue
attached_heater = WEAKREF(as_heater)
break
update_engine()
return

/obj/machinery/shuttle/engine/proc/update_engine()
if(!attached_heater)
icon_state = icon_state_off
thruster_active = FALSE
return
var/obj/machinery/atmospherics/components/unary/shuttle/heater/resolved_heater = attached_heater.resolve()
if(panel_open)
thruster_active = FALSE
else if(resolved_heater?.hasFuel(1))
icon_state = icon_state_closed
thruster_active = TRUE
else
thruster_active = FALSE
icon_state = icon_state_off
return

/obj/machinery/shuttle/engine/void/update_engine()
if(panel_open)
thruster_active = FALSE
return
thruster_active = TRUE
icon_state = icon_state_closed
return

//Thanks to spaceheater.dm for inspiration :)
/obj/machinery/shuttle/engine/proc/fireEngine()
var/turf/heatTurf = loc
if(!heatTurf)
return
var/datum/gas_mixture/env = heatTurf.return_air()
var/heat_cap = env.heat_capacity()
var/req_power = abs(env.return_temperature() - ENGINE_HEAT_TARGET) * heat_cap
req_power = min(req_power, ENGINE_HEATING_POWER)
var/deltaTemperature = 0
if(!heat_cap == 0)
deltaTemperature = req_power / heat_cap
if(deltaTemperature < 0)
return
env.set_temperature(env.return_temperature() + deltaTemperature)
air_update_turf()

/obj/machinery/shuttle/engine/attackby(obj/item/I, mob/living/user, params)
check_setup()
if(default_deconstruction_screwdriver(user, icon_state_open, icon_state_closed, I))
return
if(default_pry_open(I))
return
if(panel_open)
if(default_change_direction_wrench(user, I))
return
if(default_deconstruction_crowbar(I))
return
return ..()
134 changes: 134 additions & 0 deletions code/game/machinery/shuttle/shuttle_heater.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
//-----------------------------------------------
//--------------Engine Heaters-------------------
//This uses atmospherics, much like a thermomachine,
//but instead of changing temp, it stores plasma and uses
//it for the engine.
//-----------------------------------------------
/obj/machinery/atmospherics/components/unary/shuttle
name = "shuttle atmospherics device"
desc = "This does something to do with shuttle atmospherics"
icon_state = "heater"
icon = 'icons/turf/shuttle.dmi'

/obj/machinery/atmospherics/components/unary/shuttle/heater
name = "engine heater"
desc = "Directs energy into compressed particles in order to power an attached thruster."
icon_state = "heater_pipe"
var/icon_state_closed = "heater_pipe"
var/icon_state_open = "heater_pipe_open"
var/icon_state_off = "heater_pipe"
idle_power_usage = 50
circuit = /obj/item/circuitboard/machine/shuttle/heater

density = TRUE
max_integrity = 400
armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 100, "bomb" = 0, "bio" = 100, "rad" = 100, "fire" = 100, "acid" = 30)
layer = OBJ_LAYER
showpipe = TRUE

pipe_flags = PIPING_ONE_PER_TURF | PIPING_DEFAULT_LAYER_ONLY

var/gas_type = /datum/gas/plasma
var/efficiency_multiplier = 1
var/gas_capacity = 0

/obj/machinery/atmospherics/components/unary/shuttle/heater/New()
. = ..()
GLOB.custom_shuttle_machines += src
SetInitDirections()
update_adjacent_engines()
updateGasStats()

/obj/machinery/atmospherics/components/unary/shuttle/heater/Destroy()
. = ..()
update_adjacent_engines()
GLOB.custom_shuttle_machines -= src

/obj/machinery/atmospherics/components/unary/shuttle/heater/on_construction()
..(dir, dir)
SetInitDirections()
update_adjacent_engines()

/obj/machinery/atmospherics/components/unary/shuttle/heater/default_change_direction_wrench(mob/user, obj/item/I)
if(!..())
return FALSE
SetInitDirections()
var/obj/machinery/atmospherics/node = nodes[1]
if(node)
node.disconnect(src)
nodes[1] = null
if(!parents[1])
return
nullifyPipenet(parents[1])

atmosinit()
node = nodes[1]
if(node)
node.atmosinit()
node.addMember(src)
build_network()
return TRUE

/obj/machinery/atmospherics/components/unary/shuttle/heater/RefreshParts()
var/cap = 0
var/eff = 0
for(var/obj/item/stock_parts/matter_bin/M in component_parts)
cap += M.rating
for(var/obj/item/stock_parts/micro_laser/L in component_parts)
eff += L.rating
gas_capacity = 5000 * ((cap - 1) ** 2) + 1000
efficiency_multiplier = round(((eff / 2) / 2.8) ** 2, 0.1)
updateGasStats()

/obj/machinery/atmospherics/components/unary/shuttle/heater/examine(mob/user)
. = ..()
var/datum/gas_mixture/air_contents = airs[1]
. += "The engine heater's gas dial reads [air_contents.get_moles(gas_type)] moles of gas.<br>" //This probably has issues [air_contents.get_moles]

/obj/machinery/atmospherics/components/unary/shuttle/heater/proc/updateGasStats()
var/datum/gas_mixture/air_contents = airs[1]
if(!air_contents)
return
air_contents.set_volume(gas_capacity)
air_contents.set_temperature(T20C)
if(gas_type)
air_contents.set_moles(gas_type)

/obj/machinery/atmospherics/components/unary/shuttle/heater/proc/hasFuel(var/required)
var/datum/gas_mixture/air_contents = airs[1]
var/moles = air_contents.total_moles()
return moles >= required

/obj/machinery/atmospherics/components/unary/shuttle/heater/proc/consumeFuel(var/amount)
var/datum/gas_mixture/air_contents = airs[1]
air_contents.remove(amount)
return

/obj/machinery/atmospherics/components/unary/shuttle/heater/attackby(obj/item/I, mob/living/user, params)
update_adjacent_engines()
if(default_deconstruction_screwdriver(user, icon_state_open, icon_state_closed, I))
return
if(default_pry_open(I))
return
if(panel_open)
if(default_change_direction_wrench(user, I))
return
if(default_deconstruction_crowbar(I))
return
return ..()

/obj/machinery/atmospherics/components/unary/shuttle/heater/proc/update_adjacent_engines()
var/engine_turf
switch(dir)
if(NORTH)
engine_turf = get_offset_target_turf(src, 0, -1)
if(SOUTH)
engine_turf = get_offset_target_turf(src, 0, 1)
if(EAST)
engine_turf = get_offset_target_turf(src, -1, 0)
if(WEST)
engine_turf = get_offset_target_turf(src, 1, 0)
if(!engine_turf)
return
for(var/obj/machinery/shuttle/engine/E in engine_turf)
E.check_setup()
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,14 @@
name = "circuit board (Xenobiology Console)"
icon_state = "science"
build_path = /obj/machinery/computer/camera_advanced/xenobio

/obj/item/circuitboard/computer/shuttle/flight_control
name = "Shuttle Flight Control (Computer Board)"
build_path = /obj/machinery/computer/custom_shuttle

/obj/item/circuitboard/computer/shuttle/docker
name = "Shuttle Navigation Computer (Computer Board)"
build_path = /obj/machinery/computer/camera_advanced/shuttle_docker/custom

//Security

Expand Down
25 changes: 25 additions & 0 deletions code/game/objects/items/circuitboards/machine_circuitboards.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1230,3 +1230,28 @@
/obj/item/stack/sheet/mineral/silver = 1)

needs_anchored = FALSE

/obj/item/circuitboard/machine/shuttle/engine
name = "Thruster (Machine Board)"
build_path = /obj/machinery/shuttle/engine
req_components = list()

/obj/item/circuitboard/machine/shuttle/engine/plasma
name = "Plasma Thruster (Machine Board)"
build_path = /obj/machinery/shuttle/engine/plasma
req_components = list(/obj/item/stock_parts/capacitor = 2,
/obj/item/stack/cable_coil = 5,
/obj/item/stock_parts/micro_laser = 1)

/obj/item/circuitboard/machine/shuttle/engine/void
name = "Void Thruster (Machine Board)"
build_path = /obj/machinery/shuttle/engine/void
req_components = list(/obj/item/stock_parts/capacitor/quadratic = 2,
/obj/item/stack/cable_coil = 5,
/obj/item/stock_parts/micro_laser/quadultra = 1)

/obj/item/circuitboard/machine/shuttle/heater
name = "Electronic Engine Heater (Machine Board)"
build_path = /obj/machinery/atmospherics/components/unary/shuttle/heater
req_components = list(/obj/item/stock_parts/micro_laser = 2,
/obj/item/stock_parts/matter_bin = 1)
Empty file.
Empty file.
2 changes: 2 additions & 0 deletions code/modules/mob/mob_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -219,3 +219,5 @@

/// A mock client, provided by tests and friends
var/datum/client_interface/mock_client

var/create_area_cooldown
Loading