Merge pull request #1777 from Citadel-Station-13/upstream-merge-28564
[MIRROR] Shuttle engines affecting travel time
This commit is contained in:
@@ -710,6 +710,15 @@
|
||||
/obj/item/weapon/am_containment)
|
||||
crate_name = "antimatter jar crate"
|
||||
|
||||
/datum/supply_pack/engineering/shuttle_engine
|
||||
name = "Shuttle Engine Crate"
|
||||
cost = 5000
|
||||
access = GLOB.access_ce
|
||||
contains = list(/obj/structure/shuttle/engine/propulsion/burst/cargo)
|
||||
crate_name = "shuttle engine crate"
|
||||
crate_type = /obj/structure/closet/crate/secure/engineering
|
||||
special = TRUE
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////// Medical /////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -213,7 +213,7 @@
|
||||
set_coefficient = 1
|
||||
else
|
||||
set_coefficient = 0.5
|
||||
var/call_time = SSshuttle.emergencyCallTime * set_coefficient
|
||||
var/call_time = SSshuttle.emergencyCallTime * set_coefficient * engine_coeff
|
||||
switch(mode)
|
||||
// The shuttle can not normally be called while "recalling", so
|
||||
// if this proc is called, it's via admin fiat
|
||||
@@ -359,7 +359,7 @@
|
||||
enterTransit()
|
||||
mode = SHUTTLE_ESCAPE
|
||||
launch_status = ENDGAME_LAUNCHED
|
||||
setTimer(SSshuttle.emergencyEscapeTime)
|
||||
setTimer(SSshuttle.emergencyEscapeTime * engine_coeff)
|
||||
priority_announce("The Emergency Shuttle has left the station. Estimate [timeLeft(600)] minutes until the shuttle docks at Central Command.", null, null, "Priority")
|
||||
|
||||
if(SHUTTLE_STRANDED)
|
||||
|
||||
@@ -285,6 +285,9 @@
|
||||
|
||||
message_admins(msg)
|
||||
WARNING(msg)
|
||||
return
|
||||
//Everything fine
|
||||
S.on_bought()
|
||||
|
||||
/obj/machinery/shuttle_manipulator/proc/unload_preview()
|
||||
if(preview_shuttle)
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
|
||||
anchored = 1
|
||||
|
||||
//
|
||||
var/id
|
||||
// this should point -away- from the dockingport door, ie towards the ship
|
||||
dir = NORTH
|
||||
@@ -224,11 +224,9 @@
|
||||
var/timid = FALSE
|
||||
|
||||
var/list/ripples = list()
|
||||
|
||||
/obj/docking_port/mobile/Initialize()
|
||||
. = ..()
|
||||
if(!timid)
|
||||
register()
|
||||
var/engine_coeff = 1 //current engine coeff
|
||||
var/current_engines = 0 //current engine power
|
||||
var/initial_engines = 0 //initial engine power
|
||||
|
||||
/obj/docking_port/mobile/proc/register()
|
||||
SSshuttle.mobile += src
|
||||
@@ -244,6 +242,8 @@
|
||||
|
||||
/obj/docking_port/mobile/Initialize(mapload)
|
||||
. = ..()
|
||||
if(!timid)
|
||||
register()
|
||||
|
||||
var/area/A = get_area(src)
|
||||
if(istype(A, /area/shuttle))
|
||||
@@ -259,6 +259,9 @@
|
||||
areaInstance.name = name
|
||||
areaInstance.contents += return_ordered_turfs()
|
||||
|
||||
initial_engines = count_engines()
|
||||
current_engines = initial_engines
|
||||
|
||||
#ifdef DOCKING_PORT_HIGHLIGHT
|
||||
highlight("#0f0")
|
||||
#endif
|
||||
@@ -325,17 +328,17 @@
|
||||
switch(mode)
|
||||
if(SHUTTLE_CALL)
|
||||
if(S == destination)
|
||||
if(timeLeft(1) < callTime)
|
||||
setTimer(callTime)
|
||||
if(timeLeft(1) < callTime * engine_coeff)
|
||||
setTimer(callTime * engine_coeff)
|
||||
else
|
||||
destination = S
|
||||
setTimer(callTime)
|
||||
setTimer(callTime * engine_coeff)
|
||||
if(SHUTTLE_RECALL)
|
||||
if(S == destination)
|
||||
setTimer(callTime - timeLeft(1))
|
||||
setTimer(callTime * engine_coeff - timeLeft(1))
|
||||
else
|
||||
destination = S
|
||||
setTimer(callTime)
|
||||
setTimer(callTime * engine_coeff)
|
||||
mode = SHUTTLE_CALL
|
||||
if(SHUTTLE_IDLE, SHUTTLE_IGNITING)
|
||||
destination = S
|
||||
@@ -621,7 +624,7 @@
|
||||
return
|
||||
else
|
||||
mode = SHUTTLE_CALL
|
||||
setTimer(callTime)
|
||||
setTimer(callTime * engine_coeff)
|
||||
enterTransit()
|
||||
return
|
||||
|
||||
@@ -685,7 +688,7 @@
|
||||
|
||||
var/ds_remaining
|
||||
if(!timer)
|
||||
ds_remaining = callTime
|
||||
ds_remaining = callTime * engine_coeff
|
||||
else
|
||||
ds_remaining = max(0, timer - world.time)
|
||||
|
||||
@@ -765,5 +768,62 @@
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
// Losing all initial engines should get you 2
|
||||
// Adding another set of engines at 0.5 time
|
||||
/obj/docking_port/mobile/proc/alter_engines(mod)
|
||||
if(mod == 0)
|
||||
return
|
||||
var/old_coeff = engine_coeff
|
||||
engine_coeff = get_engine_coeff(current_engines,mod)
|
||||
current_engines = max(0,current_engines + mod)
|
||||
if(in_flight())
|
||||
var/delta_coeff = engine_coeff / old_coeff
|
||||
modTimer(delta_coeff)
|
||||
|
||||
/obj/docking_port/mobile/proc/count_engines()
|
||||
. = 0
|
||||
for(var/obj/structure/shuttle/engine/E in areaInstance.contents)
|
||||
if(!QDELETED(E))
|
||||
. += E.engine_power
|
||||
|
||||
// Double initial engines to get to 0.5 minimum
|
||||
// Lose all initial engines to get to 2
|
||||
//For 0 engine shuttles like BYOS 5 engines to get to doublespeed
|
||||
/obj/docking_port/mobile/proc/get_engine_coeff(current,engine_mod)
|
||||
var/new_value = max(0,current + engine_mod)
|
||||
if(new_value == initial_engines)
|
||||
return 1
|
||||
if(new_value > initial_engines)
|
||||
var/delta = new_value - initial_engines
|
||||
var/change_per_engine = (1 - ENGINE_COEFF_MIN) / ENGINE_DEFAULT_MAXSPEED_ENGINES // 5 by default
|
||||
if(initial_engines > 0)
|
||||
change_per_engine = (1 - ENGINE_COEFF_MIN) / initial_engines // or however many it had
|
||||
return Clamp(1 - delta * change_per_engine,ENGINE_COEFF_MIN,ENGINE_COEFF_MAX)
|
||||
if(new_value < initial_engines)
|
||||
var/delta = initial_engines - new_value
|
||||
var/change_per_engine = 1 //doesn't really matter should not be happening for 0 engine shuttles
|
||||
if(initial_engines > 0)
|
||||
change_per_engine = (ENGINE_COEFF_MAX - 1) / initial_engines //just linear drop to max delay
|
||||
return Clamp(1 + delta * change_per_engine,ENGINE_COEFF_MIN,ENGINE_COEFF_MAX)
|
||||
|
||||
|
||||
/obj/docking_port/mobile/proc/in_flight()
|
||||
switch(mode)
|
||||
if(SHUTTLE_CALL,SHUTTLE_RECALL)
|
||||
return TRUE
|
||||
if(SHUTTLE_IDLE,SHUTTLE_IGNITING)
|
||||
return FALSE
|
||||
else
|
||||
return FALSE // hmm
|
||||
|
||||
/obj/docking_port/mobile/emergency/in_flight()
|
||||
switch(mode)
|
||||
if(SHUTTLE_ESCAPE)
|
||||
return TRUE
|
||||
if(SHUTTLE_STRANDED,SHUTTLE_ENDGAME)
|
||||
return FALSE
|
||||
else
|
||||
return ..()
|
||||
|
||||
|
||||
#undef DOCKING_PORT_HIGHLIGHT
|
||||
|
||||
Reference in New Issue
Block a user