Files
ReddeyfishVor 768887d85a Virgo merge (#107)
* Move pilot helmets from southern_cross to main files, they are used on multiple maps now.

* Ports export reports (#5051)

* Ports export reports

* Absolute pathing, small touchups

* remove both layers

* POLARIS: No string compare for assistants

* Make turf obfuscation lists lazy

* Improve two image cleanups

* POLARIS: zshadows should be as invisible as their origin

* POLARIS: Allow alteration of mob default see_invisible

* say() safety check on client

Spawn keeps it from destroying all say(), thankfully, but needs to be fixed.

* POLARIS: Reduce double admin logs

* POLARIS: Clean up adminpm logs

* POLARIS: Communicator small refactor

* POLARIS: UI Tweak involving species rarity

* POLARIS: Allow species-specific statpanels

* POLARIS: "0x32" is not a valid single-bit flag

* POLARIS: Lazylen species restricted list

* POLARIS: Prevent ghosts from ejecting borgs from rechargers

* POLARIS: Make borg recharger test more robust

* POLARIS: Another recharger fix

* Fix nif logs

* Removes some problematic HIDEJUMPSUIT flags

* Camera fix

* adds statue

* adds statue

* Revert "adds statue"

This reverts commit f1c9193797.

* POLARIS: Improve robot and typing overlays

* Change to Teshari to test for bug

Removing these, to see if they are related to the Teshari bug. These are the only two unique sprite features that I can see.

* Promethean tweaks (hunger, regen time)

* Xenoarch Multitool & Xenoarch Excavation Drill (#5058)

* Xenoarch Multitool & Xenoarch Excavation Drill

* Makes the tool work better

* Cuts down on lines & left comments

* change to m

* Ports antibiotics overhaul (#5050)

* Ports antibiotics overhaul

* Update the rest of the places "spaceacillin" is used where antibiotics is meant.

* Antibiotics port compiles

* Fixes the drone borg ID thing AGAIN. (#5080)

* Fixes the drone borg ID thing

* Updates tracking implant description

* Update tools_pickaxe_vr.dm

* Removes excavation drill

* Fixes default synth tails necessitating potentially harmful mystery delays in mannequin generation.
-Now get_tail_image() can check the owner's syntheticness without having to wait for something else to call it whenever/wherever the fuck it happens.

* Fixes missing pixel on human ass.

* Update update_icons_vr.dm

* absolute pathing

* added slashes. No idea for what, but I don't want anyone to ask me to do it because they have OCD

* Some size stuff for Proteans

* Removes a bunch of my unused fluff stuff

* fixed vale borg flashlight eye sprites

* Changes to objects random

- Fixed the icon_state for 'structure/plushie/carp' and the random first aid kit spawner
- Added a random chance tool spawn for power tools (most of the time it should still just be regular tools)
- Adjusted the spawn rate of medkits, combat medkits should be more rare
- Cash split into its own loot item
- Plushies split into large and small plushies
- All the extra plushie spawns added to the random plushie spawn
- Eightball and conch shell added to toy spawns
- Added spawn points for the large plushies, cash, and the power tools

* Removes an inconsistency in custom species code

This line had no real use at all. It may even have contributed to various issues.
All basic humanoid species have had their appearances constructed onto an existing blank 32x32 icon_state named and called for as "nothing" inside the effects.dmi.
There are no untitled blanks either inside the effects.dmi file, so the funky deviant custom species icon_states would never have had any proper fallback.

* Re-establishes existing foundations for human icon

This line had no real use at all that I could find. It may even have contributed to various issues.
Before this line was added, all basic humanoid species have had their appearances constructed onto an actually existing blank 32x32 icon_state named and called for as "nothing" inside the effects.dmi.
There are no untitled blanks either inside the effects.dmi file, so the funky deviant species specific icon_states would never have had any proper fallback either.

No negative effects whatsoever detected in testing runs. Maybe slight framerate increase, but that was likely unrelated/placebo lmao

* Couple security otie fixes

-Fixes sec oties failing to announce arrests for sec comms.
-Adds another announcement for sec oties to confirm successfully detained crimester.

* Fixes custom accessories not showing up on things

Contradictory hardcoding babe.

* Fixes inconsistencies in organ system
-Seems the years old conversion to turn old limb names and tags and such to BP constants was never finished.
-This also fixes warning spammy diona organ tags.

* Balance pass on custom species traits

* Revert "Fixes cameras making completely black photos"

* Fixes handheld cameras

* Resh - Navy HoS Jacket

https://forum.vore-station.net/viewtopic.php?f=27&t=1065 - approved fluff app. Long time coming, lol.

(And first time 'coding'/using github to change files. hope I did it right. Oof.)

* Increase prom limb health by 60%

* changes hairstyles to use species defines

* Correct Resh custom_items.txt for HoS jacket

* (SQ-Merge) Adds in Floppy Bunny ears. (#3348)

* (SQ-Merge) Possible fix for drop-nomming (#3331)

* possible drop-nomming fix

* no longer 100% fall cushion on non-aligning prefs

* fixed some checks

* (SQ-Merge) Makes rads not kill people in stomachs (#3342)

* Makes rads not kill people in stomachs

* There we go

* Update radiation.dm

* POLARIS: Fixes #3308 (VS) - Skrell lack eyes

* POLARIS: Fixes #3280 (VS) - Typing as ghost removes overlays

Also gives them the proper ghost speech bubble. Unsure why it wasn't used!

* POLARIS: Fixes #3298 (VS) - Observer-ghosts were naked instead of dressed

* POLARIS: Fixes #3270 (VS) - Cleanbots make noise too often, reduce chance

* POLARIS: Fixes #3264 (VS) - MMI insertion sanitizes w/o numbers allowed

* POLARIS: Fixes #3237 (VS) - Cryoconsoles are lit even when unpowered

* POLARIS: Fixes #3238 (VS) - Nothing but humans can understand silicons talking

* POLARIS: Fixes #3221 (VS) - No explanation of what to do in the case of system instability

* POLARIS: Fixes #2601 (VS) - Allows mechs to continue charging after battery swap w/o moving

* POLARIS: Fixes #5282 (VS) - Allow use of pens to label pill bottles, like glass bottles

* POLARIS: Fixes #2573 (VS) - Slap cigarettes off people's faces

* POLARIS: Ventcrawling assistance

* POLARIS: Fix holders to avoid forcemoving held mob to nullspace

* POLARIS: Allow crawling through vertical pipes

* POLARIS: Weird snacks runtime

* POLARIS: Sometimes items have this set to null because they are bad.

* POLARIS: Beam weapons runtime when you shoot yourself

* POLARIS: Fix a call to the wrong update icons in prom regen

* POLARIS: Fix incorrect robolimb checks

* POLARIS: Heal robolimbs when you heal everything

Typically only used in magic and stuff, makes sense to heal both (otherwise there's no way to heal whole FBP bodies)

* POLARIS: Add eye color to shapeshifters

* POLARIS: Adds an animation thing, uses it on ventcrawls

* Fixes Suit Storage Icons
Items in suit storage should no longer vanish.

* Adds Keypad Auth to CE Office

* 44 revolvers

Port from Bay

- Addition of two more revolvers in 44 cal for variety
- Creation of rubber rounds for 44 cal (stats taken from virgo no idea how good they are in actual fights)
- Includes 44 ammo speedloaders, regular and rubber speedloaders
- Slight adjustments to allow for firing animations taken from Bay (the mosley revolver has a firing animation that plays)
- Includes in hand sprites

We did already have the 'webley' sprite (it exists in a recolored sprite). However it is a alternate sprite for the detective's 45 revolver. This brings it in as a actual proper revolver with sprites that are different than the detectives revolver, and maybe in the future can be thrown into loot lists and PoIs.

* Adds bioprinter to medical

Only internal organs work well

* Fixes feathered tesh tail and removes an useless piece of code.
-Feathered tesh tail now uses the proper dual color system now that it no longer comes with the default tail.
-Removes completely redundant body hair code from robolimb icon generation.

* byond beta back on its bullshit

* Update organ_icon.dm

* Update organ_icon.dm

* Probably maybe fixes blank lines for prey

* Fixes incorrect camera naming/networks. Fixes #3353

* Nanoui now supports use of multiple templates (#5105)

* Nanoui now supports use of multiple templates

* Removing debug code, indentation

* Indentation

* Arranges lots of things into planes (#5072)

* Rearranges a billion things into planes

* Make cryotubes fancy

* Update Travis

* Fix hiding logic

* Lore-Compliant Oculum News Channel (#5111)

* adds an e-reader full of news to the loadout

* Political Almanac -> Pocket Newscaster

* new news channel containing lore-compliant news that's not bad

* prettified lorecodex, added a month's worth of news (#5112)

* prettified lorecodex : added a month's worth of news

* what the hell elgie

* all according to kaikoku

* Grant remote profile access to R_DEBUG holders

* Fix for MOB_CAN_SEE_PLANE

* Normal brute kits disinfect wounds

* Fixes fullbright mode hiding lighting overlays.

Fullbright plane master being above lighting plane master is important, shouldn't be removed.

* Fixes machines being below tables they should sit upon.

* Fixes Runtime in logging.dm,61

* Removes vials

* Update and rename pai_manifest.tmpl to crew_manifest.tmpl

* Change of template

* Fixes infinite loop in FBP naming w/o client

* Adds Map Template Groups
Adds ability to have many different 'versions' of a PoI, yet only having one show up per round.
An example on how to do this is provided with Radio Free Sif (aka DJOutpost).
Just make sure all the different versions have the same 'template_group' value.

* Adds a message on emag to the battle arcade machine. (#5129)

* Updates one arcade machine emag message to to_chat, adds another.

* Returns 1 in emag_act for orion trail.

* Converts a bunch of stuff to macros. Should probably not break anything.

* Fixes an improper macro usage.

* Attempts to fix all 20 errors.

* Makes syndie dufflebags hint that they let you move faster

* Fixes untagged sorting junction

* Actually adds adhoc_fallback to pilot headsets

* Map fixes and tweaks

- Flashers in brig cells now should work, extra floor flash in communal brig to deal with crims.
- Inproper access, SMES rooms.
- Trader start point being dark now fixed.
- Medical Vendor Plus has more advanced burn and trauma kits. Also splints.
- Cell 1 and 2 in the brig can now be accessed by detectives.
- Additional r-walls next to the engine room to help with rads.
- Floor decals in a couple areas.
- RD office now has its telescreen back.

* Fix unused variable warnings.

* Fix light/camera layers for macros and fix constants for them too.

* Updates changelog

* Camera types exist to determine networks!

* Reverted use of 'usr' back to 'user' from commit 05fd53ebcc

* Fixes a bug. It's flatland zorren. 

Fixes #3376

* Fixes wallet-HUD interaction issues. (#5130)

* Fixes wallet-HUD interaction issues.

* Fixes HUDs, too. Forgot to commit this the first time. Also hopefully didn't change the map to examplemap.

* Fixes an indentation error.

* Nerfs solargrub drain speed.

Due to the lack of saturation in the moderate event container, solargrubs show up way too frequently, and changing the frequency doesn't help. The container has to pick. This change will just bump the drain speed down so severely, that if you kill one or two grubs, the station should barely feel the impact anymore. As opposed to having to kill 4/5 grubs on average.

Gradual nerfs seem logical, as grubs get more and mroe of a day-to-day experience, and most people know about them now. Time to stop the witch hunting for those annoying grubs :p

* In which MC is dumb. Actually removes network override

* Initial cleanup/changes

* More optimizations for character joins

* Switch cables and pipes to use define constants instead of literals for layers.

Also fix a few things to be on the correct plane.  Basically the under-floor stuff is supposed to be on PLATING_PLANE.
Portable atmospherics go on object layer so they are above stationary machinery, given that they move around.
Fixed wires to be on top of pipes like they used to be, otherwise they'd be obscured too often.

* Don't kick admin observers for inactivity.  They might be waiting for ahelps.

* Fixes vox not having hardsuit sprites. Uses the new defines.

* Replaces base egun sprite

* Small fixes and ports discovered during merge. (#5138)

* POLARIS: No string compare for assistants

* POLARIS: Move these planes to more useful places

* POLARIS: Only spam ghosts with chat messages from things with real clients

* Fix small forgotten lines of text accidentally left out of VS syncs.

* Fix typo'd plane in lighting.dm and remove redundant definitions.

* Fixes a bunch of simple animal vore icon issues.

* Fixes Pathing

* Small Shock/Holo collar tweaks.
-Updates their old >> dialogue.
-Makes shock collars taggable.

Was gonna fix them showing up in forced lowercase on people but that turned out to be a separate polaris issue that I just opened a fix for up there.

* more fixes etc

* Update solargrub.dm

* Improves contrasts on sprites and removes the need for mirroring upstream sprites

* adds generic gibs to vore mob icons to prevent sneks

* Adds a bunch of stuff to cargo selection.
-Xenowear crate, 13 non-random xenowear items for 100 points.
-Teshari smocks crate, comes with all the 5 basic colors for 25 points.
-Teshari undercoats, comes with 4 random colors from basic and grey selection for 20 points.
-Teshari undercoats black, comes with 4 random colors from the black trim selection for 20 points.
-Teshari cloaks, comes with 4 random colors from basic and grey selection for 40 points.
-Teshari cloaks black, comes with 4 random colors from the black trim selection for 40 points.
-Utility uniforms, comes with the 3 loadout utility uniforms (black/blue/grey) for 30 points.
-Skirts crate, comes with the 10 regular type skirts for 40 points.
-Varsity jackets, comes with the set of 6 colors for 60 points.
-Leather gear crate, comes with 5 random items from a selection of 21 more or less tough/kinky gear for 50 points.
-Eyewear crate, comes with 11 cosmetic and/or prescription pieces for 50 points.
-Gloves crate, comes with 4 random gloves with a chance to hit a couple fancier ones among the basic colors for 40 points.
-Boots crate, comes with 3 random pairs of boots freely available in loadout for 60 points.
-Taurbags crate, comes with the 3 universal saddlebags we have (basic/robust/vest) for 60 points.
-Cuisine crate, comes with 5 random foods from a list of varying cultural fanciness for 25 points.
-Burger crate, comes with 5 random basic burgers for 15 points.
-Special burger crate, comes with 3 random special burgers for 60 points.
-Bakery products, comes with 5 random bakery products for 15 points.
-Cakes crate, comes with 5 random cakes for 50 points.
-Mexican food crate, comes with 5 random mexican foods for 15 points.
-Asian food crate, comes with 5 random asian foods for 15 points.
-Action figures crate, comes with 5 random figures for 50 points.
-Tabletop miniatures crate, delivers the set of those characters for 30 points.
-Plushies crate, comes with 3 random plushies for 30 points.

* Changes wedding rings to be a subtype of ring

Also moves them to their own .dm, since they're now a subtype of the thing in rings.dm. Also changed bethrothed to spouse, as the former is usually before marriage and not after.

Benefits of this include: Being able to wear gloves over wedding rings. Making them tiny instead of small. Making their gender neuter instead of plural, so it wont say "some wedding ring" when you examine someone wearing them. Probably more good things.

Issue reported by HzDonut.

* Cargo pack tweaks.

* Adds a machine for recoloring apparel ingame.
-Not mapped in currently.
-Still unsure whether to have it whitelisted for white/grey items only or to let people have their fun experimenting on nasty aesthetics.
-Also supports bags and belts. Yes, I've heard the pleas of the people not liking the default grey being the only public backpack option there is.

* Reverts gauze disinfecting until a proper solution can be put in place.

* Fixed mesons NIFSoft overlay not highlighting open spaces above

* Fixes #3368 - Teleporting now often respects dropnom pref

* Fixes #3344 - Holocarp set DM_HOLD when holodeck is safe

* Squashed commit of the following:

commit f55edb98499b600186be9f58c0d245b454479b74
Author: Verkister <superverkelian@hotmail.com>
Date:   Sun Apr 8 17:05:19 2018 +0300

    we'll see about that whitelist crap later then

commit 186ce2aba274c4009c42a730d1ba7c67dddf8ea6
Author: Verkister <superverkelian@hotmail.com>
Date:   Sun Apr 8 16:32:08 2018 +0300

    screw you too travis

commit 470789300bda3949de4027dc8e2c25ae8427eaae
Author: Verkister <superverkelian@hotmail.com>
Date:   Sun Apr 8 16:10:29 2018 +0300

    Update painter_vr.dm

commit e9dee86b0cb84172c95f3a91ba73ce0b2661820c
Author: Verkister <superverkelian@hotmail.com>
Date:   Sun Apr 8 15:51:37 2018 +0300

    Update painter_vr.dm

* allows meteors to be deflected by baseball bats

* snib

* oh, and the DME, too

* fixes the meteor refusing to move at all after being deflected

* done

* Fix shuttle corner turfs disappearing when shuttle moves.

When shuttles land on a turf, it takes the appearance of the turf it lands on as an underlay.  Must make sure this underlay is on FLOAT_PLANE otherwise it will likely end up OVER the turf itself.

* Set appropriate vars for persisting adminspawned characters

* Minor Psych office tweaks. Closes 2090

* Adds compact defib to CC medbay. Closes #2287

* Makes the door button in EVA ACTUALLY WORK

* Squashed commit of the following:

commit bd470fd0276e83fa1516cc1b966308165d081b1b
Author: Verkister <superverkelian@hotmail.com>
Date:   Tue Apr 10 20:45:00 2018 +0300

    Update painter_vr.dm

commit 12e39bcec9b717d477a64aca0f8dfe917917986b
Author: Verkister <superverkelian@hotmail.com>
Date:   Mon Apr 9 09:34:50 2018 +0300

    Update painter_vr.dm

* Reduce abduction chance 1%->0.5%, add logs

* Removes Camilla's plush as per request

* Some protean fixes (regen, size as blob, gender)

* switch map to tgm for merge

* convert map to tgm for merge
2018-04-11 17:14:22 -07:00

611 lines
15 KiB
Plaintext

// Basic transit tubes. Straight pieces, curved sections,
// and basic splits/joins (no routing logic).
// Mappers: you can use "Generate Instances from Icon-states"
// to get the different pieces.
/obj/structure/transit_tube
icon = 'icons/obj/pipes/transit_tube.dmi'
icon_state = "E-W"
density = 1
layer = ABOVE_JUNK_LAYER
anchored = 1.0
var/list/tube_dirs = null
var/exit_delay = 2
var/enter_delay = 1
// alldirs in global.dm is the same list of directions, but since
// the specific order matters to get a usable icon_state, it is
// copied here so that, in the unlikely case that alldirs is changed,
// this continues to work.
var/global/list/tube_dir_list = list(NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST)
// A place where tube pods stop, and people can get in or out.
// Mappers: use "Generate Instances from Directions" for this
// one.
/obj/structure/transit_tube/station
icon = 'icons/obj/pipes/transit_tube_station.dmi'
icon_state = "closed"
exit_delay = 2
enter_delay = 3
var/pod_moving = 0
var/automatic_launch_time = 100
var/const/OPEN_DURATION = 6
var/const/CLOSE_DURATION = 6
/obj/structure/transit_tube_pod
icon = 'icons/obj/pipes/transit_tube_pod.dmi'
icon_state = "pod"
animate_movement = FORWARD_STEPS
anchored = 1.0
density = 1
var/moving = 0
var/datum/gas_mixture/air_contents = new()
/obj/structure/transit_tube_pod/Destroy()
for(var/atom/movable/AM in contents)
AM.loc = loc
..()
// When destroyed by explosions, properly handle contents.
obj/structure/ex_act(severity)
switch(severity)
if(1.0)
for(var/atom/movable/AM in contents)
AM.loc = loc
AM.ex_act(severity++)
qdel(src)
return
if(2.0)
if(prob(50))
for(var/atom/movable/AM in contents)
AM.loc = loc
AM.ex_act(severity++)
qdel(src)
return
if(3.0)
return
/obj/structure/transit_tube_pod/New(loc)
..(loc)
air_contents.adjust_multi("oxygen", MOLES_O2STANDARD * 2, "nitrogen", MOLES_N2STANDARD)
air_contents.temperature = T20C
// Give auto tubes time to align before trying to start moving
spawn(5)
follow_tube()
/obj/structure/transit_tube/New(loc)
..(loc)
if(tube_dirs == null)
init_dirs()
/obj/structure/transit_tube/Bumped(mob/AM as mob|obj)
var/obj/structure/transit_tube/T = locate() in AM.loc
if(T)
AM << "<span class='warning'>The tube's support pylons block your way.</span>"
return ..()
else
AM.loc = src.loc
AM << "<span class='info'>You slip under the tube.</span>"
/obj/structure/transit_tube/station/New(loc)
..(loc)
/obj/structure/transit_tube/station/Bumped(mob/AM as mob|obj)
if(!pod_moving && icon_state == "open" && istype(AM, /mob))
for(var/obj/structure/transit_tube_pod/pod in loc)
if(pod.contents.len)
AM << "<span class='notice'>The pod is already occupied.</span>"
return
else if(!pod.moving && pod.dir in directions())
AM.loc = pod
return
/obj/structure/transit_tube/station/attack_hand(mob/user as mob)
if(!pod_moving)
for(var/obj/structure/transit_tube_pod/pod in loc)
if(!pod.moving && pod.dir in directions())
if(icon_state == "closed")
open_animation()
else if(icon_state == "open")
close_animation()
/obj/structure/transit_tube/station/proc/open_animation()
if(icon_state == "closed")
icon_state = "opening"
spawn(OPEN_DURATION)
if(icon_state == "opening")
icon_state = "open"
/obj/structure/transit_tube/station/proc/close_animation()
if(icon_state == "open")
icon_state = "closing"
spawn(CLOSE_DURATION)
if(icon_state == "closing")
icon_state = "closed"
/obj/structure/transit_tube/station/proc/launch_pod()
for(var/obj/structure/transit_tube_pod/pod in loc)
if(!pod.moving && pod.dir in directions())
spawn(5)
pod_moving = 1
close_animation()
sleep(CLOSE_DURATION + 2)
//reverse directions for automated cycling
var/turf/next_loc = get_step(loc, pod.dir)
var/obj/structure/transit_tube/nexttube
for(var/obj/structure/transit_tube/tube in next_loc)
if(tube.has_entrance(pod.dir))
nexttube = tube
break
if(!nexttube)
pod.set_dir(turn(pod.dir, 180))
if(icon_state == "closed" && pod)
pod.follow_tube()
pod_moving = 0
return
// Called to check if a pod should stop upon entering this tube.
/obj/structure/transit_tube/proc/should_stop_pod(pod, from_dir)
return 0
/obj/structure/transit_tube/station/should_stop_pod(pod, from_dir)
return 1
// Called when a pod stops in this tube section.
/obj/structure/transit_tube/proc/pod_stopped(pod, from_dir)
return
/obj/structure/transit_tube/station/pod_stopped(obj/structure/transit_tube_pod/pod, from_dir)
pod_moving = 1
spawn(5)
open_animation()
sleep(OPEN_DURATION + 2)
pod_moving = 0
pod.mix_air()
if(automatic_launch_time)
var/const/wait_step = 5
var/i = 0
while(i < automatic_launch_time)
sleep(wait_step)
i += wait_step
if(pod_moving || icon_state != "open")
return
launch_pod()
// Returns a /list of directions this tube section can connect to.
// Tubes that have some sort of logic or changing direction might
// override it with additional logic.
/obj/structure/transit_tube/proc/directions()
return tube_dirs
/obj/structure/transit_tube/proc/has_entrance(from_dir)
from_dir = turn(from_dir, 180)
for(var/direction in directions())
if(direction == from_dir)
return 1
return 0
/obj/structure/transit_tube/proc/has_exit(in_dir)
for(var/direction in directions())
if(direction == in_dir)
return 1
return 0
// Searches for an exit direction within 45 degrees of the
// specified dir. Returns that direction, or 0 if none match.
/obj/structure/transit_tube/proc/get_exit(in_dir)
var/near_dir = 0
var/in_dir_cw = turn(in_dir, -45)
var/in_dir_ccw = turn(in_dir, 45)
for(var/direction in directions())
if(direction == in_dir)
return direction
else if(direction == in_dir_cw)
near_dir = direction
else if(direction == in_dir_ccw)
near_dir = direction
return near_dir
// Return how many BYOND ticks to wait before entering/exiting
// the tube section. Default action is to return the value of
// a var, which wouldn't need a proc, but it makes it possible
// for later tube types to interact in more interesting ways
// such as being very fast in one direction, but slow in others
/obj/structure/transit_tube/proc/exit_delay(pod, to_dir)
return exit_delay
/obj/structure/transit_tube/proc/enter_delay(pod, to_dir)
return enter_delay
/obj/structure/transit_tube_pod/proc/follow_tube()
if(moving)
return
moving = 1
spawn()
var/obj/structure/transit_tube/current_tube = null
var/next_dir
var/next_loc
var/last_delay = 0
var/exit_delay
for(var/obj/structure/transit_tube/tube in loc)
if(tube.has_exit(dir))
current_tube = tube
break
while(current_tube)
next_dir = current_tube.get_exit(dir)
if(!next_dir)
break
exit_delay = current_tube.exit_delay(src, dir)
last_delay += exit_delay
sleep(exit_delay)
next_loc = get_step(loc, next_dir)
current_tube = null
for(var/obj/structure/transit_tube/tube in next_loc)
if(tube.has_entrance(next_dir))
current_tube = tube
break
if(current_tube == null)
set_dir(next_dir)
Move(get_step(loc, dir)) // Allow collisions when leaving the tubes.
break
last_delay = current_tube.enter_delay(src, next_dir)
sleep(last_delay)
set_dir(next_dir)
loc = next_loc // When moving from one tube to another, skip collision and such.
density = current_tube.density
if(current_tube && current_tube.should_stop_pod(src, next_dir))
current_tube.pod_stopped(src, dir)
break
density = 1
// If the pod is no longer in a tube, move in a line until stopped or slowed to a halt.
// /turf/inertial_drift appears to only work on mobs, and re-implementing some of the
// logic allows a gradual slowdown and eventual stop when passing over non-space turfs.
if(!current_tube && last_delay <= 10)
do
sleep(last_delay)
if(!istype(loc, /turf/space))
last_delay++
if(last_delay > 10)
break
while(isturf(loc) && Move(get_step(loc, dir)))
moving = 0
/obj/structure/transit_tube_pod/return_air()
return air_contents
/obj/structure/transit_tube_pod/assume_air(datum/gas_mixture/giver)
return air_contents.merge(giver)
/obj/structure/transit_tube_pod/remove_air(amount)
return air_contents.remove(amount)
// Called when a pod arrives at, and before a pod departs from a station,
// giving it a chance to mix its internal air supply with the turf it is
// currently on.
/obj/structure/transit_tube_pod/proc/mix_air()
var/datum/gas_mixture/environment = loc.return_air()
//note that share_ratio assumes both gas mixes have the same volume,
//so if the volume is changed this may need to be changed as well.
air_contents.share_ratio(environment, 1)
// When the player moves, check if the pos is currently stopped at a station.
// if it is, check the direction. If the direction matches the direction of
// the station, try to exit. If the direction matches one of the station's
// tube directions, launch the pod in that direction.
/obj/structure/transit_tube_pod/relaymove(mob/mob, direction)
if(istype(mob, /mob) && mob.client)
// If the pod is not in a tube at all, you can get out at any time.
if(!(locate(/obj/structure/transit_tube) in loc))
mob.loc = loc
mob.client.Move(get_step(loc, direction), direction)
//if(moving && istype(loc, /turf/space))
// Todo: If you get out of a moving pod in space, you should move as well.
// Same direction as pod? Direcion you moved? Halfway between?
if(!moving)
for(var/obj/structure/transit_tube/station/station in loc)
if(dir in station.directions())
if(!station.pod_moving)
if(direction == station.dir)
if(station.icon_state == "open")
mob.loc = loc
mob.client.Move(get_step(loc, direction), direction)
else
station.open_animation()
else if(direction in station.directions())
set_dir(direction)
station.launch_pod()
return
for(var/obj/structure/transit_tube/tube in loc)
if(dir in tube.directions())
if(tube.has_exit(direction))
set_dir(direction)
return
// Parse the icon_state into a list of directions.
// This means that mappers can use Dream Maker's built in
// "Generate Instances from Icon-states" option to get all
// variations. Additionally, as a separate proc, sub-types
// can handle it more intelligently.
/obj/structure/transit_tube/proc/init_dirs()
if(icon_state == "auto")
// Additional delay, for map loading.
spawn(1)
init_dirs_automatic()
else
tube_dirs = parse_dirs(icon_state)
if(copytext(icon_state, 1, 3) == "D-" || findtextEx(icon_state, "Pass"))
density = 0
// Tube station directions are simply 90 to either side of
// the exit.
/obj/structure/transit_tube/station/init_dirs()
tube_dirs = list(turn(dir, 90), turn(dir, -90))
// Initialize dirs by searching for tubes that do/might connect
// on nearby turfs. Create corner pieces if nessecary.
// Pick two directions, preferring tubes that already connect
// to loc, or other auto tubes if there aren't enough connections.
/obj/structure/transit_tube/proc/init_dirs_automatic()
var/list/connected = list()
var/list/connected_auto = list()
for(var/direction in tube_dir_list)
var/location = get_step(loc, direction)
for(var/obj/structure/transit_tube/tube in location)
if(tube.directions() == null && tube.icon_state == "auto")
connected_auto += direction
break
else if(turn(direction, 180) in tube.directions())
connected += direction
break
connected += connected_auto
tube_dirs = select_automatic_dirs(connected)
if(length(tube_dirs) == 2 && tube_dir_list.Find(tube_dirs[1]) > tube_dir_list.Find(tube_dirs[2]))
tube_dirs.Swap(1, 2)
generate_automatic_corners(tube_dirs)
select_automatic_icon_state(tube_dirs)
// Given a list of directions, look a pair that forms a 180 or
// 135 degree angle, and return a list containing the pair.
// If none exist, return list(connected[1], turn(connected[1], 180)
/obj/structure/transit_tube/proc/select_automatic_dirs(connected)
if(length(connected) < 1)
return list()
for(var/i = 1, i <= length(connected), i++)
for(var/j = i + 1, j <= length(connected), j++)
var/d1 = connected[i]
var/d2 = connected[j]
if(d1 == turn(d2, 135) || d1 == turn(d2, 180) || d1 == turn(d2, 225))
return list(d1, d2)
return list(connected[1], turn(connected[1], 180))
/obj/structure/transit_tube/proc/select_automatic_icon_state(directions)
if(length(directions) == 2)
icon_state = "[dir2text_short(directions[1])]-[dir2text_short(directions[2])]"
// Look for diagonal directions, generate the decorative corners in each.
/obj/structure/transit_tube/proc/generate_automatic_corners(directions)
for(var/direction in directions)
if(direction == 5 || direction == 6 || direction == 9 || direction == 10)
if(direction & NORTH)
create_automatic_decorative_corner(get_step(loc, NORTH), direction ^ 3)
else
create_automatic_decorative_corner(get_step(loc, SOUTH), direction ^ 3)
if(direction & EAST)
create_automatic_decorative_corner(get_step(loc, EAST), direction ^ 12)
else
create_automatic_decorative_corner(get_step(loc, WEST), direction ^ 12)
// Generate a corner, if one doesn't exist for the direction on the turf.
/obj/structure/transit_tube/proc/create_automatic_decorative_corner(location, direction)
var/state = "D-[dir2text_short(direction)]"
for(var/obj/structure/transit_tube/tube in location)
if(tube.icon_state == state)
return
var/obj/structure/transit_tube/tube = new(location)
tube.icon_state = state
tube.init_dirs()
// Uses a list() to cache return values. Since they should
// never be edited directly, all tubes with a certain
// icon_state can just reference the same list. In theory,
// reduces memory usage, and improves CPU cache usage.
// In reality, I don't know if that is quite how BYOND works,
// but it is probably safer to assume the existence of, and
// rely on, a sufficiently smart compiler/optimizer.
/obj/structure/transit_tube/proc/parse_dirs(text)
var/global/list/direction_table = list()
if(text in direction_table)
return direction_table[text]
var/list/split_text = splittext(text, "-")
// If the first token is D, the icon_state represents
// a purely decorative tube, and doesn't actually
// connect to anything.
if(split_text[1] == "D")
direction_table[text] = list()
return null
var/list/directions = list()
for(var/text_part in split_text)
var/direction = text2dir_extended(text_part)
if(direction > 0)
directions += direction
direction_table[text] = directions
return directions
// A copy of text2dir, extended to accept one and two letter
// directions, and to clearly return 0 otherwise.
/obj/structure/transit_tube/proc/text2dir_extended(direction)
switch(uppertext(direction))
if("NORTH", "N")
return 1
if("SOUTH", "S")
return 2
if("EAST", "E")
return 4
if("WEST", "W")
return 8
if("NORTHEAST", "NE")
return 5
if("NORTHWEST", "NW")
return 9
if("SOUTHEAST", "SE")
return 6
if("SOUTHWEST", "SW")
return 10
else
return 0
// A copy of dir2text, which returns the short one or two letter
// directions used in tube icon states.
/obj/structure/transit_tube/proc/dir2text_short(direction)
switch(direction)
if(1)
return "N"
if(2)
return "S"
if(4)
return "E"
if(8)
return "W"
if(5)
return "NE"
if(6)
return "SE"
if(9)
return "NW"
if(10)
return "SW"
else
return