Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
ihatethisengine committed Feb 25, 2024
1 parent 25f0201 commit 7fe29a4
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 13 deletions.
5 changes: 5 additions & 0 deletions code/__DEFINES/dropships.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@
#define DROPSHIP_MIN_AUTO_DELAY 10 SECONDS
#define DROPSHIP_AUTO_RETRY_COOLDOWN 20 SECONDS
#define DROPSHIP_MEDEVAC_COOLDOWN 20 SECONDS

//Hatches states
#define SHUTTLE_DOOR_BROKEN -1
#define SHUTTLE_DOOR_UNLOCKED 0
#define SHUTTLE_DOOR_LOCKED 1
14 changes: 14 additions & 0 deletions code/game/machinery/doors/multi_tile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@
no_panel = 1
not_weldable = 1
var/queen_pryable = TRUE
var/obj/docking_port/mobile/marine_dropship/linked_dropship


/obj/structure/machinery/door/airlock/multi_tile/almayer/dropshiprear/ex_act(severity)
return
Expand All @@ -266,6 +268,18 @@
unlock(TRUE)
open(1)
lock(TRUE)
var/direction
switch(id)
if("starboard_door")
direction = "starboard"
if("port_door")
direction = "port"
if("aft_door")
direction = "aft"
if(linked_dropship && linked_dropship.door_control.door_controllers[direction])
var/datum/door_controller/single/control = linked_dropship.door_control.door_controllers[direction]
control.status = SHUTTLE_DOOR_BROKEN


/obj/structure/machinery/door/airlock/multi_tile/almayer/dropshiprear/ds1
name = "\improper Alamo cargo door"
Expand Down
2 changes: 1 addition & 1 deletion code/modules/shuttle/computers/escape_pod_computer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
.["docking_status"] = STATE_LAUNCHED
var/obj/structure/machinery/door/door = shuttle.door_handler.doors[1]
.["door_state"] = door.density
.["door_lock"] = shuttle.door_handler.is_locked
.["door_lock"] = shuttle.door_handler.status == SHUTTLE_DOOR_LOCKED
.["can_delay"] = TRUE//launch_status[2]
.["launch_without_evac"] = launch_without_evac

Expand Down
28 changes: 17 additions & 11 deletions code/modules/shuttle/helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
if(!door_controllers[direction])
var/datum/door_controller/single/new_controller = new()
new_controller.label = label
new_controller.is_locked = FALSE
new_controller.status = SHUTTLE_DOOR_UNLOCKED
door_controllers[direction] = new_controller

var/datum/door_controller/single/controller = door_controllers[direction]
Expand All @@ -29,12 +29,12 @@
if(direction == "all")
for(var/i in door_controllers)
var/datum/door_controller/single/control = door_controllers[i]
if(!control.is_locked)
if(control.status != SHUTTLE_DOOR_LOCKED)
return FALSE
return TRUE
if(door_controllers[direction])
var/datum/door_controller/single/single_controller = door_controllers[direction]
return single_controller.is_locked
return single_controller.status == 1
else
WARNING("Direction [direction] does not exist.")
return FALSE
Expand All @@ -60,9 +60,9 @@

for(var/direction in door_controllers)
var/datum/door_controller/single/controller = door_controllers[direction]
var/list/door_data = list("id" = direction, "value" = controller.is_locked)
var/list/door_data = list("id" = direction, "value" = controller.status)
. += list(door_data)
if(!controller.is_locked)
if(controller.status == SHUTTLE_DOOR_UNLOCKED)
all_locked = FALSE

var/list/door_data = list("id" = "all", "value" = all_locked)
Expand All @@ -74,7 +74,7 @@
/datum/door_controller/single
var/label = "dropship"
var/list/doors = list()
var/is_locked = FALSE
var/status = SHUTTLE_DOOR_UNLOCKED

/datum/door_controller/single/Destroy(force, ...)
. = ..()
Expand All @@ -93,23 +93,29 @@
if("close")
INVOKE_ASYNC(door, TYPE_PROC_REF(/obj/structure/machinery/door/airlock, close))
if("force-lock")
if (status == SHUTTLE_DOOR_BROKEN)
continue
INVOKE_ASYNC(src, PROC_REF(lockdown_door), door)
is_locked = TRUE
status = SHUTTLE_DOOR_LOCKED
if("lock")
INVOKE_ASYNC(door, TYPE_PROC_REF(/obj/structure/machinery/door/airlock, lock))
is_locked = TRUE
if (status != SHUTTLE_DOOR_BROKEN)
status = SHUTTLE_DOOR_LOCKED
if("unlock")
INVOKE_ASYNC(door, TYPE_PROC_REF(/obj/structure/machinery/door/airlock, unlock))
is_locked = FALSE
if (status != SHUTTLE_DOOR_BROKEN)
status = SHUTTLE_DOOR_UNLOCKED
if("force-lock-launch")
if(asynchronous)
INVOKE_ASYNC(src, PROC_REF(lockdown_door_launch), door)
else
lockdown_door_launch(door)
is_locked = TRUE
if (status != SHUTTLE_DOOR_BROKEN)
status = SHUTTLE_DOOR_LOCKED
if("force-unlock")
INVOKE_ASYNC(src, PROC_REF(force_lock_open_door), door)
is_locked = FALSE
if (status != SHUTTLE_DOOR_BROKEN)
status = SHUTTLE_DOOR_UNLOCKED
else
CRASH("Unknown door command [action]")

Expand Down
3 changes: 3 additions & 0 deletions code/modules/shuttle/shuttles/dropship.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
door_control.add_door(air, "port")
if("aft_door")
door_control.add_door(air, "aft")
var/obj/structure/machinery/door/airlock/multi_tile/almayer/dropshiprear/hatch = air
if(istype(hatch))
hatch.linked_dropship = src

RegisterSignal(src, COMSIG_DROPSHIP_ADD_EQUIPMENT, PROC_REF(add_equipment))
RegisterSignal(src, COMSIG_DROPSHIP_REMOVE_EQUIPMENT, PROC_REF(remove_equipment))
Expand Down
3 changes: 2 additions & 1 deletion tgui/packages/tgui/interfaces/DropshipFlightControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { LaunchButton, CancelLaunchButton, DisabledScreen, InFlightCountdown, La

interface DoorStatus {
id: string;
value: 0 | 1;
value: -1 | 0 | 1;
}

interface AutomatedControl {
Expand Down Expand Up @@ -77,6 +77,7 @@ const DropshipDoorControl = () => {
return (
<Stack.Item key={x.id}>
<>
{x.value === -1 && <Button icon="ban">No response</Button>}
{x.value === 0 && (
<Button
onClick={() =>
Expand Down

0 comments on commit 7fe29a4

Please sign in to comment.