Skip to content
Draft
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
18 changes: 0 additions & 18 deletions tgui/packages/voidcrew_tgui/interfaces/HelmComputer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ type Data = {
* research to meet. Null the rest of the time. */
zone_advisory: { label: string; critical: BooleanLike } | null;

calibrating: BooleanLike;
undockCooldown: BooleanLike;
undockCooldownRemaining: number;
undockLocked: BooleanLike;
Expand Down Expand Up @@ -1344,9 +1343,6 @@ const AlertStrip = () => {
if (data.cargoShuttlePresent) {
alerts.push(['warn', 'Cargo shuttle docked']);
}
if (data.calibrating) {
alerts.push(['warn', 'Bluespace jump calibrating']);
}
if (data.autopilot?.engaged) {
alerts.push([
'info',
Expand Down Expand Up @@ -4670,7 +4666,6 @@ const OpsRow = () => {
nebulaHideWarmup,
nebulaHideRemaining,
zone_transitioning,
calibrating,
dockOptions,
speed,
dockAssistMaxSpeed,
Expand Down Expand Up @@ -4882,19 +4877,6 @@ const OpsRow = () => {
}
onClick={() => act('distress')}
/>
<OpsButton
label="Bluespace"
sub={calibrating ? 'calibrating' : 'leave system'}
path="M13 2L4 14h6l-1 8 9-12h-6l1-8z"
disabled={!flyable || !!zone_transitioning || !!hiddenInNebula}
state={calibrating ? 'armed' : undefined}
title={
calibrating
? 'Cancel the bluespace jump'
: 'Calibrate a bluespace jump, this ends the round for your ship'
}
onClick={() => act('bluespace_jump')}
/>
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1762,7 +1762,7 @@ $caption: 1.6cqw;
position: absolute;
inset: 0;
display: grid;
grid-template-columns: repeat(5, 1fr);
grid-template-columns: repeat(4, 1fr);
gap: 0.6cqw;
padding: 0.8cqw;
}
Expand Down
59 changes: 21 additions & 38 deletions voidcrew/modules/metrics/ship_metrics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@
// Not written for the crash that abandonment itself causes. details:
// last_hit_by_id, last_hit_by, last_hit_by_npc, seconds_since_hit.
// ship_repaired A failed hull comes back into service.
// ship_removed The hull leaves the round. subject = reason: bluespace_jump,
// derelict_despawned, never_crewed_despawned or deleted. details:
// age_seconds, crew; parts_extracted and crew_aboard for a jump.
// ship_removed The hull leaves the round. subject = reason: derelict_despawned,
// never_crewed_despawned or deleted. details: age_seconds, crew.
// ship_force_docked A ship's interdictor forces another player ship to dock with it.
// ship = the ship that did it, ckey = interdictor operator. details:
// target_ship_id, target_ship.
Expand Down Expand Up @@ -160,10 +159,6 @@
var/metric_spawned_at
/// TRUE once the removal row is written; nothing more is recorded about the hull.
var/metric_removed = FALSE
/// Why the hull is about to leave the round, when the caller knows (a bluespace jump).
var/metric_removal_reason
/// Extra details for the removal row, set with metric_removal_reason.
var/list/metric_removal_details
/// The last ship to land a weapon hit on this one, and when.
var/metric_last_hit_by_id
var/metric_last_hit_by_name
Expand Down Expand Up @@ -378,19 +373,9 @@
return
record_metric(METRIC_SHIP, "ship_repaired", ship = ship, zone = ship_metric_zone(ship))

/// The helm is about to jump the ship out of the round.
/proc/ship_metric_jumping(obj/structure/overmap/ship/ship, parts_extracted)
if(!ship)
return
ship.metric_removal_reason = "bluespace_jump"
ship.metric_removal_details = list(
"parts_extracted" = parts_extracted || 0,
"crew_aboard" = length(ship.shuttle?.get_all_humans()),
)

/**
* The hull is leaving the round: its shuttle is about to be detached. Every removal path
* (derelict despawn, bluespace jump, deletion) detaches the shuttle first, so this is the last
* (derelict despawn, deletion) detaches the shuttle first, so this is the last
* moment the hull still has its id. Closes any open NPC encounter first.
*/
/proc/ship_metric_removed(obj/structure/overmap/ship/ship)
Expand All @@ -399,36 +384,34 @@
watched.metric_stop_watching() // even with metrics off, so no area refs outlive the hull
if(!ship_metric_live(ship))
return
var/reason = ship.metric_removal_reason
var/list/details = ship.metric_removal_details ? ship.metric_removal_details.Copy() : list()
var/reason
var/list/details = list()
details["age_seconds"] = ship_metric_seconds_since(ship.metric_spawned_at)
if(ship_metric_is_npc(ship))
var/obj/structure/overmap/ship/npc/npc_ship = ship
npc_metric_end_encounter(npc_ship, outcome = "hull_removed")
if(!reason)
if(!isnull(npc_ship.disarmed_despawn_at))
reason = "disarmed_salvage_expired"
else if(ship.abandoned)
reason = "derelict_despawned"
else if(istype(ship, /obj/structure/overmap/ship/npc/pirate/nt_patrol))
var/obj/structure/overmap/ship/npc/pirate/nt_patrol/patrol = ship
reason = patrol.warping_out ? "warped_out" : "deleted"
else
reason = "deleted"
if(!isnull(npc_ship.disarmed_despawn_at))
reason = "disarmed_salvage_expired"
else if(ship.abandoned)
reason = "derelict_despawned"
else if(istype(ship, /obj/structure/overmap/ship/npc/pirate/nt_patrol))
var/obj/structure/overmap/ship/npc/pirate/nt_patrol/patrol = ship
reason = patrol.warping_out ? "warped_out" : "deleted"
else
reason = "deleted"
details["pool_slot_freed"] = npc_ship.spawner_resolved
details["encounters"] = npc_ship.metric_encounter_count
details["damage_taken"] = round(npc_ship.metric_damage_taken)
details["boarded_by"] = LAZYLEN(npc_ship.metric_boarded_by)
record_metric(METRIC_PIRATE, "npc_despawned", ship = ship, zone = ship_metric_zone(ship), subject = reason, details = details)
else
if(!reason)
if(ship.abandoned)
reason = "derelict_despawned"
// The derelict sweep's fast path for hulls nobody ever crewed
else if(ship.crewless_since && !length(ship.manifest) && !LAZYLEN(ship.ship_team?.members))
reason = "never_crewed_despawned"
else
reason = "deleted"
if(ship.abandoned)
reason = "derelict_despawned"
// The derelict sweep's fast path for hulls nobody ever crewed
else if(ship.crewless_since && !length(ship.manifest) && !LAZYLEN(ship.ship_team?.members))
reason = "never_crewed_despawned"
else
reason = "deleted"
details["crew"] = LAZYLEN(ship.ship_team?.members)
record_metric(METRIC_SHIP, "ship_removed", ship = ship, zone = ship_metric_zone(ship), subject = reason, details = details)
ship.metric_removed = TRUE
Expand Down
13 changes: 4 additions & 9 deletions voidcrew/modules/overmap/code/modules/overmap/ship.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1485,18 +1485,13 @@
* Removes the ship from the round.
*
* force = TRUE deletes the hull outright; otherwise the ship is left behind as an
* abandoned derelict for someone else to claim.
*
* ignore_crew exists for the bluespace jump, which is meant to take the crew with
* it - the helm asks for confirmation first, and extraction runs before the call.
* Without it the crew check below rejected every jump ever attempted, silently:
* anyone flying the ship is by definition standing on it, and do_jump() is the
* only caller there has ever been.
* abandoned derelict for someone else to claim. A forced delete refuses while anyone
* is aboard.
*/
/obj/structure/overmap/ship/proc/destroy_ship(force, ignore_crew = FALSE)
/obj/structure/overmap/ship/proc/destroy_ship(force)
// For backward compatibility, redirect to abandon_ship unless forced
if(force)
if(!ignore_crew && length(shuttle?.get_all_humans()) > 0)
if(length(shuttle?.get_all_humans()) > 0)
return FALSE
message_admins("\[SHUTTLE]: [shuttle?.name] has been FORCE deleted!")
log_shuttle("[shuttle?.name] has been force deleted!")
Expand Down
8 changes: 2 additions & 6 deletions voidcrew/modules/roundend/roundend_ship_report.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,8 @@ GLOBAL_LIST_EMPTY(roundend_departed_ships)
if(body ? body.stat == DEAD : !departing)
dead++
if(departing)
switch(ship.metric_removal_reason)
if("bluespace_jump")
status = "Jumped out"
else
status = ship.abandoned ? "Abandoned" : "Lost"
bad_status = TRUE
status = ship.abandoned ? "Abandoned" : "Lost"
bad_status = TRUE
else if(ship.has_crash_landed)
status = "Wrecked"
bad_status = TRUE
Expand Down
2 changes: 1 addition & 1 deletion voidcrew/modules/ship_purchase/ship_economy_database.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Based on user decisions:
* - Account-wide credits (ckey only, no character_slot)
* - Part classes: combat, science, trade, misc
* - Parts must be extracted via bluespace jump or round end
* - Parts must be extracted at round end
* - Pending extractions queue for failed extraction retry
* - Account-wide ship unlocks
*
Expand Down
115 changes: 1 addition & 114 deletions voidcrew/modules/shuttle/helm/_helm.dm
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
#define JUMP_STATE_OFF 0
#define JUMP_STATE_CHARGING 1
#define JUMP_STATE_IONIZING 2
#define JUMP_STATE_FIRING 3
#define JUMP_STATE_FINALIZED 4
#define JUMP_CHARGE_DELAY (20 SECONDS)
#define JUMP_CHARGEUP_TIME (3 MINUTES)
/// Minimum gap between hails sent from one console. A hail fans out to every helm
/// in the view ring and lands in each one's comms log, so it needs a floor.
#define HAIL_SEND_COOLDOWN (3 SECONDS)
Expand Down Expand Up @@ -45,14 +38,6 @@
var/list/concurrent_users = list()
/// Is this console view only? I.E. cant dock/etc
var/viewer = FALSE
/// When are we allowed to jump
var/jump_allowed
/// Current state of our jump
var/jump_state = JUMP_STATE_OFF
///if we are calibrating the jump
var/calibrating = FALSE
///holding jump timer ID
var/jump_timer
/// Last known ship state for detecting changes
var/last_ship_state
/// Last known integrity percent for threshold detection
Expand Down Expand Up @@ -373,7 +358,6 @@
data["repairCurrent"] = 0
data["repairTotal"] = 0

data["calibrating"] = calibrating
data["canThrust"] = current_ship.can_thrust()
data["otherInfo"] = list()
for (var/obj/structure/overmap/object as anything in current_ship.close_overmap_objects)
Expand Down Expand Up @@ -793,87 +777,6 @@
. = ..()
attempt_ship_connection()

/obj/machinery/computer/helm/proc/calibrate_jump(inline = FALSE)
if(jump_allowed < 0)
say("Bluespace Jump Calibration offline. Please contact your system administrator.")
return
if(current_ship.state != OVERMAP_SHIP_FLYING)
say("Bluespace Jump Calibration detected interference in the local area.")
return
if(world.time < jump_allowed)
var/jump_wait = DisplayTimeText(jump_allowed - world.time)
say("Bluespace Jump Calibration is currently recharging. ETA: [jump_wait].")
return
if(jump_state != JUMP_STATE_OFF && !inline)
// Guards against href exploits calling this more than once per client. It used
// to return in total silence, which meant any jump that failed mid-sequence
// bricked the console for the rest of the round with no way to tell.
say("Bluespace Jump sequence already underway.")
return
message_admins("[ADMIN_LOOKUPFLW(usr)] has initiated a bluespace jump in [ADMIN_VERBOSEJMP(src)]")
jump_timer = addtimer(CALLBACK(src, PROC_REF(jump_sequence), TRUE), JUMP_CHARGEUP_TIME, TIMER_STOPPABLE)
current_ship?.ship_notify("Bluespace jump calibration initialized. Calibration completion in [JUMP_CHARGEUP_TIME/600] minutes.", "BLUESPACE", SHIP_NOTIFY_NOTICE, 'voidcrew/sound/notify.ogg', 50)
calibrating = TRUE
return TRUE

/**
* Aborts a jump, whether it is still calibrating or already running the launch
* sequence, and puts the console back to a state that can jump again.
*
* jump_state has to be reset here: leaving it non-OFF makes calibrate_jump()
* refuse every future attempt. deltimer() has to cover the sequence timers too -
* jump_timer only ever held the initial calibration timer, so a cancel after
* calibration finished left the chain running and unstoppable.
*/
/obj/machinery/computer/helm/proc/cancel_jump()
current_ship?.ship_notify("Pylon Disengaged. Jump cancelled.", "BLUESPACE", SHIP_NOTIFY_WARNING, 'voidcrew/sound/notify.ogg', 50)
reset_jump()

/// Clears all jump state and any pending sequence timer.
/obj/machinery/computer/helm/proc/reset_jump()
calibrating = FALSE
jump_state = JUMP_STATE_OFF
if(jump_timer)
deltimer(jump_timer)
jump_timer = null

/obj/machinery/computer/helm/proc/jump_sequence()
switch(jump_state)
if(JUMP_STATE_OFF)
jump_state = JUMP_STATE_CHARGING
SStgui.close_uis(src)
if(JUMP_STATE_CHARGING)
jump_state = JUMP_STATE_IONIZING
current_ship?.ship_notify("Bluespace Jump Calibration completed. Ionizing Bluespace Pylon.", "BLUESPACE", SHIP_NOTIFY_NOTICE, 'voidcrew/sound/notify.ogg', 50)
if(JUMP_STATE_IONIZING)
jump_state = JUMP_STATE_FIRING
current_ship?.ship_notify("Bluespace Ionization finalized; preparing to fire Bluespace Pylon.", "BLUESPACE", SHIP_NOTIFY_NOTICE, 'voidcrew/sound/notify.ogg', 50)
if(JUMP_STATE_FIRING)
jump_state = JUMP_STATE_FINALIZED
current_ship?.ship_notify("Bluespace Pylon launched.", "BLUESPACE", SHIP_NOTIFY_NOTICE, 'sound/effects/magic/lightning_chargeup.ogg', 50)
jump_timer = addtimer(CALLBACK(src, PROC_REF(do_jump)), 10 SECONDS, TIMER_STOPPABLE)
return
jump_timer = addtimer(CALLBACK(src, PROC_REF(jump_sequence), TRUE), JUMP_CHARGE_DELAY, TIMER_STOPPABLE)

/obj/machinery/computer/helm/proc/do_jump()
jump_timer = null
current_ship?.ship_notify("Bluespace Jump Initiated.", "BLUESPACE", SHIP_NOTIFY_NOTICE, 'voidcrew/sound/notify.ogg', 50)
if(!current_ship)
reset_jump()
return
// Extract ship parts from all players on the ship before jumping
var/parts_extracted = extract_ship_parts_from_ship(current_ship, "bluespace_jump")
ship_metric_jumping(current_ship, parts_extracted)
// ignore_crew: the jump is supposed to take the crew with it, and the console
// asked for confirmation before any of this started.
if(current_ship.destroy_ship(TRUE, ignore_crew = TRUE))
return
// Never strand the console in a state it cannot leave - a failed jump has to be
// retryable, and the crew has to hear that it failed.
current_ship.ship_notify("Bluespace Pylon misfire. Jump aborted; recalibration required.", "BLUESPACE", SHIP_NOTIFY_DANGER, 'voidcrew/sound/notify.ogg', 50)
stack_trace("Bluespace jump failed to destroy ship [current_ship] - the console has been reset.")
reset_jump()

/obj/machinery/computer/helm/connect_to_shuttle(mapload, obj/docking_port/mobile/voidcrew/port, obj/docking_port/stationary/dock)
if(!istype(port))
return
Expand Down Expand Up @@ -1279,15 +1182,6 @@
else
current_ship.command_course(BURN_STOP)
return
if("bluespace_jump")
if(calibrating)
cancel_jump()
return
else
if(tgui_alert(usr, "Do you want to bluespace jump? Your ship and everything on it will be removed from the round.", "Jump Confirmation", list("Yes", "No")) != "Yes")
return
calibrate_jump()
return
if("dock")
// Dock into whatever is actually here. Previously this refused
// outright whenever a ruin or planet shared the tile, so the only
Expand Down Expand Up @@ -1384,7 +1278,7 @@
// eats every button without a word is indistinguishable from a broken one -
// and until complete_dock() learned to give up (abort_stalled_dock() in
// ship.dm) a stalled move really could pin the ship here for good.
if(action in list("dock", "undock", "change_heading", "set_course", "stop", "autopilot", "autopilot_cancel", "change_burn_percentage", "toggle_engine", "bluespace_jump", "active_scan", "act_overmap", "hide_in_nebula", "cancel_nebula_hide", "unhide_from_nebula"))
if(action in list("dock", "undock", "change_heading", "set_course", "stop", "autopilot", "autopilot_cancel", "change_burn_percentage", "toggle_engine", "active_scan", "act_overmap", "hide_in_nebula", "cancel_nebula_hide", "unhide_from_nebula"))
say("Manoeuvring systems busy: [current_ship.get_state_readout()]. Stand by.")
playsound(src, 'sound/machines/terminal/terminal_error.ogg', 30)
return
Expand All @@ -1394,12 +1288,5 @@
#undef HELM_DRUNK_CHANCE_PER_POINT
#undef HELM_DRUNK_MAX_CHANCE
#undef HELM_DRUNK_THRESHOLD
#undef JUMP_STATE_OFF
#undef JUMP_STATE_CHARGING
#undef JUMP_STATE_IONIZING
#undef JUMP_STATE_FIRING
#undef JUMP_STATE_FINALIZED
#undef JUMP_CHARGE_DELAY
#undef JUMP_CHARGEUP_TIME
#undef HAIL_SEND_COOLDOWN
#undef TYPING_SOUND_COOLDOWN
Loading
Loading