mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-30 00:29:02 +01:00
[MIRROR] Immovable rod meets unstoppable tram [MDB IGNORE] (#23299)
* Immovable rod meets unstoppable tram (#77656) ## About The Pull Request Adds interaction between immovable rod and the tram for the rare occasions the rod hits it at the front or back while flying at a parallel angle. The rod will push/pull the tram in the direction it's flying until a short distance past the tram's usual landmark, eventually winning and carrying on. - Only applies to random rods, if the rod has a target it will ignore the tram as usual. - Looping rod only pushes the tram once. - As long as the tram has power, can be returned to the rails as usual by calling it. ## Why It's Good For The Game When the HoP is having a really unlucky day. https://github.com/tgstation/tgstation/assets/83487515/2f0393cd-f796-4b00-8674-d97e57358543 https://github.com/tgstation/tgstation/assets/83487515/f74c8497-8d62-4fcf-80a0-da7259160b7f ## Changelog 🆑 LT3 add: Immovable rod will now battle the unstoppable tram should they cross paths fix: Birdshot's maint tram doors now work properly fix: Tramstation's exterior light fixtures no longer get destroyed as soon as the tram moves code: Tram landmarks are now all subtyped instead of map varedits /🆑 * Immovable rod meets unstoppable tram --------- Co-authored-by: lessthanthree <83487515+lessthnthree@users.noreply.github.com>
This commit is contained in:
co-authored by
lessthanthree
parent
3f9fec7b03
commit
a4fae9cdb5
@@ -329,7 +329,8 @@
|
||||
bulb_power = 0.6
|
||||
},
|
||||
/obj/structure/industrial_lift/tram/purple,
|
||||
/obj/effect/landmark/tram/hilbert/middle,
|
||||
/obj/effect/landmark/tram/platform/hilbert/middle,
|
||||
/obj/effect/landmark/tram/nav/hilbert/research,
|
||||
/turf/open/floor/engine,
|
||||
/area/ruin/space/has_grav/powered/hilbertresearchfacility)
|
||||
"iY" = (
|
||||
@@ -936,6 +937,10 @@
|
||||
},
|
||||
/turf/open/floor/mineral/titanium/tiled/white,
|
||||
/area/ruin/space/has_grav/powered/hilbertresearchfacility)
|
||||
"yf" = (
|
||||
/obj/effect/landmark/tram/nav/immovable_rod,
|
||||
/turf/closed/indestructible/riveted/plastinum,
|
||||
/area/ruin/space/has_grav/powered/hilbertresearchfacility)
|
||||
"yi" = (
|
||||
/obj/structure/table/reinforced/rglass,
|
||||
/obj/item/food/grown/banana,
|
||||
@@ -1156,6 +1161,7 @@
|
||||
/obj/machinery/door/airlock/science{
|
||||
name = "Hilbert's Office"
|
||||
},
|
||||
/obj/effect/landmark/tram/nav/immovable_rod,
|
||||
/turf/open/floor/wood,
|
||||
/area/ruin/space/has_grav/powered/hilbertresearchfacility)
|
||||
"BF" = (
|
||||
@@ -1383,7 +1389,7 @@
|
||||
/turf/open/floor/mineral/plastitanium,
|
||||
/area/ruin/space/has_grav/powered/hilbertresearchfacility)
|
||||
"Gf" = (
|
||||
/obj/effect/landmark/tram/hilbert/right,
|
||||
/obj/effect/landmark/tram/platform/hilbert/right,
|
||||
/turf/open/floor/engine,
|
||||
/area/ruin/space/has_grav/powered/hilbertresearchfacility)
|
||||
"Gi" = (
|
||||
@@ -1477,7 +1483,7 @@
|
||||
/turf/open/floor/grass/fairy,
|
||||
/area/ruin/space/has_grav/powered/hilbertresearchfacility)
|
||||
"It" = (
|
||||
/obj/effect/landmark/tram/hilbert/left,
|
||||
/obj/effect/landmark/tram/platform/hilbert/left,
|
||||
/turf/open/floor/engine,
|
||||
/area/ruin/space/has_grav/powered/hilbertresearchfacility)
|
||||
"Iv" = (
|
||||
@@ -2846,7 +2852,7 @@ Bo
|
||||
Bo
|
||||
Ok
|
||||
CP
|
||||
Bo
|
||||
yf
|
||||
CP
|
||||
Ok
|
||||
Bo
|
||||
|
||||
@@ -18607,7 +18607,8 @@
|
||||
},
|
||||
/obj/structure/industrial_lift/tram,
|
||||
/obj/machinery/door/window/tram/right/directional/north{
|
||||
pixel_y = -25
|
||||
pixel_y = -25;
|
||||
associated_lift = "maint_tram"
|
||||
},
|
||||
/turf/open/floor/noslip/tram_platform,
|
||||
/area/station/maintenance/port/aft)
|
||||
@@ -20581,6 +20582,7 @@
|
||||
/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden/layer4,
|
||||
/obj/machinery/atmospherics/pipe/smart/manifold4w/scrubbers/hidden/layer2,
|
||||
/obj/machinery/firealarm/directional/east,
|
||||
/obj/effect/landmark/tram/nav/immovable_rod,
|
||||
/turf/open/floor/iron,
|
||||
/area/station/hallway/secondary/entry)
|
||||
"hzK" = (
|
||||
@@ -21988,7 +21990,8 @@
|
||||
/obj/structure/industrial_lift/tram,
|
||||
/obj/machinery/door/window/tram/left/directional/north{
|
||||
pixel_x = -32;
|
||||
pixel_y = -25
|
||||
pixel_y = -25;
|
||||
associated_lift = "maint_tram"
|
||||
},
|
||||
/turf/open/floor/noslip/tram_platform,
|
||||
/area/station/maintenance/port/aft)
|
||||
@@ -26875,9 +26878,8 @@
|
||||
/area/station/engineering/supermatter/room)
|
||||
"jMv" = (
|
||||
/obj/structure/industrial_lift/tram,
|
||||
/obj/effect/landmark/tram/birdshot/maint_left{
|
||||
specific_lift_id = "maint_tram"
|
||||
},
|
||||
/obj/effect/landmark/tram/nav/birdshot/maint,
|
||||
/obj/effect/landmark/tram/platform/birdshot/maint_left,
|
||||
/turf/open/floor/noslip/tram_plate,
|
||||
/area/station/maintenance/port/aft)
|
||||
"jMC" = (
|
||||
@@ -28711,10 +28713,9 @@
|
||||
/turf/open/floor/iron,
|
||||
/area/station/hallway/primary/central/fore)
|
||||
"kvb" = (
|
||||
/obj/effect/landmark/tram/birdshot/sec_wing{
|
||||
specific_lift_id = "prison_tram"
|
||||
},
|
||||
/obj/structure/industrial_lift/tram/white,
|
||||
/obj/effect/landmark/tram/nav/birdshot/prison,
|
||||
/obj/effect/landmark/tram/platform/birdshot/sec_wing,
|
||||
/turf/open/floor/noslip/tram_platform,
|
||||
/area/station/security/tram)
|
||||
"kvf" = (
|
||||
@@ -31602,6 +31603,7 @@
|
||||
name = "Prison Garden"
|
||||
},
|
||||
/obj/machinery/door/firedoor,
|
||||
/obj/effect/landmark/tram/nav/immovable_rod,
|
||||
/turf/open/floor/iron/textured_half{
|
||||
dir = 8
|
||||
},
|
||||
@@ -35628,9 +35630,7 @@
|
||||
/turf/open/floor/light/colour_cycle/dancefloor_b,
|
||||
/area/station/maintenance/starboard/central)
|
||||
"mOP" = (
|
||||
/obj/effect/landmark/tram/birdshot/prison_wing{
|
||||
specific_lift_id = "prison_tram"
|
||||
},
|
||||
/obj/effect/landmark/tram/platform/birdshot/prison_wing,
|
||||
/turf/open/floor/noslip/tram_platform,
|
||||
/area/station/security/tram)
|
||||
"mOT" = (
|
||||
@@ -39687,9 +39687,7 @@
|
||||
/turf/open/floor/iron,
|
||||
/area/station/hallway/secondary/dock)
|
||||
"oqS" = (
|
||||
/obj/effect/landmark/tram/birdshot/maint_right{
|
||||
specific_lift_id = "maint_tram"
|
||||
},
|
||||
/obj/effect/landmark/tram/platform/birdshot/maint_right,
|
||||
/turf/open/floor/noslip/tram_plate,
|
||||
/area/station/maintenance/department/medical/central)
|
||||
"oqT" = (
|
||||
@@ -41545,10 +41543,11 @@
|
||||
/turf/open/floor/iron/smooth,
|
||||
/area/station/service/greenroom)
|
||||
"pca" = (
|
||||
/obj/structure/cable,
|
||||
/obj/effect/spawner/structure/window/reinforced,
|
||||
/turf/open/floor/plating,
|
||||
/area/station/maintenance/port/lesser)
|
||||
/obj/machinery/atmospherics/pipe/smart/manifold4w/scrubbers/hidden/layer2,
|
||||
/obj/effect/turf_decal/tile/neutral,
|
||||
/obj/effect/landmark/tram/nav/immovable_rod,
|
||||
/turf/open/floor/iron,
|
||||
/area/station/hallway/primary/port)
|
||||
"pcb" = (
|
||||
/obj/effect/turf_decal/tile/dark_red{
|
||||
dir = 4
|
||||
@@ -45633,6 +45632,11 @@
|
||||
/obj/structure/extinguisher_cabinet/directional/north,
|
||||
/turf/open/floor/iron/cafeteria,
|
||||
/area/station/service/kitchen)
|
||||
"qop" = (
|
||||
/obj/structure/cable,
|
||||
/obj/effect/spawner/structure/window/reinforced,
|
||||
/turf/open/floor/plating,
|
||||
/area/space/nearstation)
|
||||
"qoD" = (
|
||||
/turf/closed/wall/r_wall,
|
||||
/area/station/command/corporate_showroom)
|
||||
@@ -63798,6 +63802,11 @@
|
||||
},
|
||||
/turf/open/floor/iron,
|
||||
/area/station/hallway/primary/central/fore)
|
||||
"wiP" = (
|
||||
/obj/structure/cable,
|
||||
/obj/effect/decal/cleanable/dirt,
|
||||
/turf/open/floor/plating,
|
||||
/area/space/nearstation)
|
||||
"wiT" = (
|
||||
/obj/effect/mapping_helpers/broken_floor,
|
||||
/obj/machinery/newscaster/directional/south,
|
||||
@@ -71056,6 +71065,10 @@
|
||||
/obj/structure/window/spawner/directional/north,
|
||||
/turf/open/floor/plating,
|
||||
/area/station/maintenance/department/engine)
|
||||
"yhE" = (
|
||||
/obj/effect/landmark/tram/nav/immovable_rod,
|
||||
/turf/closed/wall,
|
||||
/area/station/maintenance/port/aft)
|
||||
"yhF" = (
|
||||
/obj/machinery/door/firedoor,
|
||||
/turf/open/floor/iron,
|
||||
@@ -85118,7 +85131,7 @@ uAi
|
||||
fEC
|
||||
rui
|
||||
qVP
|
||||
blb
|
||||
qop
|
||||
xkt
|
||||
nKf
|
||||
mVt
|
||||
@@ -85375,7 +85388,7 @@ xjU
|
||||
fEC
|
||||
kJJ
|
||||
qVP
|
||||
blb
|
||||
wiP
|
||||
xkt
|
||||
kJp
|
||||
pJx
|
||||
@@ -85621,7 +85634,7 @@ tdg
|
||||
wBm
|
||||
wXk
|
||||
bVv
|
||||
xOS
|
||||
pca
|
||||
rQC
|
||||
von
|
||||
vRe
|
||||
@@ -85632,7 +85645,7 @@ tAu
|
||||
fEC
|
||||
rui
|
||||
qVP
|
||||
pca
|
||||
rui
|
||||
qVP
|
||||
llW
|
||||
llW
|
||||
@@ -87732,7 +87745,7 @@ trp
|
||||
trp
|
||||
trp
|
||||
trp
|
||||
trp
|
||||
yhE
|
||||
trp
|
||||
trp
|
||||
trp
|
||||
|
||||
+1246
-1250
File diff suppressed because it is too large
Load Diff
@@ -12,6 +12,9 @@
|
||||
///debug lift_id
|
||||
#define DEBUG_LIFT_ID "debug"
|
||||
|
||||
///used for navigation aids that aren't actual platforms
|
||||
#define TRAM_NAV_BEACONS "tram_nav"
|
||||
#define IMMOVABLE_ROD_DESTINATIONS "immovable_rod"
|
||||
|
||||
//specific_lift_id's
|
||||
///the specific_lift_id of the main station tram landmark for tramstation that spawns roundstart.
|
||||
|
||||
@@ -212,6 +212,8 @@ GLOBAL_LIST_INIT(turfs_openspace, typecacheof(list(
|
||||
|
||||
#define ismachinery(A) (istype(A, /obj/machinery))
|
||||
|
||||
#define istramwall(A) (istype(A, /obj/structure/window/reinforced/tram/front))
|
||||
|
||||
#define isvendor(A) (istype(A, /obj/machinery/vending))
|
||||
|
||||
#define isvehicle(A) (istype(A, /obj/vehicle))
|
||||
|
||||
@@ -26,3 +26,7 @@
|
||||
|
||||
#define BIRDSHOT_MAINTENANCE_LEFT 1
|
||||
#define BRIDSHOT_MAINTENANCE_RIGHT 2
|
||||
|
||||
/// Tram navigation directions
|
||||
#define OUTBOUND 1
|
||||
#define INBOUND -1
|
||||
|
||||
@@ -221,9 +221,12 @@
|
||||
if(!tram || !tram.is_operational) //tram is QDEL or has no power
|
||||
say("The tram is not in service. Please send a technician to repair the internals of the tram.")
|
||||
return
|
||||
if(tram.travelling) //in use
|
||||
if(tram.travelling) //already on its way
|
||||
say("The tram is already travelling to [tram.idle_platform].")
|
||||
return
|
||||
if(tram.controls_locked) //attempting a dispatch or on cooldown
|
||||
say("The tram controller is busy. Try again in a moment.")
|
||||
return
|
||||
if(!destination_platform)
|
||||
return
|
||||
var/obj/effect/landmark/tram/current_location = destination_platform.resolve()
|
||||
@@ -233,5 +236,8 @@
|
||||
say("The tram is already here. Please board the tram and select a destination.")
|
||||
return
|
||||
|
||||
say("The tram has been called to [current_location.name]. Please wait for its arrival.")
|
||||
tram.tram_travel(current_location)
|
||||
if(tram.tram_travel(current_location))
|
||||
say("The tram has been called to [current_location.name]. Please wait for its arrival.")
|
||||
return
|
||||
else
|
||||
say("The tram controller has encountered an error. Try again in a moment.")
|
||||
|
||||
@@ -182,7 +182,12 @@
|
||||
SSexplosions.highturf += clong
|
||||
return ..()
|
||||
|
||||
// If we Bump into the tram front or back, push the tram. Otherwise smash the object as usual.
|
||||
if(isobj(clong))
|
||||
if(istramwall(clong) && !special_target)
|
||||
rod_vs_tram_battle(clong)
|
||||
return ..()
|
||||
|
||||
var/obj/clong_obj = clong
|
||||
clong_obj.take_damage(INFINITY, BRUTE, NONE, TRUE, dir, INFINITY)
|
||||
return ..()
|
||||
@@ -290,3 +295,25 @@
|
||||
/obj/effect/immovablerod/proc/walk_in_direction(direction)
|
||||
destination_turf = get_edge_target_turf(src, direction)
|
||||
SSmove_manager.move_towards(src, destination_turf)
|
||||
|
||||
/**
|
||||
* Rod will push the tram to a landmark if it hits the tram from the front/back
|
||||
* while flying parallel.
|
||||
*/
|
||||
/obj/effect/immovablerod/proc/rod_vs_tram_battle()
|
||||
var/obj/structure/industrial_lift/tram/industrial_lift = locate() in src.loc
|
||||
|
||||
if(isnull(industrial_lift))
|
||||
return
|
||||
|
||||
var/datum/lift_master/tram/lift_master = industrial_lift.lift_master_datum
|
||||
|
||||
if(isnull(lift_master))
|
||||
return
|
||||
|
||||
var/push_target = lift_master.rod_collision(src)
|
||||
|
||||
if(!push_target)
|
||||
return
|
||||
|
||||
go_for_a_walk(push_target)
|
||||
|
||||
@@ -19,44 +19,9 @@ GLOBAL_LIST_EMPTY(tram_landmarks)
|
||||
LAZYREMOVEASSOC(GLOB.tram_landmarks, specific_lift_id, src)
|
||||
return ..()
|
||||
|
||||
//tramstation
|
||||
|
||||
/obj/effect/landmark/tram/tramstation/west
|
||||
name = "West Wing"
|
||||
platform_code = TRAMSTATION_WEST
|
||||
tgui_icons = list("Arrivals" = "plane-arrival", "Command" = "bullhorn", "Security" = "gavel")
|
||||
|
||||
/obj/effect/landmark/tram/tramstation/central
|
||||
name = "Central Wing"
|
||||
platform_code = TRAMSTATION_CENTRAL
|
||||
tgui_icons = list("Service" = "cocktail", "Medical" = "plus", "Engineering" = "wrench")
|
||||
|
||||
/obj/effect/landmark/tram/tramstation/east
|
||||
name = "East Wing"
|
||||
platform_code = TRAMSTATION_EAST
|
||||
tgui_icons = list("Departures" = "plane-departure", "Cargo" = "box", "Science" = "flask")
|
||||
|
||||
//birdshot
|
||||
|
||||
/obj/effect/landmark/tram/birdshot/sec_wing
|
||||
name = "Security Wing"
|
||||
platform_code = BIRDSHOT_SECURITY_WING
|
||||
tgui_icons = list("Security" = "gavel")
|
||||
|
||||
/obj/effect/landmark/tram/birdshot/prison_wing
|
||||
name = "Prison Wing"
|
||||
platform_code = BIRDSHOT_PRISON_WING
|
||||
tgui_icons = list("Prison" = "box")
|
||||
|
||||
/obj/effect/landmark/tram/birdshot/maint_left
|
||||
name = "Port Platform"
|
||||
platform_code = BIRDSHOT_MAINTENANCE_LEFT
|
||||
tgui_icons = list("Port Platform" = "plane-departure")
|
||||
|
||||
/obj/effect/landmark/tram/birdshot/maint_right
|
||||
name = "Starboard Platform"
|
||||
platform_code = BRIDSHOT_MAINTENANCE_RIGHT
|
||||
tgui_icons = list("Starboard Platform" = "plane-arrival")
|
||||
/obj/effect/landmark/tram/nav
|
||||
name = "tram nav beacon"
|
||||
invisibility = INVISIBILITY_MAXIMUM // nav aids can't be abstract since they stay with the tram
|
||||
|
||||
/**
|
||||
* lift_id landmarks. used to map in specific_lift_id to trams. when the trams lift_master encounters one on a trams tile
|
||||
@@ -65,6 +30,80 @@ GLOBAL_LIST_EMPTY(tram_landmarks)
|
||||
/obj/effect/landmark/lift_id
|
||||
name = "lift id setter"
|
||||
icon_state = "lift_id"
|
||||
|
||||
///what specific id we give to the tram we're placed on, should explicitely set this if its a subtype, or weird things might happen
|
||||
///what specific id we give to the tram we're placed on, should explicitly set this if its a subtype, or weird things might happen
|
||||
var/specific_lift_id = MAIN_STATION_TRAM
|
||||
|
||||
//tramstation
|
||||
|
||||
/obj/effect/landmark/tram/nav/tramstation/main
|
||||
name = MAIN_STATION_TRAM
|
||||
specific_lift_id = TRAM_NAV_BEACONS
|
||||
dir = WEST
|
||||
|
||||
/obj/effect/landmark/tram/platform/tramstation/west
|
||||
name = "West Wing"
|
||||
platform_code = TRAMSTATION_WEST
|
||||
tgui_icons = list("Arrivals" = "plane-arrival", "Command" = "bullhorn", "Security" = "gavel")
|
||||
|
||||
/obj/effect/landmark/tram/platform/tramstation/central
|
||||
name = "Central Wing"
|
||||
platform_code = TRAMSTATION_CENTRAL
|
||||
tgui_icons = list("Service" = "cocktail", "Medical" = "plus", "Engineering" = "wrench")
|
||||
|
||||
/obj/effect/landmark/tram/platform/tramstation/east
|
||||
name = "East Wing"
|
||||
platform_code = TRAMSTATION_EAST
|
||||
tgui_icons = list("Departures" = "plane-departure", "Cargo" = "box", "Science" = "flask")
|
||||
|
||||
//map-agnostic landmarks
|
||||
|
||||
/obj/effect/landmark/tram/nav/immovable_rod
|
||||
name = "DESTINATION/NOT/FOUND"
|
||||
specific_lift_id = IMMOVABLE_ROD_DESTINATIONS
|
||||
|
||||
/obj/effect/landmark/tram/nav/hilbert/research
|
||||
name = HILBERT_TRAM
|
||||
specific_lift_id = TRAM_NAV_BEACONS
|
||||
dir = WEST
|
||||
|
||||
//birdshot
|
||||
|
||||
/obj/effect/landmark/lift_id/birdshot/prison
|
||||
specific_lift_id = PRISON_TRAM
|
||||
|
||||
/obj/effect/landmark/lift_id/birdshot/maint
|
||||
specific_lift_id = MAINTENANCE_TRAM
|
||||
|
||||
/obj/effect/landmark/tram/nav/birdshot/prison
|
||||
name = PRISON_TRAM
|
||||
specific_lift_id = TRAM_NAV_BEACONS
|
||||
dir = NORTH
|
||||
|
||||
/obj/effect/landmark/tram/nav/birdshot/maint
|
||||
name = MAINTENANCE_TRAM
|
||||
specific_lift_id = TRAM_NAV_BEACONS
|
||||
dir = WEST
|
||||
|
||||
/obj/effect/landmark/tram/platform/birdshot/sec_wing
|
||||
name = "Security Wing"
|
||||
specific_lift_id = PRISON_TRAM
|
||||
platform_code = BIRDSHOT_SECURITY_WING
|
||||
tgui_icons = list("Security" = "gavel")
|
||||
|
||||
/obj/effect/landmark/tram/platform/birdshot/prison_wing
|
||||
name = "Prison Wing"
|
||||
specific_lift_id = PRISON_TRAM
|
||||
platform_code = BIRDSHOT_PRISON_WING
|
||||
tgui_icons = list("Prison" = "box")
|
||||
|
||||
/obj/effect/landmark/tram/platform/birdshot/maint_left
|
||||
name = "Port Platform"
|
||||
specific_lift_id = MAINTENANCE_TRAM
|
||||
platform_code = BIRDSHOT_MAINTENANCE_LEFT
|
||||
tgui_icons = list("Port Platform" = "plane-departure")
|
||||
|
||||
/obj/effect/landmark/tram/platform/birdshot/maint_right
|
||||
name = "Starboard Platform"
|
||||
specific_lift_id = MAINTENANCE_TRAM
|
||||
platform_code = BRIDSHOT_MAINTENANCE_RIGHT
|
||||
tgui_icons = list("Starboard Platform" = "plane-arrival")
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
/// and the destination landmark.
|
||||
var/obj/effect/landmark/tram/idle_platform
|
||||
|
||||
/// a navigational landmark that we use to find the tram's location on the map at any time
|
||||
var/obj/effect/landmark/tram/nav/nav_beacon
|
||||
|
||||
///decisecond delay between horizontal movement. cannot make the tram move faster than 1 movement per world.tick_lag.
|
||||
///this var is poorly named its actually horizontal movement delay but whatever.
|
||||
var/horizontal_speed = 0.5
|
||||
@@ -58,14 +61,18 @@
|
||||
/datum/lift_master/tram/check_for_landmarks(obj/structure/industrial_lift/tram/new_lift_platform)
|
||||
. = ..()
|
||||
for(var/turf/platform_loc as anything in new_lift_platform.locs)
|
||||
var/obj/effect/landmark/tram/initial_destination = locate() in platform_loc
|
||||
var/obj/effect/landmark/tram/platform/initial_destination = locate() in platform_loc
|
||||
var/obj/effect/landmark/tram/nav/beacon = locate() in platform_loc
|
||||
|
||||
if(initial_destination)
|
||||
idle_platform = initial_destination
|
||||
|
||||
if(initial_destination)
|
||||
nav_beacon = beacon
|
||||
|
||||
/datum/lift_master/tram/proc/check_starting_landmark()
|
||||
if(!idle_platform)
|
||||
CRASH("a tram lift_master was initialized without any tram landmark to give it direction!")
|
||||
if(!idle_platform || !nav_beacon)
|
||||
CRASH("a tram lift_master was initialized without the required landmarks to give it direction!")
|
||||
|
||||
SStramprocess.can_fire = TRUE
|
||||
|
||||
@@ -114,19 +121,21 @@
|
||||
*/
|
||||
/datum/lift_master/tram/proc/tram_travel(obj/effect/landmark/tram/destination_platform, rapid = FALSE)
|
||||
if(destination_platform == idle_platform)
|
||||
return
|
||||
return FALSE
|
||||
|
||||
travel_direction = get_dir(idle_platform, destination_platform)
|
||||
travel_distance = get_dist(idle_platform, destination_platform)
|
||||
travel_direction = get_dir(nav_beacon, destination_platform)
|
||||
travel_distance = get_dist(nav_beacon, destination_platform)
|
||||
travel_trip_length = travel_distance
|
||||
idle_platform = destination_platform
|
||||
set_travelling(TRUE)
|
||||
set_controls(LIFT_PLATFORM_LOCKED)
|
||||
if(rapid) // bypass for unsafe, rapid departure
|
||||
dispatch_tram(destination_platform)
|
||||
return TRUE
|
||||
else
|
||||
update_tram_doors(CLOSE_DOORS)
|
||||
addtimer(CALLBACK(src, PROC_REF(dispatch_tram), destination_platform), 3 SECONDS)
|
||||
return TRUE
|
||||
|
||||
/datum/lift_master/tram/proc/dispatch_tram(obj/effect/landmark/tram/destination_platform)
|
||||
SEND_SIGNAL(src, COMSIG_TRAM_TRAVEL, idle_platform, destination_platform)
|
||||
@@ -219,3 +228,103 @@
|
||||
|
||||
else
|
||||
stack_trace("Tram doors update_tram_doors called with an improper action ([action]).")
|
||||
|
||||
/datum/lift_master/tram/proc/set_operational(new_value)
|
||||
if(is_operational != new_value)
|
||||
is_operational = new_value
|
||||
|
||||
/**
|
||||
* Returns the closest tram nav beacon to an atom
|
||||
*
|
||||
* Creates a list of nav beacons in the requested direction
|
||||
* and returns the closest to be passed to the industrial_lift
|
||||
*
|
||||
* Arguments: source: the starting point to find a beacon
|
||||
* travel_dir: travel direction in tram form, INBOUND or OUTBOUND
|
||||
* beacon_type: what list of beacons we pull from
|
||||
*/
|
||||
/datum/lift_master/tram/proc/closest_nav_in_travel_dir(atom/origin, travel_dir, beacon_type)
|
||||
if(!istype(origin) || !origin.z)
|
||||
return FALSE
|
||||
|
||||
var/list/obj/effect/landmark/tram/nav/inbound_candidates = list()
|
||||
var/list/obj/effect/landmark/tram/nav/outbound_candidates = list()
|
||||
|
||||
for(var/obj/effect/landmark/tram/nav/candidate_beacon in GLOB.tram_landmarks[beacon_type])
|
||||
if(candidate_beacon.z != origin.z || candidate_beacon.z != nav_beacon.z)
|
||||
continue
|
||||
|
||||
switch(nav_beacon.dir)
|
||||
if(EAST, WEST)
|
||||
if(candidate_beacon.y != nav_beacon.y)
|
||||
continue
|
||||
else if(candidate_beacon.x < nav_beacon.x)
|
||||
inbound_candidates += candidate_beacon
|
||||
else
|
||||
outbound_candidates += candidate_beacon
|
||||
if(NORTH, SOUTH)
|
||||
if(candidate_beacon.x != nav_beacon.x)
|
||||
continue
|
||||
else if(candidate_beacon.y < nav_beacon.y)
|
||||
inbound_candidates += candidate_beacon
|
||||
else
|
||||
outbound_candidates += candidate_beacon
|
||||
|
||||
switch(travel_dir)
|
||||
if(INBOUND)
|
||||
var/obj/effect/landmark/tram/nav/selected = get_closest_atom(/obj/effect/landmark/tram/nav, inbound_candidates, origin)
|
||||
if(selected)
|
||||
return selected
|
||||
stack_trace("No inbound beacon candidate found for [origin]. Cancelling dispatch.")
|
||||
return FALSE
|
||||
|
||||
if(OUTBOUND)
|
||||
var/obj/effect/landmark/tram/nav/selected = get_closest_atom(/obj/effect/landmark/tram/nav, outbound_candidates, origin)
|
||||
if(selected)
|
||||
return selected
|
||||
stack_trace("No outbound beacon candidate found for [origin]. Cancelling dispatch.")
|
||||
return FALSE
|
||||
|
||||
else
|
||||
stack_trace("Tram receieved invalid travel direction [travel_dir]. Cancelling dispatch.")
|
||||
|
||||
return FALSE
|
||||
|
||||
/**
|
||||
* Moves the tram when hit by an immovable rod
|
||||
*
|
||||
* Tells the individual tram parts where to actually go and has an extra safety checks
|
||||
* incase multiple inputs get through, preventing conflicting directions and the tram
|
||||
* literally ripping itself apart. all of the actual movement is handled by SStramprocess
|
||||
*
|
||||
* Arguments: collided_rod (the immovable rod that hit the tram)
|
||||
* Return: push_destination (the landmark /obj/effect/landmark/tram/nav that the tram is being pushed to due to the rod's trajectory)
|
||||
*/
|
||||
/datum/lift_master/tram/proc/rod_collision(obj/effect/immovablerod/collided_rod)
|
||||
if(!is_operational)
|
||||
return
|
||||
var/rod_velocity_sign
|
||||
// Determine inbound or outbound
|
||||
if(collided_rod.dir & (NORTH|SOUTH))
|
||||
rod_velocity_sign = collided_rod.dir & NORTH ? OUTBOUND : INBOUND
|
||||
else
|
||||
rod_velocity_sign = collided_rod.dir & EAST ? OUTBOUND : INBOUND
|
||||
|
||||
var/obj/effect/landmark/tram/nav/push_destination = closest_nav_in_travel_dir(origin = nav_beacon, travel_dir = rod_velocity_sign, beacon_type = IMMOVABLE_ROD_DESTINATIONS)
|
||||
if(!push_destination)
|
||||
return
|
||||
travel_direction = get_dir(nav_beacon, push_destination)
|
||||
travel_distance = get_dist(nav_beacon, push_destination)
|
||||
travel_trip_length = travel_distance
|
||||
idle_platform = push_destination
|
||||
// Don't bother processing crossing signals, where this tram's going there are no signals
|
||||
for(var/obj/machinery/crossing_signal/xing as anything in GLOB.tram_signals)
|
||||
xing.temp_malfunction()
|
||||
priority_announce("In a turn of rather peculiar events, it appears that [GLOB.station_name] has struck an immovable rod. (Don't ask us where it came from.) This has led to a station brakes failure on one of the tram platforms.\n\n\
|
||||
Our diligent team of engineers have been informed and they're rushing over - although not quite at the speed of our recently flying tram.\n\n\
|
||||
So while we all look in awe at the universe's mysterious sense of humour, please stand clear of the tracks and remember to stand behind the yellow line.", "Braking News")
|
||||
set_travelling(TRUE)
|
||||
set_controls(LIFT_PLATFORM_LOCKED)
|
||||
dispatch_tram(destination_platform = push_destination)
|
||||
set_operational(FALSE)
|
||||
return push_destination
|
||||
|
||||
@@ -144,7 +144,8 @@ GLOBAL_LIST_EMPTY(tram_doors)
|
||||
return FALSE
|
||||
if(tram_part.controls_locked || tram_part.travelling) // someone else started already
|
||||
return FALSE
|
||||
tram_part.tram_travel(destination_platform)
|
||||
if(!tram_part.tram_travel(destination_platform))
|
||||
return FALSE // lift_master failure
|
||||
say("The next station is: [destination_platform.name]")
|
||||
update_appearance()
|
||||
return TRUE
|
||||
@@ -412,6 +413,10 @@ GLOBAL_LIST_EMPTY(tram_doors)
|
||||
malfunctioning = FALSE
|
||||
process()
|
||||
|
||||
/obj/machinery/crossing_signal/proc/temp_malfunction()
|
||||
start_malfunction()
|
||||
addtimer(CALLBACK(src, PROC_REF(end_malfunction)), 15 SECONDS)
|
||||
|
||||
/**
|
||||
* Finds the tram, just like the tram computer
|
||||
*
|
||||
@@ -692,44 +697,44 @@ GLOBAL_LIST_EMPTY(tram_doors)
|
||||
return PROCESS_KILL
|
||||
|
||||
if(!tram.travelling)
|
||||
if(istype(tram.idle_platform, /obj/effect/landmark/tram/tramstation/west))
|
||||
if(istype(tram.idle_platform, /obj/effect/landmark/tram/platform/tramstation/west))
|
||||
icon_state = "[base_icon_state][DESTINATION_WEST_IDLE]"
|
||||
light_mask = "[base_icon_state][DESTINATION_WEST_IDLE]_e"
|
||||
previous_destination = tram.idle_platform
|
||||
update_appearance()
|
||||
return PROCESS_KILL
|
||||
|
||||
if(istype(tram.idle_platform, /obj/effect/landmark/tram/tramstation/central))
|
||||
if(istype(tram.idle_platform, /obj/effect/landmark/tram/platform/tramstation/central))
|
||||
icon_state = "[base_icon_state][DESTINATION_CENTRAL_IDLE]"
|
||||
light_mask = "[base_icon_state][DESTINATION_CENTRAL_IDLE]_e"
|
||||
previous_destination = tram.idle_platform
|
||||
update_appearance()
|
||||
return PROCESS_KILL
|
||||
|
||||
if(istype(tram.idle_platform, /obj/effect/landmark/tram/tramstation/east))
|
||||
if(istype(tram.idle_platform, /obj/effect/landmark/tram/platform/tramstation/east))
|
||||
icon_state = "[base_icon_state][DESTINATION_EAST_IDLE]"
|
||||
light_mask = "[base_icon_state][DESTINATION_EAST_IDLE]_e"
|
||||
previous_destination = tram.idle_platform
|
||||
update_appearance()
|
||||
return PROCESS_KILL
|
||||
|
||||
if(istype(tram.idle_platform, /obj/effect/landmark/tram/tramstation/west))
|
||||
if(istype(tram.idle_platform, /obj/effect/landmark/tram/platform/tramstation/west))
|
||||
icon_state = "[base_icon_state][DESTINATION_WEST_ACTIVE]"
|
||||
light_mask = "[base_icon_state][DESTINATION_WEST_ACTIVE]_e"
|
||||
update_appearance()
|
||||
return PROCESS_KILL
|
||||
|
||||
if(istype(tram.idle_platform, /obj/effect/landmark/tram/tramstation/central))
|
||||
if(istype(previous_destination, /obj/effect/landmark/tram/tramstation/west))
|
||||
if(istype(tram.idle_platform, /obj/effect/landmark/tram/platform/tramstation/central))
|
||||
if(istype(previous_destination, /obj/effect/landmark/tram/platform/tramstation/west))
|
||||
icon_state = "[base_icon_state][DESTINATION_CENTRAL_EASTBOUND_ACTIVE]"
|
||||
light_mask = "[base_icon_state][DESTINATION_CENTRAL_EASTBOUND_ACTIVE]_e"
|
||||
if(istype(previous_destination, /obj/effect/landmark/tram/tramstation/east))
|
||||
if(istype(previous_destination, /obj/effect/landmark/tram/platform/tramstation/east))
|
||||
icon_state = "[base_icon_state][DESTINATION_CENTRAL_WESTBOUND_ACTIVE]"
|
||||
light_mask = "[base_icon_state][DESTINATION_CENTRAL_WESTBOUND_ACTIVE]_e"
|
||||
update_appearance()
|
||||
return PROCESS_KILL
|
||||
|
||||
if(istype(tram.idle_platform, /obj/effect/landmark/tram/tramstation/east))
|
||||
if(istype(tram.idle_platform, /obj/effect/landmark/tram/platform/tramstation/east))
|
||||
icon_state = "[base_icon_state][DESTINATION_EAST_ACTIVE]"
|
||||
light_mask = "[base_icon_state][DESTINATION_EAST_ACTIVE]_e"
|
||||
update_appearance()
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#define TRAMCTRL_INBOUND 1
|
||||
#define TRAMCTRL_OUTBOUND 0
|
||||
#define TRAMCTRL_FAST 1
|
||||
#define TRAMCTRL_SAFE 0
|
||||
|
||||
@@ -13,7 +11,7 @@
|
||||
desc = "A remote control that can be linked to a tram. This can only go well."
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
///desired tram direction
|
||||
var/direction = TRAMCTRL_INBOUND
|
||||
var/direction = INBOUND
|
||||
///fast and fun, or safe and boring
|
||||
var/mode = TRAMCTRL_FAST
|
||||
///weakref to the tram piece we control
|
||||
@@ -37,10 +35,10 @@
|
||||
///set tram control direction
|
||||
/obj/item/tram_remote/attack_self_secondary(mob/user)
|
||||
switch(direction)
|
||||
if(TRAMCTRL_INBOUND)
|
||||
direction = TRAMCTRL_OUTBOUND
|
||||
if(TRAMCTRL_OUTBOUND)
|
||||
direction = TRAMCTRL_INBOUND
|
||||
if(INBOUND)
|
||||
direction = OUTBOUND
|
||||
if(OUTBOUND)
|
||||
direction = INBOUND
|
||||
update_appearance()
|
||||
balloon_alert(user, "[direction ? "< inbound" : "outbound >"]")
|
||||
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
|
||||
@@ -77,9 +75,9 @@
|
||||
icon_state = "tramremote_nis"
|
||||
return
|
||||
switch(direction)
|
||||
if(TRAMCTRL_INBOUND)
|
||||
if(INBOUND)
|
||||
icon_state = "tramremote_ib"
|
||||
if(TRAMCTRL_OUTBOUND)
|
||||
if(OUTBOUND)
|
||||
icon_state = "tramremote_ob"
|
||||
|
||||
/obj/item/tram_remote/update_overlays()
|
||||
@@ -107,9 +105,9 @@
|
||||
var/destination_platform = null
|
||||
var/platform = 0
|
||||
switch(direction)
|
||||
if(TRAMCTRL_INBOUND)
|
||||
if(INBOUND)
|
||||
platform = clamp(tram_part.idle_platform.platform_code - 1, 1, INFINITY)
|
||||
if(TRAMCTRL_OUTBOUND)
|
||||
if(OUTBOUND)
|
||||
platform = clamp(tram_part.idle_platform.platform_code + 1, 1, INFINITY)
|
||||
if(platform == tram_part.idle_platform.platform_code)
|
||||
balloon_alert(user, "invalid command!")
|
||||
@@ -148,7 +146,5 @@
|
||||
balloon_alert(user, "link failed!")
|
||||
update_appearance()
|
||||
|
||||
#undef TRAMCTRL_INBOUND
|
||||
#undef TRAMCTRL_OUTBOUND
|
||||
#undef TRAMCTRL_FAST
|
||||
#undef TRAMCTRL_SAFE
|
||||
|
||||
@@ -527,22 +527,26 @@ GLOBAL_VAR_INIT(hhMysteryRoomNumber, rand(1, 999999))
|
||||
to_chat(user, "No vacated rooms.")
|
||||
return .
|
||||
|
||||
/obj/effect/landmark/lift_id/hilbert
|
||||
/obj/effect/landmark/lift_id/hilbert/research
|
||||
specific_lift_id = HILBERT_TRAM
|
||||
|
||||
/obj/effect/landmark/tram/hilbert/left
|
||||
/obj/effect/landmark/tram/nav/hilbert/research
|
||||
name = HILBERT_TRAM
|
||||
specific_lift_id = TRAM_NAV_BEACONS
|
||||
|
||||
/obj/effect/landmark/tram/platform/hilbert/left
|
||||
name = "Port"
|
||||
specific_lift_id = HILBERT_TRAM
|
||||
platform_code = HILBERT_PORT
|
||||
tgui_icons = list("Reception" = "briefcase", "Botany" = "leaf", "Chemistry" = "flask")
|
||||
|
||||
/obj/effect/landmark/tram/hilbert/middle
|
||||
/obj/effect/landmark/tram/platform/hilbert/middle
|
||||
name = "Central"
|
||||
specific_lift_id = HILBERT_TRAM
|
||||
platform_code = HILBERT_CENTRAL
|
||||
tgui_icons = list("Processing" = "cogs", "Xenobiology" = "paw")
|
||||
|
||||
/obj/effect/landmark/tram/hilbert/right
|
||||
/obj/effect/landmark/tram/platform/hilbert/right
|
||||
name = "Starboard"
|
||||
specific_lift_id = HILBERT_TRAM
|
||||
platform_code = HILBERT_STARBOARD
|
||||
|
||||
Reference in New Issue
Block a user