Files
Bubberstation/code/controllers/subsystem/ticker.dm
SpaceLoveSs13 7aa6664021 Mirror (#27453)
* Fix Conflicts

* Change COGBAR_ANIMATION_TIME to seconds and not deciseconds (#82530)

Most people should not be using this define

* New Battle Arcade (#81810)

Remakes Battle Arcade from just about the ground up, with exceptions
taken for emagged stuff since I didn't really want to touch its
behavior.

The Battle Arcade now has stages that players can go through, unlocking
a stage by beating 2 enemies and the boss of the previous one, but this
must all be done in a row. You can choose to take a break between each
battle and there's a good chance you'll sleep just fine but there's also
a chance it can go wrong either through an ambush or robbery.

The Inn lets you restore everything for 15 gold and you can buy a sword
and armor, each level you unlock is a new sword and armor pair you can
buy that's better than the last, it's 30 gold each but scales up as you
progress through levels. They are really worth getting so it's best to
try to not lose your money early in.

The battle system is nearly the same as how it was before but I removed
the poor combo system that plagued the old arcade as one big knowledge
lock, now it's more just turn based. The game is built on permadeath so
dying means you restart from the beginning, but if you are going to lose
you can try to escape instead which costs you half of your gold.

Getting to higher levels increases the difficulty of enemies but also
increases the gaming exp rewards which could make this a better way to
get exp if you can get good at it.

Gaming EXP is used to increase chances of counterattacking but doesn't
give any extra health to the player.

I also removed the exploit of being able to screwdriver arcade cabinets
because people would do that if they thought they were on the verge of
losing to bypass the effects of loss. I instead replaced it with a new
interaction that the Curator's display case key can be used to reset
arcade cabinets (there's several keys on the chain so it made sense to
me), which I added solely because I thought Curators would be the type
of person to have run an actual arcade.

This is some gameplay

https://github.com/tgstation/tgstation/assets/53777086/499083f5-75cc-43b5-b457-017a012beede

As a misc sidenote, I also split up the arcade file just like how Orion
Trail was before, just for neat code organization.
The Inn keeper is straight up just a photo of my localhost dude, he's
not a player reference or anything it's not my actual character.
I also have no idea how well balanced this is cause I suck at it lol.

Battle Arcade is one of 3 last machines in my hackmd here to turn into
TGUI https://hackmd.io/XLt5MoRvRxuhFbwtk4VAUA?view
I've always thought the current version of battle arcade is quite lame
and lacks any progression, like Orion Trail I thought that since I was
moving this to TGUI, it would also be a perfect opportunity to revamp it
and try to improve on where it failed before, especially since the
alternative (NTOS Arcade) is also lame as hell and is even lamer than
HTML battle arcade (spam mana, then spam health, then just spam attack,
rinse and repeat).
This will hopefully be more entertaining and give players sense that
they are getting through a series of tasks rather than doing one same
one again and again.

🆑 JohnFulpWillard, Zeek the Rat
add: Battle Arcade has been completely overhauled in a new progression
system, this time using TGUI.
add: The Curator's keys can now reset arcade cabinets.
balance: You now need to be literate to play arcade games, except for
Mediborg's Amputation Adventure.
fix: You can no longer screwdriver emagged arcade consoles. Accept your
fate.
fix: Silicons can no longer play Mediborg's Amputation Adventure.
/🆑

---------

Co-authored-by: Jeremiah <42397676+jlsnow301@users.noreply.github.com>

* Change setting item weight class to a setter to patch some weight class related shenanigans (#82494)

## About The Pull Request

Fixes #81052 
Fixes #58008

Setting weight class of items is now done via `update_weight_class`.

I updated as many occurrences of manually setting `w_class` as I could
find but I may have missed some. Let me know if you know of any I
missed.

This is done to allow datums to react to an item having its weight class
changed.

Humans and atom storage are two such datums which now react to having an
item in its contents change weight class, to allow it to expel items
that grow to a weight class beyond what is normally allowed.

## Changelog

🆑 Melbert
fix: You can't fit items which are normally too large for a storage by
fitting it in the storage when it is small, then growing it to a larger
size.
/🆑

* Material datum color update, plus touching up some material items (knight armor, tiles) (#82500)

## About The Pull Request

Tries to bring the material datum colors in closer approximation to the
stacks they're attached too. I literally used the colors on the stacks.
some might need to be lighter or darker, but for the most part they'll
look...closer to their actual material hues.

![material datum stuff
2](https://github.com/tgstation/tgstation/assets/40847847/a3a5968f-cab3-43dd-8699-3dae879b21fb)

I've also tweaked the sprites of both the tile object and the actual
material tile turf to give it the right shading.


![image](https://github.com/tgstation/tgstation/assets/40847847/56489479-8774-492b-b8cc-aeabc6c0a67f)

In addition to the tiles, I've also updated the knight armor and helmet
to look closer to the much higher quality plate armor already in the
game.

## Why It's Good For The Game

It bothered me that the material datum coloring was inconsistent with
the actual colors used for the material stacks. When they were updated,
and even before they were updated, material datum stuff just never
looked _right_. I wanted to change that so that it looks just right.

I did not like the old material knight armor whatsoever. It was a
dithered mess, and seemed to already use parts of the standard plate
armor but with all the actual shading removed or replaced with the wrong
colors. This fixes that so that the armor is actually readable for what
it is.

## Changelog
🆑
image: Updates the colors of various material datum to bring them closer
in-line with their actual material stacks
image: Improves the sprites for the material knight armor and helmet.
/🆑

* LateInitialize is not allowed to call parent anymore (#82540)

## About The Pull Request

I've seen a few cases in the past where LateInitialize is done cause of
the init return value being set to do so for no real reason, I thought I
should try to avoid that by ensuring LateInitialize isn't ever called
without overriding.

This fixes a ton of machine's LateInitialize not calling parent
(mechpad, door buttons, message monitor, a lot of tram machines,
abductor console, holodeck computer & disposal bin), avoiding having to
set itself up to be connected to power. If they were intended to not
connect to power, they should be using ``NO_POWER_USE`` instead.

Also removes a ton of returns to LateInit when it's already getting it
from parent regardless (many cases of that in machine code).

## Why It's Good For The Game

I think this is better for coding standard reasons as well as just
making sure we're not calling this proc on things that does absolutely
nothing with them. A machine not using power can be seen evidently not
using power with ``NO_POWER_USE``, not so much if it's LateInitialize
not calling parent.

## Changelog

🆑
fix: Mech pads, door buttons, message monitors, tram machines, abductor
consoles & holodeck computers now use power.
/🆑

* Fix table top deconstruction (#82508)

## About The Pull Request

Edited: updated changelog, read comments for changes in implementation
details

So previously, tables would let you use a wrench to fully deconstruct
them, or a screwdriver to take off only their top.
This, however, broke in two different ways in #82280, when their
deconstruction logic got changed.

First off, deconstructed tables would only drop the materials for their
top and not their frame.
For this, the primary culprit seems to be on line 307:

c34d56a45b/code/game/objects/structures/tables_racks.dm (L300-L307)
Where `new framestack(target_turf, framestackamount)` accidentally got
an extra indent, and ended up in the less common half of the if-else
chain.
Just moving this outside of the if-else chain again fixes it.

Secondly, tables had their own special deconstruction logic, which got
'standardized'.
Issue. This was special to accommodate for having two different
deconstruction logics: full or top only.
With `deconstruct(...)` no longer being overridable, I feel it's awkward
to attempt to proxy that information to the new `atom_deconstruct(...)`
So we introduce a new method, `deconstruct_top`, for the screwdriver to
use, which handles deconstructing only the top.
```dm
/obj/structure/table/proc/deconstruct_top()
	var/obj/table_frame = new frame(loc)
	if(obj_flags & NO_DECONSTRUCTION)
		table_frame.obj_flags |= NO_DECONSTRUCTION
	else // Mimic deconstruction logic, only drop our materials without NO_DECONSTRUCTION
		var/turf/target_turf = get_turf(src)
		drop_top_mats(target_turf)
	qdel(src)
```
Mimicking the `NO_DECONSTRUCTION` logic of normal deconstruction, and
copying over the flag onto its frames if need be.
This fixes screwdriver deconstruction.
## Why It's Good For The Game

Fixes #82503.
We can now deconstruct the table top separately again, AND get the right
materials back too.

## Changelog
🆑 00-Steven, SyncIt21
fix: Wrench table deconstruction gives the right materials again.
fix: Screwdriver table deconstruction only deconstructs the top again.
/🆑

* [NO GBP] Reagent grinders display reagents on examination (#82535)

## About The Pull Request
- Fixes #82531

Somehow omitted this during the general maintenance thing

## Changelog
🆑
fix: Reagent grinders display reagents of its beaker on examination
/🆑

* Monkeys now use height offset (and monkey tail works) (#81598)

This PR adds the ability for monkeys to wear any jumpsuit in the game,
and adds support for them to wear things like coats, gloves, and shoes
(though this cannot be obtained in-game and is solely achieved through
admins, which I also improved a bit upon by adding a defined bitfield
for no equip flags).

This reverts a lot of changes from
https://github.com/tgstation/tgstation/pull/73325 - We no longer check
height from limbs and such to bring sprites down, instead monkeys now
work more similarly to humans, so the entire PR was made irrelevant, and
I didn't really want to leave around dead code for the sake of having a
human with longer legs.

I've now also added support for Dwarfism, which makes monkeys look even
smaller. Very minor change but at least now the mutation doesn't feel
like it does literally nothing to monkeys (since they can already walk
over tables).

Here's a few examples of how it can appear in game (purely for
demonstration, as it is currently intentionally made impossible to
obtain in-game, though if someone wants to change that post-this PR now
that support is added, feel free):

Tails have been broken for a while now, the only reason you see them
in-game is because they are baked into the monkey sprites. This fixes
that, which means humans can now get monkey tails implanted into them
(hell yeah) and monkeys can have their tails removed (also hell yeah)

* Gets [weird] with (spies) by adding protect and deuteragonist-flavored objectives. (#82447)

## About The Pull Request

What are their goals? Why are they doing this? gets weird with Spy
objectives - namely by adding a lot more ways spies might be asked to
affect various targets around the station.

the first of these is by several flavors of Protecting targets (these do
NOT print a success at roundend in keeping with Spy design:)
- Protect (get a humanoid target off alive)
- Protect Nonhuman (get an entity off alive)
- Jailbreak (make sure a humanoid target escapes free)
- Detain (make sure a humanoid target gets taken out arrested)

the second of this is by a new escape condition: 
- Exile (get off-station or off the Z-level by the end of the shift -
sometimes it's not just pods, you need to fuck off to space to win.)

the third is through a massive increase in the number of possible:
- objective templates 
- departments to target (Command + Service added)
- specific locations to target
- general classes of objects to target (medicines, floor tiles, critical
infrastructure, etc.)
- efforts to target (such as meals, mechs, public supplies)
- ways to leave (you can be asked to abscond from the scene of your
crimes?)

## Why It's Good For The Game

More goofy and weird prompts to do more interesting things with Spies.
One thing I think we're sorely missing in our lineup is antagonists that
can act a bit more as deuteragonists - very possibly helping the crew
under certain conditions and frustrating the Hell out of them in others.

Since there's no way to check their objectives, and they get their
gear/progression through stealing shit, they're still very much an
antagonist and exist under the suspicion of doing bad... but, just going
by their objectives, introducing more varied (and in some cases even
benign) goals for them creates suggestions pointing to a lot more varied
and interesting stories if people choose to run with it.

* Adds anosmia quirk (#82206)

## About The Pull Request

Adds anosmia quirk. Anosmia, also known as smell blindness, is the loss
of the ability to detect one or more smells.

I tried to find all smells action and (most likely) update all of them,
unfortunately I can't change descriptions for this quirk.

## Why It's Good For The Game

Some characters will be able to not feel smells
That affect:
* Gases feelings and alerts (CO2, Plasma, miasm) - you don't feel them
* Bakery and cooking
* Changeling ability to feel other changelings by smell
* Some unimportant spans

* Explosions Part I - Directional Explosions (#82429)

## About The Pull Request

Adds the ability for explosions to be directional. This is achieved by
adding an angle check to `prepare_explosion_turfs()` to drop any turfs
outside the cone of the explosion. If the arc covers a full 360 degrees,
as is the default, it will accept all the turfs without performing the
angle check.

Uses this functionality to rework both rocket launcher backblast and X4
explosions. Rocket launcher backblast has been changed from a shotgun of
indendiary bullets to a directional explosion of similar length. X4 now
uses a directional explosion to "ensure user safety".

Apparently the old method of moving the explosion one tile away didn't
even work, as it blew up `target` before trying to check its density for
the directional behaviour.

https://youtu.be/Mzdt7d7Le2Y

## Why It's Good For The Game

Directional explosions - Useful functionality for a range of potential
use cases, which can be implemented with minimal extra processing cost
(Worst case scenario being very large directional explosions)

Backblast - Looks way cooler than a bunch of projectiles, and should be
significantly more functional in high-lag situations where projectile
code tends to get fucky

X4 - More predictable for players wanting to use it as a breaching
charge, you can actually stand near the charge and not have to worry
about being hoist upon your own petard.

## Changelog
🆑
add: Added support for directional explosions.
add: Rocket launcher backblast is now 271% more explosive, check your
six for friendlies!
add: X4 charges now explode in a cone away from the user when placed on
a sufficiently solid object.
fix: X4 charges will now behave correctly when placed on dense atoms
(note: don't try to read a variable from an atom you just blew up)
/🆑

* Add balloon alerts to plunging (#82559)

## About The Pull Request

Makes all plunging actions (pretty much anything using `plunger_act`)
have a visible balloon alert.

## Why It's Good For The Game

Makes sense that others would easily notice you plunging the shit out of
something.

Also, more people might finally learn that you can plunge the vent clogs
instead of welding them.

## Changelog
🆑
qol: Added balloon alerts whenever you start plunging something (i.e )
/🆑

* Fixes spurious runtime on Icemoon caused by turf calling unimplemented LateInitialize() (#82572)

## About The Pull Request

As of https://github.com/tgstation/tgstation/pull/82540 this runtime was
happening,


![image](https://github.com/tgstation/tgstation/assets/13398309/4d838fda-c157-4e33-ae64-77eafca1806f)

`/turf/open/openspace/icemoon/` can be changed to
`/turf/open/misc/asteroid/snow/icemoon/do_not_chasm` before
`Initialize()` returns, which resulted in it `INITIALIZE_HINT_LATELOAD`
getting returned on a turf that does not have an implementation of that
proc.

This should fix that.

## Why It's Good For The Game

Fixes CI error

* Blueprints tgui (#82565)

Blueprints now use a TGUI panel instead of the old HTML one.
Also did general code improvement and maintaining to blueprints in
general and also destroyed the ``areaeditor`` level, repathing it to
just 'blueprints'.
Also adds a sound when you look at structural data cause why not

Video demonstration:

https://github.com/tgstation/tgstation/assets/53777086/861773fd-3d57-472d-bc94-d67b0d4f1dbd

The 4 blueprint types:

![image](https://github.com/tgstation/tgstation/assets/53777086/bfd68eb5-c430-4608-a3f7-d6ac86727882)

Another HTML menu dead underground.
This is more responsive and doesn't require constant updating to see
which area you're in, feels less OOC (instead of saying "the blueprints
say", just say it, you ARE the blueprints).

Like, come on

![image](https://github.com/tgstation/tgstation/assets/53777086/fcf1b8b6-37c3-4c94-969f-3b121c983dc0)

Look at all this wasted space

![image](https://github.com/tgstation/tgstation/assets/53777086/1d3e61cd-bc56-4280-a3bb-0c66604e75b3)

🆑
refactor: Blueprints now use TGUI.
qol: Blueprints can now be used while lying down.
/🆑

* General maintenance for chem master (#82002)

**1. Qol**
- Adds screen tips & examines for screwdriver, wrench, crowbar & beaker
insertion, removal & replacing actions
- Analyzing reagents is now a client side feature & not a back end mode,
meaning one person can see details of a reagent while the other can
print stuff and do other operations so it's a non blocking operation.
This also means 2 players can see information of 2 different reagents in
their own screens, With that the overlay for analysis mode has been
removed
- You cannot do any tool acts on machines while printing. Balloon alerts
will be displayed warning you of that.
- The preferred container for the master reagent in the beaker is now
showed in both condiment & chem master. It can be enabled/disabled via a
CheckBox

**2. Code Improvements**
- Removed defines like `TARGET_BEAKER` , `TARGET_BEAKER` etc. ther
functionality is implemented as params in the `transfer_reagent()` proc
directly
- Removed all variables relating to analyzing reagents like
`reagent_analysis_mode`, `has_container_suggestion` etc. all memory
savings
- `printable_containers` now stores static values that can be shared
across many chem masters
- Updates only overlays and not the whole icon during operations for
efficiency

**3. Fixes**
- You can hit the chem master with the screwdriver, wrench, crowbar &
beaker when in combat mode
 - You cannot insert hologram items into the chem master
- Deconstructing a condiment master will give you the circuit board
already pre-programmed with that option selected so you don't need to
use a screwdriver to re program it
- `printing_amount` is now the maximum number of containers that can be
printed at a time. Presently this number with upgraded parts would print
out empty containers especially for patches. This is because
`volume_per_item` does not take into consideration this var. Also this
var would not give control to the player on exactly how many containers
to print as whatever amount the player entered would be multiplied with
this value producing a lot of waste & worse empty containers. Now this
var determines exactly how many containers you can print and is imposed
on the client side UI as well

**4. Refactors (UI performance)**
- Beaker data is compressed into a single entity & sent to the UI. This
is set to null if no beaker is loaded thus saving data sent
- Reuses Beaker props from chem synthesizer to reduce code
- reagent REF replaced with direct type converted to text and later
converted with `text2path()` cause its much faster

🆑
qol: Adds screen tips & examines for screwdriver, wrench, crowbar &
beaker insertion, removal & replacing actions
qol: Analyzing reagents no longer blocks other players from doing other
operations. Multiple players can analyze different reagents on the same
machine
qol: You cannot do any tool acts on the machine while printing to
prevent any side effects.
qol: The preferred container for the master reagent in the beaker is now
showed in both condiment & chem master. The feature can be
enabled/disabled via a check box
code: removed defines for reagent transfer, vars for reagent analyzis to
save memory. Autodoc for other vars & procs
fix: You can hit the chem master with tools like screwdriver, crowbar,
wrench & beaker in combat mode
fix: You cannot insert hologram items into the chem master
fix: Deconstructing a condiment master will give you the circuit board
already pre-programmed with that option
fix: You now print the exact amount of containers requested even with
upgraded parts without creating empty containers. Max printable
containers is 13 with tier 4 parts able to print 50 containers.
refactor: Optimized client side UI code & chem master as a whole.
/🆑

---------

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>

* Wraps `lowertext()` to ensure proper stringification. (#82442)

Fixes #82440

This PR just creates a new macro, `LOWER_TEXT()` (yes the irony is not
lost on me) to wrap around all calls of `lowertext()` and ensure that
whatever we input into that proc will be stringified using the `"[]"`
(or `tostring()` for the nerds) operator. very simple.

I also added a linter to enforce this (and prevent all forms of
regression) because I think that machines should do the menial work and
we shouldn't expect maintainers to remember this, let me know if you
disagree. if there is a time when it should be opted out for some
reason, the linter does respect it if you wrap your input with the
`UNLINT()` function.

* Clowns can now make balloon... toys. And also mallets and hats. (#82288)

<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

Clowns will now start with a box of 24 random long balloons and a
skillchip in their noggin allowing them to create balloon animals by
combining two of them of different colour together. Owners of the
skillchip also gain access to crafting recepies of balloon mallets,
vests, helmets and tophats, all created from long balloons. A crate of
long balloons, with a box of balloons inside, can be bought at cargo, in
case the clown runs out. I might edit this once I wake up, its 3 in the
morning right now.
Oh also, resprited how balloons look in inventory.

![image](https://github.com/tgstation/tgstation/assets/122572637/2d7ce955-c787-48a5-bfda-4613d2eed837)

Balloon animals funny.
Silly features are my favourite kind of features, and this one's
open-ended too.
Someone on the coder chat recommended someone would do it that one time,
here it goes.

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
mark your PRs to prevent unnecessary GBP loss. You can read up on GBP
and it's effects on PRs in the tgstation guides for contributors. Please
note that maintainers freely reserve the right to remove and add tags
should they deem it appropriate. You can attempt to finagle the system
all you want, but it's best to shoot for clear communication right off
the bat. -->

🆑
add: Added long balloon box to the clown's starting inventory, and a
skill-chip of long lost honk-motherian knowledge to their brain.
add: Added long balloons. Consequently, added balloon animals to make
from such balloons. Also, balloon top hat, vest, helmet, and a mallet.
Don't ask about the mallet.
add: A long balloons box harvested fresh from the farms on the clown
planet will be able to be shipped in a crate to the cargo department
near you!
add: As per requests; water balloons can now be printed at service
lathe, and entertainment modsuit can now blow long balloons!
image: Balloons will now have an unique sprite when in the inventory,
compared when to on the ground.
/🆑

<!-- Both 🆑's are required for the changelog to work! You can put
your name to the right of the first 🆑 if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->

---------

Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com>
Co-authored-by: san7890 <the@san7890.com>
Co-authored-by: Jacquerel <hnevard@gmail.com>

* Quick spellcheck 'steall' (#82560)

## About The Pull Request

https://github.com/tgstation/tgstation/pull/82447 quick followup to
this, caught it while glancing through the code.

* Fix

* merge conflicts

* Revert "Monkeys now use height offset (and monkey tail works) (#81598)"

This reverts commit 5cfdc5972d16c6b509220e8874a927696249d36a.

* fix

* Fixed lateinitialize

* This should cut it

* Oh right

* There?

* Damn, here?

* There

* [NO GBP] Fixes spurious runtime caused by icemoon (again) (#82582)

## About The Pull Request

https://github.com/tgstation/tgstation/pull/82572 I tried to fix this
but there was an unaccounted race condition which just caused a separate
runtime...


![firefox_GxGibAO281](https://github.com/tgstation/tgstation/assets/13398309/f251aecc-ef17-4bae-a741-5aade40de423)

Since the type is being changed mid-execution `replacement_turf` will
become out of scope. My bad--this should fix it now for good.

---------

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
Co-authored-by: Jeremiah <42397676+jlsnow301@users.noreply.github.com>
Co-authored-by: necromanceranne <40847847+necromanceranne@users.noreply.github.com>
Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com>
Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com>
Co-authored-by: Higgin <cdonny11@yahoo.com>
Co-authored-by: NeonNik2245 <106491639+NeonNik2245@users.noreply.github.com>
Co-authored-by: Thunder12345 <Thunder12345@users.noreply.github.com>
Co-authored-by: Lucy <lucy@absolucy.moe>
Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
Co-authored-by: san7890 <the@san7890.com>
Co-authored-by: YesterdaysPromise <122572637+YesterdaysPromise@users.noreply.github.com>
Co-authored-by: Jacquerel <hnevard@gmail.com>
Co-authored-by: Useroth <37159550+Useroth@users.noreply.github.com>
2024-04-26 01:22:24 +02:00

789 lines
30 KiB
Plaintext

#define ROUND_START_MUSIC_LIST "strings/round_start_sounds.txt"
#define SS_TICKER_TRAIT "SS_Ticker"
SUBSYSTEM_DEF(ticker)
name = "Ticker"
init_order = INIT_ORDER_TICKER
priority = FIRE_PRIORITY_TICKER
flags = SS_KEEP_TIMING
runlevels = RUNLEVEL_LOBBY | RUNLEVEL_SETUP | RUNLEVEL_GAME
/// state of current round (used by process()) Use the defines GAME_STATE_* !
var/current_state = GAME_STATE_STARTUP
/// Boolean to track if round should be forcibly ended next ticker tick.
/// Set by admin intervention ([ADMIN_FORCE_END_ROUND])
/// or a "round-ending" event, like summoning Nar'Sie, a blob victory, the nuke going off, etc. ([FORCE_END_ROUND])
var/force_ending = END_ROUND_AS_NORMAL
/// If TRUE, there is no lobby phase, the game starts immediately.
var/start_immediately = FALSE
/// Boolean to track and check if our subsystem setup is done.
var/setup_done = FALSE
var/login_music //music played in pregame lobby
var/round_end_sound //music/jingle played when the world reboots
var/round_end_sound_sent = TRUE //If all clients have loaded it
var/list/datum/mind/minds = list() //The characters in the game. Used for objective tracking.
var/delay_end = FALSE //if set true, the round will not restart on it's own
var/admin_delay_notice = "" //a message to display to anyone who tries to restart the world after a delay
var/ready_for_reboot = FALSE //all roundend preparation done with, all that's left is reboot
var/tipped = FALSE //Did we broadcast the tip of the day yet?
var/selected_tip // What will be the tip of the day?
var/timeLeft //pregame timer
var/start_at
var/gametime_offset = 432000 //Deciseconds to add to world.time for station time.
var/station_time_rate_multiplier = 12 //factor of station time progressal vs real time.
/// Num of players, used for pregame stats on statpanel
var/totalPlayers = 0
/// Num of ready players, used for pregame stats on statpanel (only viewable by admins)
var/totalPlayersReady = 0
/// Num of ready admins, used for pregame stats on statpanel (only viewable by admins)
var/total_admins_ready = 0
var/queue_delay = 0
var/list/queued_players = list() //used for join queues when the server exceeds the hard population cap
/// What is going to be reported to other stations at end of round?
var/news_report
var/roundend_check_paused = FALSE
var/round_start_time = 0
var/list/round_start_events
var/list/round_end_events
var/mode_result = "undefined"
var/end_state = "undefined"
/// People who have been commended and will receive a heart
var/list/hearts
/// Why an emergency shuttle was called
var/emergency_reason
var/real_round_start_time = 0 //SKYRAT EDIT ADDITION
var/discord_alerted = FALSE //SKYRAT EDIT - DISCORD PING SPAM PREVENTION
/datum/controller/subsystem/ticker/Initialize()
var/list/byond_sound_formats = list(
"mid" = TRUE,
"midi" = TRUE,
"mod" = TRUE,
"it" = TRUE,
"s3m" = TRUE,
"xm" = TRUE,
"oxm" = TRUE,
"wav" = TRUE,
"ogg" = TRUE,
"raw" = TRUE,
"wma" = TRUE,
"aiff" = TRUE,
)
var/list/provisional_title_music = flist("[global.config.directory]/title_music/sounds/")
var/list/music = list()
var/use_rare_music = prob(1)
for(var/S in provisional_title_music)
var/lower = LOWER_TEXT(S)
var/list/L = splittext(lower,"+")
switch(L.len)
if(3) //rare+MAP+sound.ogg or MAP+rare.sound.ogg -- Rare Map-specific sounds
if(use_rare_music)
if(L[1] == "rare" && L[2] == SSmapping.config.map_name)
music += S
else if(L[2] == "rare" && L[1] == SSmapping.config.map_name)
music += S
if(2) //rare+sound.ogg or MAP+sound.ogg -- Rare sounds or Map-specific sounds
if((use_rare_music && L[1] == "rare") || (L[1] == SSmapping.config.map_name))
music += S
if(1) //sound.ogg -- common sound
if(L[1] == "exclude")
continue
music += S
var/old_login_music = trim(file2text("data/last_round_lobby_music.txt"))
if(music.len > 1)
music -= old_login_music
for(var/S in music)
var/list/L = splittext(S,".")
if(L.len >= 2)
var/ext = LOWER_TEXT(L[L.len]) //pick the real extension, no 'honk.ogg.exe' nonsense here
if(byond_sound_formats[ext])
continue
music -= S
if(!length(music))
music = world.file2list(ROUND_START_MUSIC_LIST, "\n")
login_music = pick(music)
else
login_music = "[global.config.directory]/title_music/sounds/[pick(music)]"
if(!GLOB.syndicate_code_phrase)
GLOB.syndicate_code_phrase = generate_code_phrase(return_list=TRUE)
var/codewords = jointext(GLOB.syndicate_code_phrase, "|")
var/regex/codeword_match = new("([codewords])", "ig")
GLOB.syndicate_code_phrase_regex = codeword_match
if(!GLOB.syndicate_code_response)
GLOB.syndicate_code_response = generate_code_phrase(return_list=TRUE)
var/codewords = jointext(GLOB.syndicate_code_response, "|")
var/regex/codeword_match = new("([codewords])", "ig")
GLOB.syndicate_code_response_regex = codeword_match
start_at = world.time + (CONFIG_GET(number/lobby_countdown) * 10)
if(CONFIG_GET(flag/randomize_shift_time))
gametime_offset = rand(0, 23) HOURS
else if(CONFIG_GET(flag/shift_time_realtime))
gametime_offset = world.timeofday
else
gametime_offset = (CONFIG_GET(number/shift_time_start_hour) HOURS)
return SS_INIT_SUCCESS
/datum/controller/subsystem/ticker/fire()
switch(current_state)
if(GAME_STATE_STARTUP)
if(Master.initializations_finished_with_no_players_logged_in)
start_at = world.time + (CONFIG_GET(number/lobby_countdown) * 10)
for(var/client/C in GLOB.clients)
window_flash(C, ignorepref = TRUE) //let them know lobby has opened up.
to_chat(world, span_notice("<b>Welcome to [station_name()]!</b>"))
/* ORIGINAL:
send2chat("New round starting on [SSmapping.config.map_name]!", CONFIG_GET(string/channel_announce_new_game))
*/ // SKYRAT EDIT START - DISCORD SPAM PREVENTION
if(!discord_alerted)
discord_alerted = TRUE
send2chat(new /datum/tgs_message_content("<@&[CONFIG_GET(string/game_alert_role_id)]> Round **[GLOB.round_id]** starting on [SSmapping.config.map_name], [CONFIG_GET(string/servername)]! \nIf you wish to be pinged for game related stuff, go to <#[CONFIG_GET(string/role_assign_channel_id)]> and assign yourself the roles."), CONFIG_GET(string/channel_announce_new_game)) // SKYRAT EDIT - Role ping and round ID in game-alert
// SKYRAT EDIT END
current_state = GAME_STATE_PREGAME
SStitle.change_title_screen() //SKYRAT EDIT ADDITION - Title screen
addtimer(CALLBACK(SStitle, TYPE_PROC_REF(/datum/controller/subsystem/title, change_title_screen)), 1 SECONDS) //SKYRAT EDIT ADDITION - Title screen
//Everyone who wants to be an observer is now spawned
SEND_SIGNAL(src, COMSIG_TICKER_ENTER_PREGAME)
fire()
if(GAME_STATE_PREGAME)
//lobby stats for statpanels
if(isnull(timeLeft))
timeLeft = max(0,start_at - world.time)
totalPlayers = LAZYLEN(GLOB.new_player_list)
totalPlayersReady = 0
total_admins_ready = 0
for(var/mob/dead/new_player/player as anything in GLOB.new_player_list)
if(player.ready == PLAYER_READY_TO_PLAY)
++totalPlayersReady
if(player.client?.holder)
++total_admins_ready
if(start_immediately)
timeLeft = 0
//countdown
if(timeLeft < 0)
return
timeLeft -= wait
if(timeLeft <= 300 && !tipped)
send_tip_of_the_round(world, selected_tip)
tipped = TRUE
if(timeLeft <= 0)
SEND_SIGNAL(src, COMSIG_TICKER_ENTER_SETTING_UP)
current_state = GAME_STATE_SETTING_UP
Master.SetRunLevel(RUNLEVEL_SETUP)
SSevents.reschedule() // SKYRAT EDIT ADDITION
if(start_immediately)
fire()
if(GAME_STATE_SETTING_UP)
if(!setup())
//setup failed
current_state = GAME_STATE_STARTUP
start_at = world.time + (CONFIG_GET(number/lobby_countdown) * 10)
timeLeft = null
Master.SetRunLevel(RUNLEVEL_LOBBY)
SEND_SIGNAL(src, COMSIG_TICKER_ERROR_SETTING_UP)
if(GAME_STATE_PLAYING)
check_queue()
if(!roundend_check_paused && (check_finished() || force_ending))
current_state = GAME_STATE_FINISHED
toggle_ooc(TRUE) // Turn it on
toggle_dooc(TRUE)
declare_completion(force_ending)
check_maprotate()
Master.SetRunLevel(RUNLEVEL_POSTGAME)
/// Checks if the round should be ending, called every ticker tick
/datum/controller/subsystem/ticker/proc/check_finished()
if(!setup_done)
return FALSE
if(SSshuttle.emergency && (SSshuttle.emergency.mode == SHUTTLE_ENDGAME))
return TRUE
if(GLOB.station_was_nuked)
return TRUE
if(GLOB.revolutionary_win)
return TRUE
return FALSE
/datum/controller/subsystem/ticker/proc/setup()
to_chat(world, span_boldannounce("Starting game..."))
var/init_start = world.timeofday
CHECK_TICK
//Configure mode and assign player to antagonists
var/can_continue = FALSE
can_continue = SSdynamic.pre_setup() //Choose antagonists
CHECK_TICK
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_PRE_JOBS_ASSIGNED, src)
can_continue = can_continue && SSjob.DivideOccupations() //Distribute jobs
CHECK_TICK
if(!GLOB.Debug2)
if(!can_continue)
log_game("Game failed pre_setup")
to_chat(world, "<B>Error setting up game.</B> Reverting to pre-game lobby.")
SSjob.ResetOccupations()
return FALSE
else
message_admins(span_notice("DEBUG: Bypassing prestart checks..."))
CHECK_TICK
// There may be various config settings that have been set or modified by this point.
// This is the point of no return before spawning in new players, let's run over the
// job trim singletons and update them based on any config settings.
SSid_access.refresh_job_trim_singletons()
CHECK_TICK
if(!CONFIG_GET(flag/ooc_during_round))
toggle_ooc(FALSE) // Turn it off
CHECK_TICK
GLOB.start_landmarks_list = shuffle(GLOB.start_landmarks_list) //Shuffle the order of spawn points so they dont always predictably spawn bottom-up and right-to-left
create_characters() //Create player characters
collect_minds()
equip_characters()
GLOB.manifest.build()
transfer_characters() //transfer keys to the new mobs
for(var/I in round_start_events)
var/datum/callback/cb = I
cb.InvokeAsync()
LAZYCLEARLIST(round_start_events)
round_start_time = world.time //otherwise round_start_time would be 0 for the signals
SEND_SIGNAL(src, COMSIG_TICKER_ROUND_STARTING, world.time)
real_round_start_time = REALTIMEOFDAY //SKYRAT EDIT ADDITION
SSautotransfer.new_shift(real_round_start_time) //SKYRAT EDIT ADDITION
log_world("Game start took [(world.timeofday - init_start)/10]s")
INVOKE_ASYNC(SSdbcore, TYPE_PROC_REF(/datum/controller/subsystem/dbcore,SetRoundStart))
to_chat(world, span_notice(span_bold("Welcome to [station_name()], enjoy your stay!")))
SEND_SOUND(world, sound(SSstation.announcer.get_rand_welcome_sound()))
current_state = GAME_STATE_PLAYING
Master.SetRunLevel(RUNLEVEL_GAME)
if(length(GLOB.holidays))
to_chat(world, span_notice("and..."))
for(var/holidayname in GLOB.holidays)
var/datum/holiday/holiday = GLOB.holidays[holidayname]
to_chat(world, span_info(holiday.greet()))
PostSetup()
return TRUE
/datum/controller/subsystem/ticker/proc/PostSetup()
set waitfor = FALSE
SSdynamic.post_setup()
GLOB.start_state = new /datum/station_state()
GLOB.start_state.count()
var/list/adm = get_admin_counts()
var/list/allmins = adm["present"]
send2adminchat("Server", "Round [GLOB.round_id ? "#[GLOB.round_id]" : ""] has started[allmins.len ? ".":" with no active admins online!"]")
setup_done = TRUE
for(var/i in GLOB.start_landmarks_list)
var/obj/effect/landmark/start/S = i
if(istype(S)) //we can not runtime here. not in this important of a proc.
S.after_round_start()
else
stack_trace("[S] [S.type] found in start landmarks list, which isn't a start landmark!")
// handle persistence stuff that requires ckeys, in this case hardcore mode and temporal scarring
for(var/i in GLOB.player_list)
if(!ishuman(i))
continue
var/mob/living/carbon/human/iter_human = i
iter_human.increment_scar_slot()
iter_human.load_persistent_scars()
SSpersistence.load_modular_persistence(iter_human.get_organ_slot(ORGAN_SLOT_BRAIN)) // SKYRAT EDIT ADDITION - MODULAR_PERSISTENCE
if(!iter_human.hardcore_survival_score)
continue
if(iter_human.mind?.special_role)
to_chat(iter_human, span_notice("You will gain [round(iter_human.hardcore_survival_score) * 2] hardcore random points if you greentext this round!"))
else
to_chat(iter_human, span_notice("You will gain [round(iter_human.hardcore_survival_score)] hardcore random points if you survive this round!"))
//These callbacks will fire after roundstart key transfer
/datum/controller/subsystem/ticker/proc/OnRoundstart(datum/callback/cb)
if(!HasRoundStarted())
LAZYADD(round_start_events, cb)
else
cb.InvokeAsync()
//These callbacks will fire before roundend report
/datum/controller/subsystem/ticker/proc/OnRoundend(datum/callback/cb)
if(current_state >= GAME_STATE_FINISHED)
cb.InvokeAsync()
else
LAZYADD(round_end_events, cb)
/datum/controller/subsystem/ticker/proc/station_explosion_detonation(atom/bomb)
if(bomb) //BOOM
qdel(bomb)
/datum/controller/subsystem/ticker/proc/create_characters()
for(var/i in GLOB.new_player_list)
var/mob/dead/new_player/player = i
if(player.ready == PLAYER_READY_TO_PLAY && player.mind)
GLOB.joined_player_list += player.ckey
var/atom/destination = player.mind.assigned_role.get_roundstart_spawn_point()
if(!destination) // Failed to fetch a proper roundstart location, won't be going anywhere.
player.show_title_screen() //SKYRAT EDIT CHANGE
continue
player.create_character(destination)
else
player.show_title_screen() //SKYRAT EDIT ADDITION
CHECK_TICK
/datum/controller/subsystem/ticker/proc/collect_minds()
for(var/i in GLOB.new_player_list)
var/mob/dead/new_player/P = i
if(P.new_character && P.new_character.mind)
SSticker.minds += P.new_character.mind
CHECK_TICK
/datum/controller/subsystem/ticker/proc/equip_characters()
GLOB.security_officer_distribution = decide_security_officer_departments(
shuffle(GLOB.new_player_list),
shuffle(GLOB.available_depts),
)
var/captainless = TRUE
var/highest_rank = length(SSjob.chain_of_command) + 1
var/list/spare_id_candidates = list()
var/mob/dead/new_player/picked_spare_id_candidate
// Find a suitable player to hold captaincy.
for(var/mob/dead/new_player/new_player_mob as anything in GLOB.new_player_list)
if(is_banned_from(new_player_mob.ckey, list(JOB_CAPTAIN)))
CHECK_TICK
continue
if(!ishuman(new_player_mob.new_character))
continue
var/mob/living/carbon/human/new_player_human = new_player_mob.new_character
if(!new_player_human.mind || is_unassigned_job(new_player_human.mind.assigned_role))
continue
// Keep a rolling tally of who'll get the cap's spare ID vault code.
// Check assigned_role's priority and curate the candidate list appropriately.
var/player_assigned_role = new_player_human.mind.assigned_role.title
var/spare_id_priority = SSjob.chain_of_command[player_assigned_role]
if(spare_id_priority)
if(spare_id_priority < highest_rank)
spare_id_candidates.Cut()
spare_id_candidates += new_player_mob
highest_rank = spare_id_priority
else if(spare_id_priority == highest_rank)
spare_id_candidates += new_player_mob
CHECK_TICK
if(length(spare_id_candidates))
picked_spare_id_candidate = pick(spare_id_candidates)
for(var/mob/dead/new_player/new_player_mob as anything in GLOB.new_player_list)
if(QDELETED(new_player_mob) || !isliving(new_player_mob.new_character))
CHECK_TICK
continue
var/mob/living/new_player_living = new_player_mob.new_character
if(!new_player_living.mind)
CHECK_TICK
continue
var/datum/job/player_assigned_role = new_player_living.mind.assigned_role
if(player_assigned_role.job_flags & JOB_EQUIP_RANK)
SSjob.EquipRank(new_player_living, player_assigned_role, new_player_mob.client)
player_assigned_role.after_roundstart_spawn(new_player_living, new_player_mob.client)
if(picked_spare_id_candidate == new_player_mob)
captainless = FALSE
var/acting_captain = !is_captain_job(player_assigned_role)
SSjob.promote_to_captain(new_player_living, acting_captain)
OnRoundstart(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(minor_announce), player_assigned_role.get_captaincy_announcement(new_player_living)))
if((player_assigned_role.job_flags & JOB_ASSIGN_QUIRKS) && ishuman(new_player_living) && CONFIG_GET(flag/roundstart_traits))
if(new_player_mob.client?.prefs?.should_be_random_hardcore(player_assigned_role, new_player_living.mind))
new_player_mob.client.prefs.hardcore_random_setup(new_player_living)
SSquirks.AssignQuirks(new_player_living, new_player_mob.client)
//SKYRAT EDIT ADDITION
if(ishuman(new_player_living))
for(var/datum/loadout_item/item as anything in loadout_list_to_datums(new_player_mob.client?.prefs?.loadout_list))
if (item.restricted_roles && length(item.restricted_roles) && !(player_assigned_role.title in item.restricted_roles))
continue
item.post_equip_item(new_player_mob.client?.prefs, new_player_living)
//SKYRAT EDIT END
CHECK_TICK
if(captainless)
for(var/mob/dead/new_player/new_player_mob as anything in GLOB.new_player_list)
var/mob/living/carbon/human/new_player_human = new_player_mob.new_character
if(new_player_human)
to_chat(new_player_mob, span_notice("Captainship not forced on anyone."))
CHECK_TICK
/datum/controller/subsystem/ticker/proc/decide_security_officer_departments(
list/new_players,
list/departments,
)
var/list/officer_mobs = list()
var/list/officer_preferences = list()
for (var/mob/dead/new_player/new_player_mob as anything in new_players)
var/mob/living/carbon/human/character = new_player_mob.new_character
if (istype(character) && is_security_officer_job(character.mind?.assigned_role))
officer_mobs += character
var/datum/client_interface/client = GET_CLIENT(new_player_mob)
var/preference = client?.prefs?.read_preference(/datum/preference/choiced/security_department)
officer_preferences += preference
var/distribution = get_officer_departments(officer_preferences, departments)
var/list/output = list()
for (var/index in 1 to officer_mobs.len)
output[REF(officer_mobs[index])] = distribution[index]
return output
/datum/controller/subsystem/ticker/proc/transfer_characters()
var/list/livings = list()
for(var/mob/dead/new_player/player as anything in GLOB.new_player_list)
var/mob/living = player.transfer_character()
if(living)
qdel(player)
ADD_TRAIT(living, TRAIT_NO_TRANSFORM, SS_TICKER_TRAIT)
if(living.client)
var/atom/movable/screen/splash/S = new(null, living.client, TRUE)
S.Fade(TRUE)
living.client.init_verbs()
livings += living
if(livings.len)
addtimer(CALLBACK(src, PROC_REF(release_characters), livings), 3 SECONDS, TIMER_CLIENT_TIME)
/datum/controller/subsystem/ticker/proc/release_characters(list/livings)
for(var/mob/living/living_mob as anything in livings)
REMOVE_TRAIT(living_mob, TRAIT_NO_TRANSFORM, SS_TICKER_TRAIT)
/datum/controller/subsystem/ticker/proc/check_queue()
if(!queued_players.len)
return
var/hard_popcap = CONFIG_GET(number/hard_popcap)
if(!hard_popcap)
list_clear_nulls(queued_players)
for (var/mob/dead/new_player/new_player in queued_players)
to_chat(new_player, span_userdanger("The alive players limit has been released!<br><a href='?src=[REF(new_player)];late_join=override'>[html_encode(">>Join Game<<")]</a>"))
SEND_SOUND(new_player, sound('sound/misc/notice1.ogg'))
GLOB.latejoin_menu.ui_interact(new_player)
queued_players.len = 0
queue_delay = 0
return
queue_delay++
var/mob/dead/new_player/next_in_line = queued_players[1]
switch(queue_delay)
if(5) //every 5 ticks check if there is a slot available
list_clear_nulls(queued_players)
if(living_player_count() < hard_popcap)
if(next_in_line?.client)
to_chat(next_in_line, span_userdanger("A slot has opened! You have approximately 20 seconds to join. <a href='?src=[REF(next_in_line)];late_join=override'>\>\>Join Game\<\<</a>"))
SEND_SOUND(next_in_line, sound('sound/misc/notice1.ogg'))
next_in_line.ui_interact(next_in_line)
return
queued_players -= next_in_line //Client disconnected, remove he
queue_delay = 0 //No vacancy: restart timer
if(25 to INFINITY) //No response from the next in line when a vacancy exists, remove he
to_chat(next_in_line, span_danger("No response received. You have been removed from the line."))
queued_players -= next_in_line
queue_delay = 0
/datum/controller/subsystem/ticker/proc/check_maprotate()
if(!CONFIG_GET(flag/maprotation))
return
if(world.time - SSticker.round_start_time < 10 MINUTES) //Not forcing map rotation for very short rounds.
return
INVOKE_ASYNC(SSmapping, TYPE_PROC_REF(/datum/controller/subsystem/mapping/, maprotate))
/datum/controller/subsystem/ticker/proc/HasRoundStarted()
return current_state >= GAME_STATE_PLAYING
/datum/controller/subsystem/ticker/proc/IsRoundInProgress()
return current_state == GAME_STATE_PLAYING
/datum/controller/subsystem/ticker/Recover()
current_state = SSticker.current_state
force_ending = SSticker.force_ending
login_music = SSticker.login_music
round_end_sound = SSticker.round_end_sound
minds = SSticker.minds
delay_end = SSticker.delay_end
tipped = SSticker.tipped
selected_tip = SSticker.selected_tip
timeLeft = SSticker.timeLeft
totalPlayers = SSticker.totalPlayers
totalPlayersReady = SSticker.totalPlayersReady
total_admins_ready = SSticker.total_admins_ready
queue_delay = SSticker.queue_delay
queued_players = SSticker.queued_players
round_start_time = SSticker.round_start_time
queue_delay = SSticker.queue_delay
queued_players = SSticker.queued_players
if (Master) //Set Masters run level if it exists
switch (current_state)
if(GAME_STATE_SETTING_UP)
Master.SetRunLevel(RUNLEVEL_SETUP)
if(GAME_STATE_PLAYING)
Master.SetRunLevel(RUNLEVEL_GAME)
if(GAME_STATE_FINISHED)
Master.SetRunLevel(RUNLEVEL_POSTGAME)
/datum/controller/subsystem/ticker/proc/send_news_report()
var/news_message
var/news_source = "Nanotrasen News Network"
var/decoded_station_name = html_decode(CONFIG_GET(string/cross_comms_name)) //decode station_name to avoid minor_announce double encode // SKYRAT EDIT: CROSS COMMS CONFIG
switch(news_report)
// The nuke was detonated on the syndicate recon outpost
if(NUKE_SYNDICATE_BASE)
news_message = "In a daring raid, the heroic crew of [decoded_station_name] \
detonated a nuclear device in the heart of a terrorist base."
// The station was destroyed by nuke ops
if(STATION_DESTROYED_NUKE)
news_message = "We would like to reassure all employees that the reports of a Syndicate \
backed nuclear attack on [decoded_station_name] are, in fact, a hoax. Have a secure day!"
// The station was evacuated (normal result)
if(STATION_EVACUATED)
// Had an emergency reason supplied to pass along
if(emergency_reason)
news_message = "[decoded_station_name] has been evacuated after transmitting \
the following distress beacon:\n\n[html_decode(emergency_reason)]"
else
news_message = "The crew of [decoded_station_name] has been \
evacuated amid unconfirmed reports of enemy activity."
// A blob won
if(BLOB_WIN)
news_message = "[decoded_station_name] was overcome by an unknown biological outbreak, killing \
all crew on board. Don't let it happen to you! Remember, a clean work station is a safe work station."
// A blob was destroyed
if(BLOB_DESTROYED)
news_message = "[decoded_station_name] is currently undergoing decontamination procedures \
after the destruction of a biological hazard. As a reminder, any crew members experiencing \
cramps or bloating should report immediately to security for incineration."
// A certain percentage of all cultists managed to escape at the end of round
if(CULT_ESCAPE)
news_message = "Security Alert: A group of religious fanatics have escaped from [decoded_station_name]."
// Cult was completely or almost completely wiped out
if(CULT_FAILURE)
news_message = "Following the dismantling of a restricted cult aboard [decoded_station_name], \
we would like to remind all employees that worship outside of the Chapel is strictly prohibited, \
and cause for termination."
// Cult summoned Nar'sie
if(CULT_SUMMON)
news_message = "Company officials would like to clarify that [decoded_station_name] was scheduled \
to be decommissioned following meteor damage earlier this year. Earlier reports of an \
unknowable eldritch horror were made in error."
// Nuke detonated, but missed the station entirely
if(NUKE_MISS)
news_message = "The Syndicate have bungled a terrorist attack [decoded_station_name], \
detonating a nuclear weapon in empty space nearby."
// All nuke ops got killed
if(OPERATIVES_KILLED)
news_message = "Repairs to [decoded_station_name] are underway after an elite \
Syndicate death squad was wiped out by the crew."
// Nuke ops results inconclusive - Crew escaped without the disk, or nukies were left alive, or something
if(OPERATIVE_SKIRMISH)
news_message = "A skirmish between security forces and Syndicate agents aboard [decoded_station_name] \
ended with both sides bloodied but intact."
// Revolution victory
if(REVS_WIN)
news_message = "Company officials have reassured investors that despite a union led revolt \
aboard [decoded_station_name] there will be no wage increases for workers."
// Revolution defeat
if(REVS_LOSE)
news_message = "[decoded_station_name] quickly put down a misguided attempt at mutiny. \
Remember, unionizing is illegal!"
// All wizards (plus apprentices) have been killed
if(WIZARD_KILLED)
news_message = "Tensions have flared with the Space Wizard Federation following the death \
of one of their members aboard [decoded_station_name]."
// The station was nuked generically
if(STATION_NUKED)
// There was a blob on board, guess it was nuked to stop it
if(length(GLOB.overminds))
for(var/mob/camera/blob/overmind as anything in GLOB.overminds)
if(overmind.max_count < overmind.announcement_size)
continue
news_message = "[decoded_station_name] is currently undergoing decontanimation after a controlled \
burst of radiation was used to remove a biological ooze. All employees were safely evacuated prior, \
and are enjoying a relaxing vacation."
break
// A self destruct or something else
else
news_message = "[decoded_station_name] activated its self-destruct device for unknown reasons. \
Attempts to clone the Captain for arrest and execution are underway."
// The emergency escape shuttle was hijacked
if(SHUTTLE_HIJACK)
news_message = "During routine evacuation procedures, the emergency shuttle of [decoded_station_name] \
had its navigation protocols corrupted and went off course, but was recovered shortly after."
// A supermatter cascade triggered
if(SUPERMATTER_CASCADE)
news_message = "Officials are advising nearby colonies about a newly declared exclusion zone in \
the sector surrounding [decoded_station_name]."
//SKYRAT EDIT - START
if(SSblackbox.first_death)
var/list/ded = SSblackbox.first_death
if(ded.len)
news_message += " NT Sanctioned Psykers picked up faint traces of someone near the station, allegedly having had died. Their name was: [ded["name"]], [ded["role"]], at [ded["area"]].[ded["last_words"] ? " Their last words were: \"[ded["last_words"]]\"" : ""]" // " // An Extra quote and comment because highlighting goes weird
else
news_message += " NT Sanctioned Psykers proudly confirm reports that nobody died this shift!"
//SKYRAT EDIT - END
if(news_message && length(CONFIG_GET(keyed_list/cross_server))) //SKYRAT EDIT - CONFIG CHECK MOVED FROM ROUNDEND.DM
news_message += " (Shift on [CONFIG_GET(string/cross_server_name)] ending!)" //SKYRAT EDIT ADDITION
send2otherserver(news_source, news_message,"News_Report")
//SKYRAT EDIT - START
if(news_message)
return news_message
else
return "We regret to inform you that shit be whack, yo. None of our reporters have any idea of what may or may not have gone on."
//SKYRAT EDIT - END
/datum/controller/subsystem/ticker/proc/GetTimeLeft()
if(isnull(SSticker.timeLeft))
return max(0, start_at - world.time)
return timeLeft
/datum/controller/subsystem/ticker/proc/SetTimeLeft(newtime)
if(newtime >= 0 && isnull(timeLeft)) //remember, negative means delayed
start_at = world.time + newtime
else
timeLeft = newtime
/datum/controller/subsystem/ticker/proc/SetRoundEndSound(the_sound)
set waitfor = FALSE
round_end_sound_sent = FALSE
round_end_sound = fcopy_rsc(the_sound)
for(var/thing in GLOB.clients)
var/client/C = thing
if (!C)
continue
C.Export("##action=load_rsc", round_end_sound)
round_end_sound_sent = TRUE
/datum/controller/subsystem/ticker/proc/Reboot(reason, end_string, delay)
set waitfor = FALSE
if(usr && !check_rights(R_SERVER, TRUE))
return
if(!delay)
delay = CONFIG_GET(number/round_end_countdown) * 10
var/skip_delay = check_rights()
if(delay_end && !skip_delay)
to_chat(world, span_boldannounce("An admin has delayed the round end."))
return
to_chat(world, span_boldannounce("Rebooting World in [DisplayTimeText(delay)]. [reason]"))
var/start_wait = world.time
UNTIL(round_end_sound_sent || (world.time - start_wait) > (delay * 2)) //don't wait forever
sleep(delay - (world.time - start_wait))
if(delay_end && !skip_delay)
to_chat(world, span_boldannounce("Reboot was cancelled by an admin."))
return
if(end_string)
end_state = end_string
var/statspage = CONFIG_GET(string/roundstatsurl)
var/gamelogloc = CONFIG_GET(string/gamelogurl)
if(statspage)
to_chat(world, span_info("Round statistics and logs can be viewed <a href=\"[statspage][GLOB.round_id]\">at this website!</a>"))
else if(gamelogloc)
to_chat(world, span_info("Round logs can be located <a href=\"[gamelogloc]\">at this website!</a>"))
log_game(span_boldannounce("Rebooting World. [reason]"))
world.Reboot()
/datum/controller/subsystem/ticker/Shutdown()
gather_newscaster() //called here so we ensure the log is created even upon admin reboot
if(!round_end_sound)
round_end_sound = choose_round_end_song()
///The reference to the end of round sound that we have chosen.
var/sound/end_of_round_sound_ref = sound(round_end_sound)
for(var/mob/M in GLOB.player_list)
if(M.client.prefs.read_preference(/datum/preference/toggle/sound_endofround))
SEND_SOUND(M.client, end_of_round_sound_ref)
text2file(login_music, "data/last_round_lobby_music.txt")
/datum/controller/subsystem/ticker/proc/choose_round_end_song()
var/list/reboot_sounds = flist("[global.config.directory]/reboot_themes/")
var/list/possible_themes = list()
for(var/themes in reboot_sounds)
possible_themes += themes
if(possible_themes.len)
return "[global.config.directory]/reboot_themes/[pick(possible_themes)]"
#undef ROUND_START_MUSIC_LIST
#undef SS_TICKER_TRAIT