Compare commits

...

344 Commits

Author SHA1 Message Date
Nim
ca23fddd8a Lyre and flute (#759)
* music

* fix desc

* Update T1_fire_rune.yml

---------

Co-authored-by: Ed <96445749+TheShuEd@users.noreply.github.com>
Co-authored-by: Ed <edwardxperia2000@gmail.com>
2025-01-17 01:26:39 +03:00
Ed
50c502f598 AOE Spells (#758)
* AoE gameplay

* Update T1_fire_rune.yml

* test

* add cool AoE visual
2025-01-17 01:01:44 +03:00
Ed
0783eb1380 Knowledge system (#770)
* remove all requirements

* clean up and renaming to knowledge

* update code

* add admin knowledge verbs

* move shoes under pants

* knowledge based recipes

* clean up

* sewing knowledges

* knowledge dependencies

* knowledge learning objects

* more knowledge

* metallforging skill

* knowledge books

* start knowledges, T1 and T2 books in demiplanes

* remove coins from demiplanes

* roundstart knowledge
2025-01-17 00:08:13 +03:00
Nim
5af56d4655 fiiiiiix (#766) 2025-01-16 01:42:20 +03:00
MetalSage
6e77b82da7 fix (#763)
Co-authored-by: MetalSage <metalsage.official@gmail.com>
2025-01-15 20:14:50 +03:00
Nim
02cfcd620c Inter-Monster tolerance (#761)
* Insects ai

* monster
2025-01-15 17:34:38 +03:00
Ed
e6097da7cc Update CP14MagicEnergyPhotosynthesisComponent.cs 2025-01-15 01:05:28 +03:00
Ed
925738afc2 Workbench update (#760)
* fix workbench icons

* workbench search

* fix 1

* UI finalize

* fix material localization

* restore shard sprite

* Update sewing_table.yml
2025-01-15 00:34:08 +03:00
Ed
cf41cabcea Remove OP (#757)
* remove outdated content

* Update migration.yml

* Update twoHandedStaffs.yml
2025-01-14 14:36:10 +03:00
Ed
87d57df0e6 Omsoyk epic clothing pack (#756)
* new shirts

* pants and dresses

* blue cloak
2025-01-14 12:03:10 +03:00
Ed
51a47eaffc Bunch of gameplay issues (#754)
* fix demiplane contetn filtering

* fix day demiplanes

* remove filled crystals from demiplanes

* remove armored zombies

* added candles in town crates

* remove 20% unefficient of mana moving spells

* fix #622

* revert random Viator commit

* Update demiplane_rifts.yml
2025-01-14 01:41:11 +03:00
Nim
c7c5b4dc4c bench fix (#755) 2025-01-13 23:24:33 +03:00
Nim
2644fe26ea Ashes and Russian translation edits with a couple of minor fixes (#735)
* ash++++

* fix

* по запросу
2025-01-13 23:01:34 +03:00
Nim
732bc267f7 Bench (#751)
* bench

* anchored
2025-01-13 22:59:57 +03:00
Viator-MV
ddd61df7b8 изменение текстуры книги законов
текстура книги законов изменена на подходящую к новым книгам
2025-01-13 21:37:30 +03:00
Ed
025753e689 revert 2025-01-13 18:09:40 +03:00
Ed
368839dd68 Bugixes (#750)
* fix #746

* fix #745

* fix #747

* fix #744

* fix #743

* fix #741

* fix #722
2025-01-13 12:54:46 +03:00
vladimir.s
f5edf03bf6 double hp and mana alerts (#749)
* double hp and mana alerts

* Update alerts.yml

---------

Co-authored-by: Ed <edwardxperia2000@gmail.com>
2025-01-12 23:05:19 +03:00
Ed
b5f70616c3 New lobby art (#748)
* lobby

* back to rus
2025-01-12 22:39:33 +03:00
Nim
e11d8a1c1a fix (#736) 2025-01-12 17:22:19 +03:00
Ed
3cce07be5a switch to eng 2025-01-12 17:10:27 +03:00
Nim
93c4e6068f Balance and fixes (#733)
* issue

* mosquitoes

* 👽
2025-01-12 17:00:35 +03:00
MetalSage
89b9a5c1fe Additive lighting (#685)
* Additive lighting

* adds options for all your optional needs

* one last tiny adjustment before we hit the create pr button

* spaghetti condensing

* add ccvar

* overlight correction

* fix requested changes

* cvar fix

* last fix

* nice

---------

Co-authored-by: deathride58 <deathride58@users.noreply.github.com>
Co-authored-by: MetalSage <metalsage.official@gmail.com>
Co-authored-by: Ed <96445749+TheShuEd@users.noreply.github.com>
Co-authored-by: Ed <edwardxperia2000@gmail.com>
2025-01-12 13:33:06 +03:00
MetalSage
a6847c08e8 Add "Mana Wasting" trait (#732)
* add trait

* Update Resources/Locale/ru-RU/_CP14/magicEnergy/magic-spells.ftl

* fix magic item using

---------

Co-authored-by: MetalSage <metalsage.official@gmail.com>
Co-authored-by: Ed <96445749+TheShuEd@users.noreply.github.com>
Co-authored-by: Ed <edwardxperia2000@gmail.com>
2025-01-12 13:10:45 +03:00
Ed
485ddaa739 map fix 2025-01-12 03:06:51 +03:00
Ed
f2ef46d90e New apprentice role / Новая роль подмастерья (#731)
* new role

* Update role_loadouts.yml

* Update jobs.yml

* Delete g.png
2025-01-12 03:05:47 +03:00
Nim
61897eae4f target (#730) 2025-01-12 02:01:53 +03:00
Ed
4a2c3c9d59 clean up CVars 2025-01-11 13:01:53 +03:00
Ed
3d0f303930 Create Dev.toml 2025-01-11 12:37:03 +03:00
Ed
0af7a7ec64 Alchemist content (#718)
* reinforced vials

* glass recipes

* roundstart alchemist potions
2025-01-10 16:17:32 +03:00
Ed
c41927cdf2 Bugfixes (#716)
* job localization fix

* Update job.ftl

* metall scraps

* tomato seeds craft

* fix #105

* health alerts fixed

* bucket size fix

* hat fix
2025-01-09 22:28:39 +03:00
A.Ne.
c3976dd08d plants inspection, resolve #449 (#615)
* plants inspection, resolve #449

* Update farming.ftl

---------

Co-authored-by: Ed <96445749+TheShuEd@users.noreply.github.com>
2025-01-09 22:05:22 +03:00
Nim
1af112aeb2 candle (#713) 2025-01-09 21:26:14 +03:00
Ed
9ab34417f4 More Bank positions (#715)
* add bank positions

* Update sell.yml
2025-01-09 17:23:35 +03:00
Nim
005a6012be sound (#714) 2025-01-09 16:40:18 +03:00
Ed
f1fc16c6f0 Update CP14IgnitionModifierComponent.cs 2025-01-09 15:27:28 +03:00
Ed
2b0fa46857 david balance pass (#712) 2025-01-09 13:13:35 +03:00
Nim
4366e940cb armor (#710) 2025-01-09 00:46:53 +03:00
Nim
76d828e9fd Мелочи фидбека (#709)
* things

* chees

* hmm

* tag

---------

Co-authored-by: Ed <96445749+TheShuEd@users.noreply.github.com>
2025-01-09 00:46:27 +03:00
Ed
00ecf1f4b6 Health alerts + Modular tools labeling renaming (#708)
* fix health alert

* grips label

* Update grips.yml
2025-01-08 23:22:58 +03:00
Ed
815c031a16 localization sync 2025-01-08 15:31:17 +03:00
Ed
8248fcb07e Events tweaks (#707)
* mosquito + outbreak markers

* Update comoss.yml

* Update monster.yml
2025-01-08 14:16:38 +03:00
Ed
228a7226ff Random events (#706)
* first game event! Closet skeleton!

* demiplane outbreak gamerules

* Update game_presets.yml

* d
2025-01-08 02:55:54 +03:00
Ed
5c21ec2774 fix 2025-01-07 23:41:42 +03:00
Ed
35eb0c48c1 Graves and Tombstones (#705)
* dirt grave

* Update grave.yml

* tombstone

* Update grave.yml
2025-01-07 18:08:47 +03:00
Ed
676b85b22b Update Goblin.xml 2025-01-07 00:24:00 +03:00
Ed
5f2583fab0 Goblin gameplay (#704)
* silva fix

* goblinoids
2025-01-06 23:10:42 +03:00
Ed
8892d3913d Tiefling gameplay (#703)
* tiefling damage mana

* tiefling spell

* tweaks
2025-01-06 17:08:49 +03:00
Ed
71e6bd4f24 Elf (#702) 2025-01-06 14:05:46 +03:00
Ed
b647583b7b Silva species gameplay difference (#701)
* plant growth spell, silva photosyntesis

* playable species guidebook

* fixes
2025-01-06 03:31:59 +03:00
Ed
ed75beb0fb New species: Silva (#700)
* base silva species

* markings

* Update silva.yml
2025-01-05 23:23:18 +03:00
Ed
fe43e51930 Elves are skinny now (#699)
* elf THICC

* Update elf.yml
2025-01-05 20:17:25 +03:00
Nim
9ea8111d9e angel statue (#696) 2025-01-05 19:10:33 +03:00
Ed
639db84a0b dayCycle prototipization (#694) 2025-01-05 19:08:35 +03:00
Ed
9f798b4f6c Sprint loadout action (#698)
* SpellStorage restruct

* Update CP14SpellStorageSystem.cs

* Sprint
2025-01-05 17:46:54 +03:00
Ed
be3064b99c Modular sprites auto coloring (#697)
* axe and dagger update

* more blade processing

* shovel and sickle

* sword

* gardes

* grips

* modular presets

* blade material modifiers

* modular spear blade

* balance sharp garde, add sturdy garde

* Update sturdy.yml
2025-01-05 04:01:31 +03:00
A.Ne.
9a8f66727f modular tool inspection (#683)
* modular tool inspection

* update
2025-01-04 23:43:51 +03:00
Nim
945e74b690 Holiday Gob (#691)
* gob

* festive system
2025-01-04 23:42:09 +03:00
Nim
fc1e9d2638 christmas hat (#695) 2025-01-04 23:34:59 +03:00
Ed
36d02fdf6e Magic spells code expansion (#692)
* split manacost in separate component

* stamina spells

* toggleable actions

* swap activeCasting on ActiveDoAfter

* remove dublication

* Update CP14SharedMagicSystem.ToggleableActions.cs

* EntityWoldTarget

* mana glove done

* fix spell scrolls interrupting

* fix cooldown problem

* clean up, edit stamina system
2025-01-04 21:35:59 +03:00
Ed
a6a4a8da3f Merge pull request #687 from crystallpunk-14/ed-22-12-2024-upstream
Swap to RU lang, + Upstream sync
2025-01-03 18:38:23 +03:00
Ed
be6c2754f9 Update bagel.yml 2025-01-03 18:37:44 +03:00
Ed
86e74a0fc2 Merge branch 'ed-22-12-2024-upstream' of https://github.com/crystallpunk-14/crystall-punk-14 into ed-22-12-2024-upstream 2024-12-30 15:06:39 +03:00
Ed
a75ac73c70 Merge remote-tracking branch 'upstream/master' into ed-22-12-2024-upstream 2024-12-30 15:05:05 +03:00
Ed
4011de828f Merge branch 'master' into ed-22-12-2024-upstream 2024-12-30 15:01:14 +03:00
Ed
5c9ea3f428 fix (#690) 2024-12-30 15:00:02 +03:00
Ed
de6ddb52be pulato (#689) 2024-12-30 13:58:53 +03:00
Viator-MV
3b53c1abbb map update (#688)
* Update comoss.yml

* Update comoss_d.yml

* Update comoss_d.yml

* Update comoss_d.yml

---------

Co-authored-by: Ed <edwardxperia2000@gmail.com>
Co-authored-by: Ed <96445749+TheShuEd@users.noreply.github.com>
2024-12-30 13:58:06 +03:00
Southbridge
4acfec8e36 Amber Station Overhaul (#34113)
* Step 01: Remade arrivals

* Nearly finished, also added new beacons and a holopad

* Wrapped up all changes, also added a beacon for the docking arm
2024-12-30 00:37:05 -07:00
Dylan Hunter Whittingham
608b433da4 Added ID entry for captain on Bagel (#34120)
added id for captain

Co-authored-by: dylanhunter <dylan2.whittingham@live.uwe.ac.uk>
2024-12-29 13:23:18 -07:00
Velcroboy
c2ffc25970 Adds kitchen/botany-locked maints airlock (#34116)
Co-authored-by: Velcroboy <velcroboy333@hotmail.com>
2024-12-29 21:14:36 +03:00
lzk
072b973f3b fix interdimensional teleporter desc (#34108)
Update hand_teleporter.yml
2024-12-28 22:28:58 -05:00
PJBot
da8bb996b1 Automatic changelog update 2024-12-29 03:26:46 +00:00
Velcroboy
d6a9fe1c84 Rolling joints no longer requires a filter (#34106)
* Remove filters from joint crafting

* err

* hmmm

* guhhh

* yyyy

* whitespace

---------

Co-authored-by: Velcroboy <velcroboy333@hotmail.com>
2024-12-28 22:25:39 -05:00
PJBot
a7ca552dfc Automatic changelog update 2024-12-29 02:03:31 +00:00
ArtisticRoomba
e07609b3b3 New cotton baguette, crostini, chevre-chaud, bagel, and croissant foods for moffs (#33508)
* A looooooooot of new cotton foods for the moffs

* address slam's comments on the food for moffs not having any moff food in the food (the food that's intended for moffs)

* alternative sprites for bagel-cottondough.png, baguette-cotton.png, and croissant-cotton.png

* update requested sprites

* change requested sprites

* address part of sloth's review, awaiting response

* address second half of review, fix magical food nutriment mitosis bug
2024-12-29 03:02:24 +01:00
Booblesnoot42
2c41ed0939 Corrected Cotton Dough Recipe (#33988) 2024-12-29 02:56:23 +01:00
PJBot
4bb68c4bac Automatic changelog update 2024-12-29 01:51:56 +00:00
SolStar
bfb256f0ba Add a guaranteed cotton pizza to pizza crates (#33997)
* add guaranteed cotton pizza to pizza crates

* saner parenting

* Use clearer suffix on cotton pizza box
2024-12-29 02:50:49 +01:00
PJBot
9f9553b526 Automatic changelog update 2024-12-29 01:50:11 +00:00
zHonys
5d0d37161d Added support so that smile can use hats (#33924)
* Added support so that smile can use hats

Changed Prototypes/Entities/Mobs/NPCs/pets.yml
Added smile_inventory_template.yml in Resources/Prototypes/inventoryTemplates
Added dir smile_displacement.rsi inside Resources/Textures/Mobs/Pets/smile.rsi
Added smile_displacement.rsi/meta.json
Added smile_displacement.rsi/head.png

* Fixed sprite path in ProtoTypes/Entities/Mobs/NPCs/pets.yml mapping to wrong smile_displacement.rsi
Fixed smile_inventory_template.yml using uiWindowPos as 1,2 instead of 0,1

Moved Resources/Textures/Mobs/Pets/smile.rsi/ to .../Pets/smile/smile.rsi/
Moved Resources/Textures/Mobs/Pets/smile.rsi/smile_displacement.rsi to .../Pets/smile/smile_displacement.rsi

* Minor fixes: removing comments and change naming

Renamed Resources/Textures/Mobs/Pets/smile/smile.rsi To .../Mobs/Pets/Smile/smile.rsi

* Removed smile_inventory_template.yml and used head_inventory_template.yml instead
2024-12-29 02:49:05 +01:00
github-actions[bot]
3f84b04e4c Update Credits (#34109)
Co-authored-by: PJBot <pieterjan.briers+bot@gmail.com>
2024-12-29 01:39:04 +01:00
PJBot
4155440a1b Automatic changelog update 2024-12-28 23:34:22 +00:00
chromiumboy
6c465153ab UI improvements for holopads (#34055)
* Initial commit

* Minor update
2024-12-29 00:33:15 +01:00
PursuitInAshes
01980cb0bf Removes weh.txt from Textures/Parallaxes (#34097)
Removes Unneeded File
2024-12-28 17:52:27 +01:00
PJBot
1b478d46f5 Automatic changelog update 2024-12-28 14:50:11 +00:00
psykana
616d34102b Traitor can no longer get multiple objectives to save/help/kill the same person (#33704)
* Deduplicate traitor objectives

* Remove redundant check
2024-12-28 15:49:03 +01:00
PJBot
b24ab38992 Automatic changelog update 2024-12-28 10:14:21 +00:00
Alpaccalypse
a21d8099a9 Removed Power Monitoring Computer boards from research and lathe recipes. Added default engineering sprites for atmos computer boards. (#34078)
* Defined sprites for Atmospheric Alerts and Monitoring computer boards. Added research unlocks and lathe recipes for them.

* Defined default engineering sprite for atmospherics computer boards. Removed Power Monitoring Computer board from research and lathe recipes.

* Defined engineering sprite for atmos computer boards. Removed Power Monitoring Computer board from research and lathe recipes.
2024-12-28 11:13:13 +01:00
lzk
d92ed75703 Fix wagging action name and desc (#34089) 2024-12-28 13:00:12 +03:00
Leon Friedrich
97dd5513f5 Ignore audio entities in SpawnAndDeleteEntityCountTest (#34021) 2024-12-28 11:54:32 +11:00
PJBot
9acce42f92 Automatic changelog update 2024-12-27 13:35:38 +00:00
Plykiya
860052c383 Fix popup on handcuffing for person being handcuffed (#33639)
* Fix popup on handcuffing for person being handcuffed

* wrap onto newlines to appease the style gods
2024-12-27 16:34:32 +03:00
PJBot
ca0596e6f1 Automatic changelog update 2024-12-27 12:35:38 +00:00
crazybrain23
34e9979dc5 Arrivals blacklist for bluespace lockers and QSIs (#34072)
* Ensure Arrivals Blacklist in Bluespace Locker rule

* While I'm at it, stop the QSI too

* fix thing I broke somehow

* Every bluespace locker arrivals blacklisted

* Add ArrivalsBlacklist to the prototypes too
2024-12-27 13:34:30 +01:00
PJBot
fab5dd178d Automatic changelog update 2024-12-26 22:48:31 +00:00
ArtisticRoomba
bf727b0ab6 Reinforced tables require welding to construct/deconstruct (#33992) 2024-12-26 16:47:22 -06:00
Emisse
52d39aac46 bagel update (#34073) 2024-12-26 00:06:48 -07:00
Southbridge
4b34dd672e Amber Station - Fixed evac shuttle screens (#34071)
Added Devicenetwork component to ensure the screens work
2024-12-25 19:43:53 -07:00
TytosB
392046fc70 Loop Station update and fixes (#34067)
* many changes

* contentingregrationtests

* serialized invalid removed

* blank

* "Changes and fixes as suggested"

* blank

* blank

* added desk bells

* engi rework rework rework

* added gate to content integration

* tweaks

* aaa

* bbb

* added holopads

* ccc

* Update default.yml

* hotfix

* aaa

* bbb

* many many tweaks and fixes

* aaa

---------

Co-authored-by: Emisse <99158783+Emisse@users.noreply.github.com>
2024-12-25 12:16:58 -07:00
Emisse
7803254b6f bagel update (#34062)
* bagel update

* fixgridatmos

* fdsafds
2024-12-25 00:08:35 -07:00
War Pigeon
4064d554d6 Link Core cargo shuttle atmos devices (#34061)
* Link Core cargo shuttle atmos devices

* Remove configurator lines

This matches what the DeviceNetworks in core.yml look like now. Hopefully it works?
2024-12-24 23:21:39 -07:00
Ed
94186c4a6b Update twoHandedStaffs.yml 2024-12-25 09:04:43 +03:00
PJBot
c83532ec3f Automatic changelog update 2024-12-24 02:26:10 +00:00
lzk
1cbc8c1dcc Allow to paint multiple airlocks (#34001)
* Allow to paint multiple airlocks

* oh right
2024-12-24 03:25:03 +01:00
github-actions[bot]
31aec7385d Update Credits (#33998)
Co-authored-by: PJBot <pieterjan.briers+bot@gmail.com>
2024-12-24 03:15:26 +01:00
crazybrain23
4e9862d01f Add crazybrain23 to CODEOWNERS (#34038)
Add myself to CODEOWNERS

Basically just added myself where Nik was since I am also doing headmin things.
2024-12-24 03:14:42 +01:00
PJBot
8fcfca689f Automatic changelog update 2024-12-24 00:25:26 +00:00
Ed
1c33073af4 Multiple items in loadouts (#33193)
* loadouts update

* Update loadout_groups.yml

* darts to candles

* Update Resources/Prototypes/Loadouts/dummy_entities.yml

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
2024-12-24 01:24:19 +01:00
August Sun
39b2ce8cef Adds more air alarms and sensors throughout Oasis, linked unlinked air devices (#34046)
Adds more air alarms and sensors throughout Oasis

Co-authored-by: august-sun <45527070+august.sun@users.noreply.github.com>
2024-12-23 17:22:37 -07:00
Pieter-Jan Briers
285e9349b6 Fix race condition causing disconnected admins to appear in adminwho (#34033) 2024-12-24 11:18:31 +11:00
August Sun
2c4be6be00 Increases Marathon cryosleep size, added meteor shielding to Marathon chapelroid (#34044)
Increases Marathon cryosleep size, added meteor shielding to chapelroid

Co-authored-by: august-sun <45527070+august.sun@users.noreply.github.com>
2024-12-23 16:34:01 -07:00
PJBot
843a5de809 Automatic changelog update 2024-12-23 23:26:02 +00:00
Booblesnoot42
2dd99b5669 Removed protolathe from cargo on Amber (#34027) 2024-12-23 16:24:54 -07:00
Booblesnoot42
5d8e916cb2 Remove cog cargo protolathe (#34026)
* Removed protolathe from cargo on Amber

* Removed protolathe from cargo on Cog

* Revert "Removed protolathe from cargo on Amber"

This reverts commit 422db6e34a54c9256e3e1aad2098b64ff4cf0f96.

revert commit that should have been done on another branch
2024-12-23 16:24:47 -07:00
PJBot
030f97b2be Automatic changelog update 2024-12-23 19:55:25 +00:00
amatwiedle
b82605b185 Fix borgs being able to drink from buckets and spray bottles. (#32964)
* Added a check for if the entity trying to drink is a borg.

* Fixed missing namespace issue.

* Improved code conciseness.

* Removed borg chassis check, added stomach check.

* Removed unused namespace

---------

Co-authored-by: dankeaj <andrewjdanke@gmail.com>
2024-12-23 13:54:18 -06:00
Pieter-Jan Briers
f98192daff Fix the sensor monitoring console (#34035)
Still isn't really suitable to just map but at least it doesn't outright NRE anymore.

Alternative to #34032
2024-12-23 20:23:03 +01:00
Ed
661e96831f bruh 2024-12-23 22:13:38 +03:00
slarticodefast
dfc0e0199a minor fix to "silent footsteps for ninja" (#34040)
minor fix
2024-12-23 21:25:03 +03:00
PJBot
38bd2e5c1c Automatic changelog update 2024-12-23 14:25:20 +00:00
mubururu_
4ddd7d3c5f silent footsteps for ninja (#33280)
* waow

* nice suggestion

* nullable sound

* fix stuff

---------

Co-authored-by: Ed <96445749+TheShuEd@users.noreply.github.com>
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
2024-12-23 15:24:09 +01:00
slarticodefast
c873f90f6b Train: fix problematic atmos setup (#34018)
fix atmos setup
2024-12-22 13:41:35 -07:00
ScarKy0
f28c8127e2 Localized holopads for Box (#34011)
I love holopads
2024-12-22 12:56:30 -07:00
Pieter-Jan Briers
1450c4cade Specify privacy policy for Wizard's Den (#34013) 2024-12-22 17:12:37 +01:00
slarticodefast
2ff8238030 Merge stable into master (#34008) 2024-12-22 14:38:39 +01:00
Ed
4173d96d83 Merge remote-tracking branch 'upstream/staging' into ed-22-12-2024-upstream
# Conflicts:
#	Content.IntegrationTests/Tests/PostMapInitTest.cs
#	Content.IntegrationTests/Tests/ResearchTest.cs
#	Resources/Prototypes/Entities/Objects/Decoration/flora.yml
#	Resources/Prototypes/Entities/Objects/Misc/spaceshroom.yml
#	Resources/Prototypes/Maps/Pools/default.yml
2024-12-22 15:48:30 +03:00
Ed
6331379213 swap to RU 2024-12-22 15:45:16 +03:00
Errant
3358801b42 2024-12-20 Release "HoLoopad Holiday" (#34007) 2024-12-22 09:21:53 +01:00
Errant
58181c3412 adjust eshotgun recharge delay (#33996) 2024-12-22 09:02:55 +01:00
PJBot
1abe9db99c Automatic changelog update 2024-12-21 07:03:11 +00:00
Leon Friedrich
7baa1ae070 Update engine to v238.0.0 (#33980) 2024-12-21 18:02:04 +11:00
PJBot
b3551fb000 Automatic changelog update 2024-12-21 06:46:54 +00:00
Leon Friedrich
06e2bba8ab Toolshed refactor (#33598)
* Content changes for engine toolshed PR

* add contains command

* more permissive commands
2024-12-21 17:45:48 +11:00
metalgearsloth
b011dbb61e Update submodule to 237.4.0 (#33976) 2024-12-21 16:08:39 +11:00
metalgearsloth
9f4aa1ebe0 Implement some field-level deltas (#28242)
* Update GasTileOverlayState

* Update DecalGridState

* Update NavMapState

* poke

* poke2

* poke3

* Implement field deltas for guns

* Content done

* Update

---------

Co-authored-by: ElectroJr <leonsfriedrich@gmail.com>
2024-12-21 15:54:11 +11:00
PJBot
1f859167fd Automatic changelog update 2024-12-21 03:29:53 +00:00
JustinWinningham
12c5c7e91b Wood walls from barricades (#33902)
* Wood wall is now built from barricade congraph and on top of a barricade instead of using rods

* Fixed construction instructions for wooden wall

* Wood wall is now built from barricade congraph and on top of a barricade instead of using rods

* Fixed construction instructions for wooden wall

* fixed linter error

* Update Resources/Prototypes/Entities/Structures/Walls/walls.yml

Reasonable suggestion

Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com>

* Update Resources/Prototypes/Entities/Structures/Walls/walls.yml

spelling error

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* removed ability to build wall from 'junk' wood barrier'

* fixed ability to pry overlay barricades and not allow them to extend to full wood walls

* renamed incorrectly named entity

* fixed default entity graph so as to not complain for unit tests

* corrected my incorrect assumptions and fixed destroy cost

---------

Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com>
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
2024-12-21 04:28:46 +01:00
PJBot
00f12e092a Automatic changelog update 2024-12-21 02:15:15 +00:00
ScarKy0
03a54e90f5 Increase syndicate uplink discount amount to 6. (#33950)
* Increase uplink discounts from 3 to 7

* nevermind, 6
2024-12-20 20:14:08 -06:00
PJBot
9a4f9561e6 Automatic changelog update 2024-12-20 22:35:50 +00:00
pocl v
3a917bcb56 Diona chirping & Nymph vocals (#32511)
* Adds chirping to adult diona

* Added vocals for diona nymph

* Nymphs now have a speechsound
2024-12-20 23:34:44 +01:00
PJBot
50cc90fb41 Automatic changelog update 2024-12-20 22:16:46 +00:00
lzk
919fdc0798 Add description of tool qualities to entity (#32436)
* Add description of tool qualities to entity

* LMAO I FORGOT FUCKING FTL FILE

* minor cleanup

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
2024-12-20 23:15:40 +01:00
PJBot
bbceffac0e Automatic changelog update 2024-12-20 21:39:33 +00:00
AverageNotDoingAnythingEnjoyer
e4974cba25 Nanotrasen, Syndicate factions are now hostile to Dragons and Carps (#32515)
* Weh

Weh

* Now hostiles too!

Added Dragon to hostile factions for Hostiles

* Nah

Better not do this, I think
2024-12-20 22:38:27 +01:00
PJBot
a89d254425 Automatic changelog update 2024-12-20 21:28:04 +00:00
beck-thompson
a0a405768a Add clearer defib cooldowns! (#31251)
* First commit

* Fix silly test

* Swiched stuff up

* Update Content.Shared/Medical/DefibrillatorComponent.cs

* remove unneeded visuals

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
2024-12-20 22:26:56 +01:00
PJBot
0e850ab370 Automatic changelog update 2024-12-20 20:36:01 +00:00
CaptainMaru
5a07413ef8 All hostile turret (#33970)
* All hostile turret

* Other factions are now hostile against "all hostile" too
2024-12-20 23:34:53 +03:00
Errant
1419b8868e combine licence files for StationEvents audio (#33972)
* merge licence files

* actual commit

* whoops
2024-12-20 21:51:03 +03:00
PJBot
f19377d6cb Automatic changelog update 2024-12-20 16:18:20 +00:00
VideoKompany
4c0a1348bd Fix communication console menu (#33655)
fix Communication console
2024-12-20 10:17:13 -06:00
PJBot
f4fd64756f Automatic changelog update 2024-12-20 14:37:03 +00:00
Piras314
34b906640f Remove Clearly Nuclear on Author's Request (#33971)
Revert "New Nukie Song (#25765)"

This reverts commit 806c0d162f.
2024-12-20 15:35:54 +01:00
metalgearsloth
a2912e3922 Add MovementSound (#31313)
Mainly useful for medicalborg so you can get a looping sound and not footsteps playing over and over.

Didn't actually update medborg because footsteps need updating.

Not needed for AI.
2024-12-20 14:51:17 +03:00
IProduceWidgets
864c2257b0 add man-o-war shuttle (#32105)
manowar
2024-12-20 14:36:23 +03:00
chromiumboy
39600f9516 Minor fixes for the holopad (#33969)
Initial commit
2024-12-20 13:51:00 +03:00
github-actions[bot]
7f2907a93a Update Credits (#33865)
Co-authored-by: PJBot <pieterjan.briers+bot@gmail.com>
2024-12-19 22:51:28 +01:00
August Sun
0462993153 Fixes/removes borg spawnpoint from Oasis Engineering, added one to Robotics (#33960)
removed borg spawnpoint from engineering, added one to robotics

Co-authored-by: august-sun <45527070+august.sun@users.noreply.github.com>
2024-12-19 13:02:35 -07:00
ArtisticRoomba
ee72cdacdc Update Fland for holopads (#33962)
* update fland for holopads

* fix duplicate holopad name
2024-12-19 12:55:41 -07:00
TytosB
fe69ef63f0 Loopstation hotfix (#33958)
Co-authored-by: Emisse <99158783+Emisse@users.noreply.github.com>
2024-12-19 20:26:14 +01:00
PJBot
ae5c1f5995 Automatic changelog update 2024-12-19 17:22:37 +00:00
Plykiya
7f6d55a1b6 Fix: Update armor crate description (#33414)
Update armor crate
2024-12-19 18:21:27 +01:00
chromiumboy
209c1769ee Tweaks for the holopad (#33928)
* Initial commit

* AIs get a warning when trying to answer long distance calls

* Better handling of ending telephone calls

* Fixed issue with duplicated holopad window when an AI answers a summons

* Changed how ranges are handled, added the bluespace holopad

* Bug fixes

* More bug fixes

* More bug fixes

* Update Resources/Prototypes/Entities/Structures/Machines/holopad.yml

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Update Resources/Prototypes/Entities/Structures/Machines/holopad.yml

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
2024-12-19 18:20:20 +01:00
LevitatingTree
25980d8888 Remove plushie_lizard_mirrored.png (#33855)
* Remove plushie_lizard_mirrored.png

* Remove from meta.json

* Replace mirrored state from yml

---------

Co-authored-by: LevitatingTree <None>
2024-12-19 17:44:48 +01:00
PJBot
efa76be390 Automatic changelog update 2024-12-19 11:32:19 +00:00
Centronias
128721ee4e Logic Gate Compatibility with Non-Logic Signals bugfix (#33792)
:)
2024-12-19 12:31:13 +01:00
SpaceLizard
ef45c16667 Food Container Size Increase (#33842)
* Stuff

* hehe

* moar.
2024-12-19 13:15:48 +03:00
PJBot
2581c24bfe Automatic changelog update 2024-12-19 09:39:31 +00:00
TytosB
043510fb51 New mid pop station: Loop (#33697)
* many changes

* contentingregrationtests

* serialized invalid removed

* blank

* "Changes and fixes as suggested"

* blank

* blank

* added desk bells

* engi rework rework rework

* added gate to content integration

* tweaks

* aaa

* bbb

* added holopads

* ccc

* Update default.yml

---------

Co-authored-by: Emisse <99158783+Emisse@users.noreply.github.com>
2024-12-19 02:38:22 -07:00
ArtisticRoomba
66ea113eda Omega Power Rebalance (#33956)
* fix packed power

* Revert "fix packed power"

This reverts commit 4f44d0673e0a597bea39c594f5b7ace3069433ea.

* fic the entire thing again
2024-12-18 22:13:01 -07:00
ArtisticRoomba
c1b229aea5 Packed Power Rebalance + Gas Sensors Adjustments (#33955)
* fix packed power

* fix that

* fix that as well

* even more fixes

* fix power, again
2024-12-18 20:48:14 -07:00
ArtisticRoomba
28fa7cedc7 Meta Power Rebalance + Gas Pipe Sensors, Holopads (#33949)
power fixes, sensors, dim lights
2024-12-18 18:05:06 -07:00
Southbridge
943be3e75c Amber Statio - Localized Holopads and Balance Updates (#33948)
* Added loc versions of holopads to Amber, and made some adjustments given Acorn's feedback

* fixed the name of the gameroom

* Fixed it in the map file
2024-12-18 17:52:46 -07:00
Spanky
e7d5ab67ec Omega Update (Localized Holopads) (#33946)
* Omega Update (Localized Holopads)

Replaced all holopads with localized versions and a couple tiny misc

* Remove engi protolathe

* Forgot to rename engi fax whoops
2024-12-18 17:52:35 -07:00
PJBot
e70a3b8a21 Automatic changelog update 2024-12-19 00:47:43 +00:00
ArtisticRoomba
9de569d973 Show battery level for selected devices in Power Monitoring Console (#33854)
* Use class instead of out variables

* Show battery level in power monitoring console

* Better color contrast for battery level + localized string

* Add visualization to battery percentage

* Reverts random ChatSystem.cs whitespace change

* Address review

* Show BatteryLevel stats in child view when selecting devices

---------

Co-authored-by: Crotalus <crotalus@users.noreply.github.com>
2024-12-19 01:46:36 +01:00
Winkarst
f7bf694707 Comment LogTypes (#33497)
* Comment LogTypes

* Uncomment unused types

---------

Co-authored-by: Winkarst <74284083+Winkarst-cpu@users.noreply.github.co>
2024-12-19 01:18:04 +01:00
PJBot
383ecdd70f Automatic changelog update 2024-12-19 00:13:07 +00:00
Hannah Giovanna Dawson
c33d3350bd [Christmas] Y'all want a Smite Cranberry? (#33922)
* Add a festive lemon-lime soda variant: cranberry!

* Gave lemon-lime a brand name

* Make the CrateFoodSoftdrinksLarge slightly larger to accomodate the extra drinks.

* Extend the Christmas anomaly with extra jolliness

* Minor spelling mistake. Jollyness will not be denied.

* Removed redundant delay from meta file
2024-12-19 01:11:59 +01:00
Spanky
8f36d7d1c8 Reach/Cargo Update (Holopads & Atmos) (#33943)
* Reach/Cargo Update

Adds holopads and new atmos tech to Reach, and replaces cargo shuttle/ATS holopads with localized versions.

* Fix Invalid

invalidinvalidinvalidinvalidinvalidinvalid
2024-12-18 16:29:21 -07:00
ScarKy0
fa6de41ae9 Localized holopads + atmos network for Oasis (#33941)
Oasis stuff
2024-12-18 16:10:53 -07:00
Spanky
6f42ebf206 Packed Update (Holopads & Engi Stuff) (#33940)
Packed Holopad & Engi Update

Added holopads, atmos network monitor and sensors, advanced SMES, and revamped TEG setup.
2024-12-18 15:42:01 -07:00
ScarKy0
18de5ea986 Localized holopads for Bagel (#33934)
* Stuff

* Requested changes
2024-12-18 14:45:12 -07:00
ArtisticRoomba
52117fdc13 Marathon Power Rebalance + Gas Pipe Sensors, Holopads (#33938)
* fix marathon power

* add holopads

* add requested changes
2024-12-18 14:28:46 -07:00
ScarKy0
8a0edad886 Localized holopads for Cog (#33937)
* coggers

* Requested changes
2024-12-18 13:54:09 -07:00
PJBot
4fe69f2383 Automatic changelog update 2024-12-18 16:33:03 +00:00
ArtisticRoomba
345adcd5d0 New Drazil plushie (inverse lizard plushie) (#33776)
* Hew

* properly attribute hew.ogg

* add to maints locker plushie pool with low chance, clear up grammar

* shhhh nobody saw that linter failure

* adds localization support for Weh and Hew emotes

* fix capitalization error present since circa 2/25/2024

* resolve conflicts, fix sprite, add reversed inhands

* clear up cursed formatting
2024-12-18 17:31:55 +01:00
Ed
18fe8b9df0 Sprite Movement working with AI movement (#33494)
* FINALLY

* Update animals.yml
2024-12-18 17:15:34 +01:00
PJBot
b649517a17 Automatic changelog update 2024-12-18 15:14:46 +00:00
RedBookcase
c1558f689f Mercenary gear contraband tweaks. (#33647)
* Mercenary gear contraband tweaks.

* Fixed Mercenary Combat Gloves to have basic Combat Gloves as a parent again.

* Update Resources/Prototypes/Entities/Clothing/OuterClothing/vests.yml

---------

Co-authored-by: RedBookcase <Usualmoves@gmail.com>
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
2024-12-18 16:13:40 +01:00
PJBot
97a2e0deef Automatic changelog update 2024-12-18 15:06:22 +00:00
SlamBamActionman
659bc8f2de Replace Cellular Slime mob damage with Caustic (#33104)
Cellular gone
2024-12-18 16:05:15 +01:00
Nim
868699a219 More beer, wine and ale (#686)
* more beer

* ru

* comoss fix update, loc change to eng

* Update dwarf.yml

---------

Co-authored-by: Ed <edwardxperia2000@gmail.com>
2024-12-18 17:37:06 +03:00
PJBot
d01839a990 Automatic changelog update 2024-12-18 14:28:05 +00:00
MilenVolf
8359541706 Fix hugging buckled mobs instead of unbuckling (#33635)
* Check buckle.BuckledTo value before hugging interaction

* Make InteractHandEvent to be used by BuckleSystem before InteractionPopupSystem instead of after
2024-12-18 15:26:58 +01:00
PJBot
337ef6c5aa Automatic changelog update 2024-12-18 13:16:13 +00:00
slarticodefast
e7294bdf4f Only disable panicbunker for admins with AdminFlags.Admin (#33879)
* Only disable panicbunker for admins with AdminFlags.Admin

* nicer curly braces
2024-12-18 14:15:04 +01:00
Centronias
6b99493e80 Reduce network burden of the hunger system (#32986)
* reduce network burden of the hunger system

* explicit start + last updated

* remove auto reformat changes to otherwise untouched code

add clamp helper

* imagine making breaking changes, documenting them, and then not thinking to check the yaml

* comments

* Remove unused net manager in hunger system
Remove lastAuthoritativeHungerValue from prototypes
2024-12-18 14:06:02 +01:00
ScarKy0
87f39af1cf Holopad prototypes for mapping (#33931)
* Init

* fix

* Atmosn't

* ID fixes

* locale
2024-12-18 12:38:00 +01:00
PJBot
94594debf3 Automatic changelog update 2024-12-18 11:27:28 +00:00
lzk
6c925d2c82 Make safes craftable (#32694)
* Made the Armory Gun Safe craftable with 10 steel, 10 plasteel, and 5 LV cables.

* Changed gun safe price to 335, to match the cost of its material components. Changed gun safe to start with no accesses when constructed.

* adress the review

* yeah

* wrah

* test fail is not real

---------

Co-authored-by: Ty Ashley <42426760+TyAshley@users.noreply.github.com>
2024-12-18 12:26:19 +01:00
ArtisticRoomba
1c0db473bc Fland Power Rebalance + Gas Pipe Sensors (#33933)
fix fland power
2024-12-18 04:09:50 -07:00
ArtisticRoomba
9f0a8aac7d Cog Power Rebalance + Holopads, Gas Pipe Sensors (#33930)
* fix cog power

* double fix cog power

* trial 3

* fourth go

* i stopped counting
2024-12-18 02:52:21 -07:00
Spanky
50fddd0804 Cargo Shuttle/ATS Update (#33927)
Update Cargo Shuttle/ATS

Adds holopads to the cargo shuttle and ATS. Also replaces the blast door buttons on the cargo shuttle with locked variants.
2024-12-18 01:37:56 -07:00
ArtisticRoomba
42f7279f52 Box Power Rebalance + Holopads, Gas Pipe Sensors (#33929)
* fix power

* Rebalance power, add holopads, add pipenet sensors

* recolor that one pipe I missed + remove invalids

* resave map, if this fails tests one more time, no more cake
2024-12-18 01:17:48 -07:00
Spanky
8b0b822207 Omega Update (Holopads & Engi Stuff) (#33926)
Omega Update

Add holopads, atmospheric network monitors & sensors, and advanced SMES's.
2024-12-17 22:55:09 -07:00
ArtisticRoomba
91b85be1a4 Bagel Power Rebalance + Gas Pipe Sensors (#33925)
* Balances bagel power

* Adds gas pipe sensors

* remove invalids :)
2024-12-17 21:45:50 -07:00
Southbridge
122e307694 Amber Station - Added Holopads, Atmos Monitoring, and Advanced SMESes (#33923)
* Added holopads and atmos network monitoring.

* Added the advanced SMESes to the station and evac shuttle

* Removed an accidentally mapped vox air alarm

* Fixed invalids in the escape shuttle
2024-12-17 21:44:29 -07:00
PJBot
ecc2edea6d Automatic changelog update 2024-12-18 00:13:41 +00:00
slarticodefast
908e476643 Fix admins not being able to health scan slimes (#33884) 2024-12-18 01:12:35 +01:00
Tiniest Shark
aaec1e684e Ground Light Post Crafting Description Fix (#33920)
Updates ground light post's crafting description
2024-12-18 01:03:45 +01:00
PJBot
5863cfc78a Automatic changelog update 2024-12-18 00:00:00 +00:00
ArtisticRoomba
e7330ece9c Adds Advanced SMES, an SMES with higher capacity for mapping (#33757)
* Adds Advanced SMES machine and board to autolathe roundstart

* Make Advanced SMES T2 Advanced Powercells research, reduce cost, remove from random spawner, add sprites by augustsun

* fix attribution formatting

* Update smes.yml to address review

Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com>

* add new sprites and change naming scheme, testing something

* address review, tested it a bit more, works ingame

---------

Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com>
2024-12-18 00:58:53 +01:00
PJBot
27cb17f865 Automatic changelog update 2024-12-17 23:57:11 +00:00
Golinth
a9cf54aca8 Fix AME power generation (#32825)
* Change AME power generation

* Fix negative power, change formula slightly
2024-12-18 00:56:02 +01:00
slarticodefast
984b29082d Update PR size labeler line counts (#33915)
new numbers
2024-12-18 00:40:49 +01:00
ScarKy0
a55d26eb8b Holopads + Atmos Network Console for Bagel (#33921)
Holopads!
2024-12-17 16:17:37 -07:00
Ed
8fbaffe2e7 Gate map: Holopads added (#33918)
Update gate.yml
2024-12-17 14:37:19 -07:00
Myra
77a4cda8bc Master merge: Fix horrible lag in Zombies mode (#33818) (#33917) 2024-12-17 20:19:31 +00:00
psykana
59e955a559 Fix horrible lag in Zombies mode (#33818) 2024-12-17 21:16:05 +01:00
Saphire
3fe576b4c9 Merge main and stable back together 2024-12-18 01:59:46 +06:00
Myra
fb6e85e87e Test can now run on stable prs (#33914)
Make tests also run on stable and staging
2024-12-17 20:40:57 +01:00
PJBot
616ddc1776 Automatic changelog update 2024-12-17 19:19:23 +00:00
chromiumboy
7780b867ac Holopads (#32711)
* Initial resources commit

* Initial code commit

* Added additional resources

* Continuing to build holopad and telephone systems

* Added hologram shader

* Added hologram system and entity

* Holo calls now have a hologram of the user appear on them

* Initial implementation of holopads transmitting nearby chatter

* Added support for linking across multiple telephones/holopads/entities

* Fixed a bunch of bugs

* Tried simplifying holopad entity dependence, added support for mid-call user switching

* Replaced PVS expansion with manually networked sprite states

* Adjusted volume of ring tone

* Added machine board

* Minor features and tweaks

* Resolving merge conflict

* Recommit audio attributions

* Telephone chat adjustments

* Added support for AI interactions with holopads

* Building the holopad UI

* Holopad UI finished

* Further UI tweaks

* Station AI can hear local chatter when being projected from a holopad

* Minor bug fixes

* Added wire panels to holopads

* Basic broadcasting

* Start of emergency broadcasting code

* Fixing issues with broadcasting

* More work on emergency broadcasting

* Updated holopad visuals

* Added cooldown text to emergency broadcast and control lock out screen

* Code clean up

* Fixed issue with timing

* Broadcasting now requires command access

* Fixed some bugs

* Added multiple holopad prototypes with different ranges

* The AI no longer requires power to interact with holopads

* Fixed some additional issues

* Addressing more issues

* Added emote support for holograms

* Changed the broadcast lockout durations to their proper values

* Added AI vision wire to holopads

* Bug fixes

* AI vision and interaction wires can be added to the same wire panel

* Fixed error

* More bug fixes

* Fixed test fail

* Embellished the emergency call lock out window

* Holopads play borg sounds when speaking

* Borg and AI names are listed as the caller ID on the holopad

* Borg chassis can now be seen on holopad holograms

* Holopad returns to a machine frame when badly damaged

* Clarified some text

* Fix merge conflict

* Fixed merge conflict

* Fixing merge conflict

* Fixing merge conflict

* Fixing merge conflict

* Offset menu on open

* AI can alt click on holopads to activate the projector

* Bug fixes for intellicard interactions

* Fixed speech issue with intellicards

* The UI automatically opens for the AI when it alt-clicks on the holopad

* Simplified shader math

* Telephones will auto hang up 60 seconds after the last person on a call stops speaking

* Added better support for AI requests when multiple AI cores are on the station

* The call controls pop up for the AI when they accept a summons from a holopad

* Compatibility mode fix for the hologram shader

* Further shader fixes for compatibility mode

* File clean up

* More cleaning up

* Removed access requirements from quantum holopads so they can used by nukies

* The title of the holopad window now reflects the name of the device

* Linked telephones will lose their connection if both move out of range of each other
2024-12-17 20:18:15 +01:00
Errant
bbf5369f14 Core - remove vox box (#33911)
remove Core vox box
2024-12-17 20:08:22 +01:00
Errant
332f870304 Oasis - remove vox box (#33912)
remove oasis vox box
2024-12-17 20:07:27 +01:00
slarticodefast
0fc2cca10c HOTFIX: Add [MRP] tag to the hostname for Salamander (#33909) 2024-12-17 14:37:53 +01:00
PJBot
ab8447956c Automatic changelog update 2024-12-17 13:36:36 +00:00
Tiniest Shark
32164c2ab8 Anomaly Scanner In-hand Sprites (#33427)
* Adds in-hand sprites to the Anomaly Scanner.

* Revert "Adds in-hand sprites to the Anomaly Scanner."

This reverts commit 257efd032a15d6459043f47106bd537abfe18fad.

im very stupid and need to undo my dumb commit.

* okay actually making sure these are committed this time like a smart boi

* Better version of the sprites based off of /tg station's health analyzer.

* Updated copyright to include link to sprite

* Updated copyright license and commit link

* Update Resources/Textures/Objects/Specific/Research/anomalyscanner.rsi/meta.json

Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com>

* Update Resources/Textures/Objects/Specific/Research/anomalyscanner.rsi/meta.json

Aeshus adjusted indentation to better match original file.

Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com>

---------

Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com>
2024-12-17 14:35:23 +01:00
PJBot
0d31b8c37a Automatic changelog update 2024-12-17 11:57:55 +00:00
Patrik Caes-Sayrs
8f2d16aabf Zombies keep their anomalies on zombification (#33867)
* Zombies keep their anomalies on zombification

* Refactor anombies to isolate anomalies and zombies

InnerBodyAnomalies now send an event when the host dies.
Zombies cancels this event if the host is turning into a zombie.

* Anomazombies: deprecate CancellableEntityEventArgs

CancellableEntityEventArgs is deprecated. Use structs
with bool Cancelled instead.
2024-12-17 14:56:47 +03:00
PJBot
67e5cc2104 Automatic changelog update 2024-12-17 10:07:40 +00:00
Ed
a77fcdec76 Gate map (#32032)
* import

* remove perma asteroid

* remove cyrillic

* ok

* Remove Chromite island, Move AI, add cameras

* remove mapped garbage

* add station anchors

* admeme teleporter

* remove wapr points, add nav beacons

* telecomm, camera servers, some atmos fix

* crew server

* remove white plating, fix MANY pipestacking

* playtest bugs fixing

* big update

* bunch minor fixes

* Update gate.yml

* out of rotation
2024-12-17 13:06:33 +03:00
Southbridge
d90f6ce086 Amber station updates (#33899)
* Fixed various issued identified during playtests.

* Fixed a firelock stuck closed

* Added more cameras and moved others

* Fixed an issue with disposals

* Modified the map a bit after watching some matches and listening to feedback

* Reworked sec some more. Moved perma out into its own separate ship (another design from Frontier) Also performed various improvements to the station.

* Added final touches, ready to PR

* Added some more loot rooms throughout the map

* Changed up some areas in maints that I didn't like

* Removed footprints outside detective's room and wrenched down the logic gates in the ship building airlock

* I totally didn't forget to add the lights
2024-12-16 23:43:55 -07:00
PJBot
038ba39b97 Automatic changelog update 2024-12-17 03:54:23 +00:00
chromiumboy
27e59d35fb Atmospheric network monitor (#32294)
* Updated to latest master version

* Added gas pipe analyzer

* Completed prototype

* Playing with UI display

* Refinement of the main UI

* Renamed gas pipe analyzer to gas pipe sensor

* Added focus network highlighting and map icons for gas pipe sensors

* Added construction graph for gas pipe sensor

* Improved efficiency of atmos pipe and focus pipe network data storage

* Added gas pipe sensor variants

* Fixed gas pipe sensor nav map icon not highlighting on focus

* Rendered pipe lines now get merged together

* Set up appearance handling for the gas pipe sensor, but setting the layers is bugged

* Gas pipe sensor lights turn off when the device is unpowered

* Renamed console

* The gas pipe sensor is now a pipe. Redistributed components between it and its assembly

* AtmosMonitors can now optionally monitor their internal pipe network instead of the surrounding atmosphere

* Massive code clean up

* Added delta states to handle pipe net updates, fixed entity deletion handling

* Nav map blip data has been replaced with prototypes

* Nav map blip fixes

* Nav map colors are now set by the console component

* Made the nav map more responsive to changes in focus

* Updated nav map icons

* Reverted unnecessary namespace changes

* Code tidy up

* Updated sprites and construction graph for gas pipe sensor

* Updated localization files

* Misc bug fixes

* Added missing comment

* Fixed issue with the circuit board for the monitor

* Embellished the background of the console network entries

* Updated console to account for PR #32273

* Removed gas pipe sensor

* Fixing merge conflict

* Update

* Addressing reviews part 1

* Addressing review part 2

* Addressing reviews part 3

* Removed unnecessary references

* Side panel values will be grayed out if there is no gas present in the pipe network

* Declaring colors at the start of some files

* Added a colored stripe to the side of the atmos network entries

* Fixed an issue with pipe sensor blip coloration

* Fixed delay that occurs when toggling gas sensors on/off
2024-12-17 04:53:17 +01:00
PJBot
f4765260cb Automatic changelog update 2024-12-16 19:24:38 +00:00
Ed
36c676741f Christmas anomaly (#33889)
* santa anomaly

* Update anomaly.yml

* injection

* Update anomaly.yml

* Update Resources/Locale/en-US/anomaly/inner_anomaly.ftl

Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com>

* Update Resources/Textures/Structures/Specific/Anomalies/Cores/santa_core.rsi/meta.json

Co-authored-by: Errant <35878406+Errant-4@users.noreply.github.com>

* Update Resources/Textures/Structures/Specific/Anomalies/santa_anom.rsi/meta.json

Co-authored-by: Errant <35878406+Errant-4@users.noreply.github.com>

---------

Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com>
Co-authored-by: Errant <35878406+Errant-4@users.noreply.github.com>
2024-12-16 22:23:31 +03:00
Ed
af7e552d3c Flora clean up (#33839)
* first migrate

* clean up prototypes

* Update polymorph.yml

* Update flora.yml

* and this one

* and this one x2

* and this one x3

* Update migration.yml
2024-12-16 20:20:36 +01:00
PJBot
9eda08cd12 Automatic changelog update 2024-12-16 18:53:16 +00:00
beck-thompson
74e9576e66 Figures can now be activated remotely (#32769)
* First commit

* I'm silly

* weh

* will this work?

* Better design

* Fixes!

* rider :(

* L rider
2024-12-16 19:52:09 +01:00
PJBot
001b0edc7e Automatic changelog update 2024-12-16 17:54:45 +00:00
goet
db69ae67fe Spaceshroom grilling (#31872)
* make spaceshroom cookable on grill

* remove microwave recipe
2024-12-16 18:53:38 +01:00
Intoxicating-Innocence
2ccd471388 Chem master UI (#33328)
* chemmaster buffer has colors now

* I have saved chemists everywhere

* implimented panelcontainers instead of labels, slight visual rework

* added UI changes to input buffer

* fixed some unsightly indentation on brackets and removed redundant minheight specification from verticalstretch elements

* Formatting and code cleanup

* pills still not rendering correctly

* more tinkering, entities finally display correctly

* entities display correctly, pill fields default to max now

* fixed stripes

* fixed excess pillCount bug

* removed cache, fixed tab swapping

---------

Co-authored-by: Saphire <lattice@saphi.re>
2024-12-16 18:17:06 +01:00
PJBot
74f873a9f7 Automatic changelog update 2024-12-16 16:28:47 +00:00
Vexerot
17e3ef32b7 Add Explosion Resistance to SecBelts (#33253)
Added explosion resistance to secbelt
2024-12-16 17:27:40 +01:00
PJBot
c35505c6b4 Automatic changelog update 2024-12-16 15:34:39 +00:00
SlamBamActionman
95328dab68 Add Holy damage (#32755)
* Initial commit

* hoili moili

* now to add sherlock and doctor who

* funny stick

* Oops it was meant to be called metaphysical

* Attribution

* Even BETTER attribution
2024-12-16 16:33:32 +01:00
PJBot
046dde7717 Automatic changelog update 2024-12-16 15:26:13 +00:00
dragonryan06
1e80dd2891 Add the Zombie, a new cocktail (#32802) 2024-12-16 16:25:06 +01:00
PJBot
782a2978f0 Automatic changelog update 2024-12-16 14:20:21 +00:00
deathride58
d8afcdcdf0 Makes admins not count towards the playercount cap (#33424)
* Makes admins not count towards the playercount cap

* Update Content.Shared/CCVar/CCVars.Admin.cs (thx Aeshus

Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com>

* Actually fixes whitespace on the comments
Thanks VScode very good IDE

---------

Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com>
2024-12-16 17:19:15 +03:00
PJBot
1368092d43 Automatic changelog update 2024-12-16 14:15:57 +00:00
KieueCaprie
881e4d3432 Add an in-hand sprite for the lizard plushie (#32583)
* add hold sprites for lizard plushie

* make the lizard plushie sprites slightly chonkier for those who are not wearing winter clothes.

* me when i hit the noise button and pretend it's shading.

* lizard plushie is not legally-distinct green dinosaur with a long tongue™ (front sprite tongue has been shortened)

* update meta.json
2024-12-16 17:14:51 +03:00
PJBot
2a6800f354 Automatic changelog update 2024-12-16 14:10:28 +00:00
Preston Smith
01c1d8f824 Prevent pulling when teleporting (#33252)
* No more teleporting pulling

* pulled dash

* Update Content.Shared/Ninja/Systems/DashAbilitySystem.cs

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Update Content.Server/Implants/SubdermalImplantSystem.cs

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
2024-12-16 17:09:17 +03:00
PJBot
852b3e9bb6 Automatic changelog update 2024-12-16 12:54:28 +00:00
Baa
1f42413416 Fix udder wooly reagent creation V2 (#32905)
* Changed comments to be more clear and uniform.
EggLayer uses NextGrowth instead of frame accumulation.
Egglayer uses much less energy to make eggs, and lay time is randomized for player and AI chicken.

* UdderComponent ReagentId can be changed now
UdderSystem and WoolySystem use SharedSolutionContainerSystem now

* Entities with udders can be examined to see a rough hunger level
udders and wooly stop reagent generation/extra nutrient usage once the solution container is full

* Moved stuff to Shared
AutoPausedField now

* Cleanup moving stuff to Shared

* Oops. Make UdderSystem sealed instead of abstract.

* Switch PopupEntity for PopupClient

* Didn't mean to delete Access

* new() instead of default! prototype
revert egglayer balance change
NextGrowth += timespan   in egglayer

* forgot [Datafield] for NextGrowth

* forgot NetworkedComponent again...

* Renaming Shared Animal to Shared Animals to match Server
Hopefully also resolve merge conflicts.

* Fix incorrect filename

* Update with requested changes
Put UdderSystem dependencies in alphabetical order.
Initialise NextGrowth for Udder and Wooly components on MapInitEvent.
Clean-up EggLayerSystem a little.
Re-write OnExamine function for UdderSystem, improving clarity.
Add full stops to end of udder examine locales.
And more :)

* Add some additional descriptions for cow hunger levels.

* Add Udder and Wooly quantity to AutoNetworkedField

* Account for less than starving threshold.

---------

Co-authored-by: sirionaut <sirionaut@gmail.com>
Co-authored-by: Sirionaut <148076704+Sirionaut@users.noreply.github.com>
Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
2024-12-16 13:53:21 +01:00
PJBot
d5323332a6 Automatic changelog update 2024-12-16 12:34:40 +00:00
Tayrtahn
cf738857fe Add a test to check that lathe recipes are possible (#33868)
* Add a test to check that all lathes accept the materials for all their recipesy

* Add check for storage limit

* Track total recipe material volume

* Check dynamic and emag recipes too

* Move AllLatheRecipesValidTest from ResearchTest to LatheTest

* Extremely minor modernization
2024-12-16 13:34:02 +01:00
beck-thompson
196782774b Add generator scrap (Plasma / uranium scrap) (#32198)
* First commit

* Forgot the shading!

* tweaked  values

* sprite update

* Radiation
2024-12-16 13:33:34 +01:00
metalgearsloth
386e431ea7 LightOnCollide entityquery (#33886) 2024-12-16 13:24:00 +01:00
deltanedas
2635888b6a add SpawnTableOnUse (#32620)
* add SpawnTableOnUse

* make BaseEmitSound more flexible and remove sound from spawntable

* add log

* :trollface:

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
2024-12-16 15:23:14 +03:00
ActiveMammmoth
cd23805750 Wizard Mind Swap Spell (#33416)
* working mind swap spell

* Removing unncessary spacing

Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com>

* Changing mind swap speech

Co-authored-by: keronshb <54602815+keronshb@users.noreply.github.com>

* All requested changes in review

* Stores owned by mind instead of body

* Requested changes, traitor uplink fixed

* Revert "Requested changes, traitor uplink fixed"

This reverts commit 2ceac6733d6a28890f60d2ccef3dafa160a702fd.

* Revert "Stores owned by mind instead of body"

This reverts commit dfb72ab70ed66db50312617f2dce02d0a4e4dfce.

* Separate target and performer stun duration

---------

Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com>
Co-authored-by: keronshb <54602815+keronshb@users.noreply.github.com>
2024-12-16 15:12:45 +03:00
PJBot
612f8bedab Automatic changelog update 2024-12-16 12:09:14 +00:00
Plykiya
a4d6f09a4f Cluster grenade refactor and contra markings (#31108)
* Cluster grenade refactor

* oopsies on the name

* Solve client-side errors

* reviews addressed

* filling scattering grenades is now predicted

* reviews addressed
2024-12-16 13:08:07 +01:00
TGRCDev
1266b05b02 Bug fixes for Store UIs with multiple currencies (#33565)
Fixed stores with multiple currencies having bad formatting and non-functional withdraw screens
2024-12-16 14:57:11 +03:00
PJBot
51a45ae640 Automatic changelog update 2024-12-16 11:54:25 +00:00
PJBot
e0a1db6e45 Automatic changelog update 2024-12-16 11:53:18 +00:00
psykana
5e8db16660 Zombies can see Initial Infected (#33665)
* Zombies can see Initial Infected

* Update zombie character info text
2024-12-16 14:53:13 +03:00
Litraxx
46d288cc39 Rename Dungeon Master Laws to not run into copyright problems (#33678)
* Rename Dungeon Master Laws to not run into copyright problems

* Revert direct map changes

* Added renaming of DungeonMasterCircuitBoard to migration.yml

* Remove whitespace changes to oasis.yml

---------

Co-authored-by: Litrax <email@emal.com>
2024-12-16 14:52:03 +03:00
Nim
a248c176ae Crane barrel (#672)
* crane barrel

* fix

* sprite resize, file rename

---------

Co-authored-by: Ed <96445749+TheShuEd@users.noreply.github.com>
2024-12-16 11:43:29 +03:00
Ed
862df73ff2 Demiplane modifiers groups & tiers (#678)
* data setup

* demiplanes modficators combine refactor

* generationProb

* demiplane tiers setup

* migration, and t2 loots

* t2 balance tweaks

* retags

* weather modifiers group

* maplight modifiers

* more passed checks

* wanderer buy positions localization fix

* fixes
2024-12-16 00:38:29 +03:00
Tayrtahn
5958801182 Separate RGlass recipe for autolathe and ore processor (#33876) 2024-12-15 22:02:32 +01:00
A.Ne.
57a795261f mithril and lucens modular parts (#682)
Co-authored-by: Ed <edwardxperia2000@gmail.com>
2024-12-15 22:40:05 +03:00
Ed
e102b5011e Merge remote-tracking branch 'origin/map-upate' 2024-12-15 22:17:29 +03:00
A.Ne.
f655f74b03 mithril and lucens (#660)
* mithril and manarium

* Rename manarium to Lucens

* pointlight to tree

* lucens tile

* Update trees.yml

* logs sprite

* Update trees.yml

* delete acacia tiles, recolor lucen example

* tiles new palette

* Update ores.yml

Co-authored-by: Ed <96445749+TheShuEd@users.noreply.github.com>

* tiles update

* Update tiles.ftl

---------

Co-authored-by: Ed <96445749+TheShuEd@users.noreply.github.com>
2024-12-15 12:53:31 +03:00
PJBot
102d4fbc95 Automatic changelog update 2024-12-14 16:04:27 +00:00
Nim
df7b9d1e04 Other colour of the binary channel (#33841)
* radio

* color 2

* console-announcement

* 5ed7aa
2024-12-14 17:03:18 +01:00
Southbridge
7d82d2d5da Amber station updates (#33845)
* Fixed various issued identified during playtests.

* Fixed a firelock stuck closed

* Added more cameras and moved others

* Fixed an issue with disposals

* Modified the map a bit after watching some matches and listening to feedback

* Reworked sec some more. Moved perma out into its own separate ship (another design from Frontier) Also performed various improvements to the station.

* Added final touches, ready to PR
2024-12-14 16:59:43 +01:00
Errant
a3fc690236 Cherry-pick to stable: Amber Station - Playtest Fixes (#33773) (#33811)
Amber Station - Playtest Fixes (#33773)

* Fixed various issued identified during playtests.

* Fixed a firelock stuck closed

* Added more cameras and moved others

* Fixed an issue with disposals

Co-authored-by: Southbridge <7013162+southbridge-fur@users.noreply.github.com>
2024-12-14 16:40:21 +01:00
PJBot
744b105fc6 Automatic changelog update 2024-12-13 23:01:52 +00:00
godisdeadLOL
06071a5d8a Secret stash wrench anchoring fix (#31779)
* secret stash wrench fix

* fix

* cleanup

---------

Co-authored-by: YourUsername <you@example.com>
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
2024-12-14 00:00:45 +01:00
PJBot
2c00abbcae Automatic changelog update 2024-12-13 14:25:41 +00:00
Southbridge
7eb714d38f Monospace Support for Rich Text (#33830)
* Initial Commit

* Moved all this to SS14 on it's own

* Added prototype validation
2024-12-13 15:24:34 +01:00
PJBot
e704f4e9a8 Automatic changelog update 2024-12-13 13:55:04 +00:00
LevitatingTree
b46f487503 Add meat tag to Five Alarm Burger (#33848)
* Add meat tag to Five Alarm Burger

* Revert "Add meat tag to Five Alarm Burger"

This reverts commit e483b5effe63a8cbdcce81eeddc622f5555ae240.

* Re-add tag, but in notepad

* Move tag down to follow hierarchy

---------

Co-authored-by: LevitatingTree <None>
2024-12-13 14:53:56 +01:00
PJBot
9329fcf32e Automatic changelog update 2024-12-13 03:11:29 +00:00
lzk
115b3e0519 Increase war ops evac time (#33628) 2024-12-12 21:10:20 -06:00
onesch
9d7846ed72 Safari hat In-hand Sprites (#33464)
* adds in-hand sprites to the safari hat.

* Update copyright wording

* visual fix

* Resprite in-hand sprites.

* linting meta.json
2024-12-12 18:09:43 +01:00
lzk
18322ec76f fix ghost command error string (#33838) 2024-12-12 11:18:53 -05:00
PJBot
b959a64f2c Automatic changelog update 2024-12-12 14:25:41 +00:00
Winkarst
48f62da2dc Update APE guidebook to contain Sigma particles, Transformation and colors for effects (#33558)
* Update APE guidebook

* Lang error

* Update Resources/ServerInfo/Guidebook/Science/APE.xml

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Update Resources/ServerInfo/Guidebook/Science/APE.xml

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Update Resources/ServerInfo/Guidebook/Science/APE.xml

Co-authored-by: chromiumboy <50505512+chromiumboy@users.noreply.github.com>

* Update Resources/ServerInfo/Guidebook/Science/APE.xml

Co-authored-by: chromiumboy <50505512+chromiumboy@users.noreply.github.com>

---------

Co-authored-by: Winkarst <74284083+Winkarst-cpu@users.noreply.github.co>
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Co-authored-by: chromiumboy <50505512+chromiumboy@users.noreply.github.com>
2024-12-12 15:24:34 +01:00
onesch
842bbeb85f Warden headdresses In-hand Sprites (#33521)
* Adds in-hand sprites to the warden beret.

* Adds in-hand sprites to the warden cap.

* resprite in-hand sprites to the warden cap.
2024-12-12 02:44:48 +01:00
PJBot
67d444feb0 Automatic changelog update 2024-12-11 16:22:11 +00:00
BramvanZijp
ce9fc82382 Rework the HoS's Energy Shotgun (Varying energy consumption depending on fire-mode + re-adds a toned down self recharge.) (#32104)
* Rebalance HoS's Energy Shotgun

* SLIGHTLY Up the max charge so the gun properly recharges all of its charges, which matters a lot more with the self charge cooldown system.

* Prevent recharge cooldown if 0 power is used.

* Makes the clientside HUD actually update to reflect the changes in firecost and thus max/current charges.

* Properly fix that recharging to just under full issue instead of applying a budget fix to only the eshotgun.

* Clean up the client ammo UI fix.

* Update the self recharger component to comply with maintainer request.

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Remove code that was made redundant by a hotfix from another PR.

* Make the recharge pause on EMP, document things where needed, clean up code as per maintainer request, add a note to make the code better when power is moved to shared.

* Fix another internal issue

* Code cleanup + fix the rapid recharge verb to remove pause.

* cleanup

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2024-12-11 17:21:04 +01:00
PJBot
5ba868af79 Automatic changelog update 2024-12-11 15:59:10 +00:00
metalgearsloth
1a8e469c58 Fix battery self-recharge mispredicts (#33384) 2024-12-11 16:58:02 +01:00
Velcroboy
976cae9c78 Names camera routers (#33496)
Co-authored-by: Velcroboy <velcroboy333@hotmail.com>
2024-12-11 16:02:15 +01:00
PJBot
fc738b6690 Automatic changelog update 2024-12-11 14:31:38 +00:00
slarticodefast
c28f4fdc7f Fix greytide virus hitting other maps (#33806)
fix greytide virus hitting other maps
2024-12-11 15:30:29 +01:00
TGRCDev
89522e7144 Made anchor visuals generic (#33810)
Added a generic anchor visuals enum
2024-12-11 14:50:20 +01:00
PJBot
7b681b66ae Automatic changelog update 2024-12-10 13:46:28 +00:00
metalgearsloth
2b487baea0 Fix blank newline on empty examine groups (#33813)
Construction always grants a blank newline even if it not currently constructing.
2024-12-10 14:45:20 +01:00
slarticodefast
7ed32f2c7d Merge into master: Derelict icon hotfix (#33768) (#33802) 2024-12-10 11:34:40 +01:00
PJBot
ee10fc246f Automatic changelog update 2024-12-10 10:01:27 +00:00
ArtisticRoomba
0e4728b6d4 Fix: SMES now has wirepanels visuals (#33808)
SMES now has wirepanels visuals
2024-12-10 11:00:17 +01:00
ArtisticRoomba
b1fca73f91 Meta station TEG power fixes + misc stuff (#33791)
* Fix Meta TEG power issues, give singulo more scaffold, give AI two cams in singulo containment like other stations

* remove serialized invalids because it happens to the best of us

* properly setup cameras, label substation and atmos APC while I'm here
2024-12-09 14:13:21 -07:00
PJBot
dd96f77faa Automatic changelog update 2024-12-09 17:14:04 +00:00
joshepvodka
9cb46d9343 Bar related tweaks (#33505)
* does everything

* beer flavor revert and linter fix

* Update Resources/Locale/en-US/flavors/flavor-profiles.ftl

Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com>

* fix misspelling

* fix yet another misspelling

Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com>

* english has weird spellings huh

* im starting to feel ashamed of myself

* this is shameful

---------

Co-authored-by: Thomas <87614336+Aeshus@users.noreply.github.com>
2024-12-09 18:12:57 +01:00
PJBot
35b1c04494 Automatic changelog update 2024-12-09 16:11:20 +00:00
ScarKy0
60bf48ccce You can now pet the AI core. (#33788)
Pettable AI core
2024-12-09 17:10:13 +01:00
slarticodefast
8bb4c82890 add "Changes: Audio" label to labeler (#33790)
add audio label to labeler
2024-12-09 11:56:30 +01:00
PJBot
a7957ddf65 Automatic changelog update 2024-12-09 08:55:30 +00:00
deathride58
5ab8e467a5 Adds an introductory message to the user-facing ahelp chat window (#33348)
* Adds an introductory message to the user-facing ahelp chat window

* Update Resources/Locale/en-US/administration/bwoink.ftl

* Update Resources/Locale/en-US/administration/bwoink.ftl

---------

Co-authored-by: chromiumboy <50505512+chromiumboy@users.noreply.github.com>
2024-12-09 09:54:23 +01:00
dylanstrategie
38c35d8315 Major Marathon atmospherics rework (#33688)
* Major Marathon atmospherics rework

* More atmos changes

---------

Co-authored-by: dylanstrategie <188926747+dylanstrategie@users.noreply.github.com~>
2024-12-08 23:21:04 -07:00
sleepyyapril
7fd89806e2 Fix Disposals Ejections (#33468)
* Fix disposals.

* Rename properly

---------

Co-authored-by: sleepyyapril <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>
2024-12-08 22:08:07 -06:00
PJBot
1510e892f0 Automatic changelog update 2024-12-09 03:52:59 +00:00
Plykiya
8f2b19e103 Popup when being pulled shows who is pulling you (#33612)
* Popup when being pulled

* Update Content.Shared/Movement/Pulling/Systems/PullingSystem.cs

Co-authored-by: MilenVolf <63782763+MilenVolf@users.noreply.github.com>

* Update Resources/Locale/en-US/movement/pulling.ftl

Co-authored-by: MilenVolf <63782763+MilenVolf@users.noreply.github.com>

---------

Co-authored-by: MilenVolf <63782763+MilenVolf@users.noreply.github.com>
2024-12-08 21:51:53 -06:00
PJBot
a7e1adf395 Automatic changelog update 2024-12-09 03:42:17 +00:00
Errant
d57e731635 Signal timer duration limit (#33781)
* max duration

* comment
2024-12-08 21:41:11 -06:00
PJBot
670f1a8e28 Automatic changelog update 2024-12-08 23:21:10 +00:00
slarticodefast
ede8a1d377 Fix gas pipe leaking when unanchoring or breaking them (#33774)
* fix gas pipe unanchoring

* remove unneeded update

* revert popup change
2024-12-09 00:20:04 +01:00
PJBot
c4556fcbfe Automatic changelog update 2024-12-08 22:51:22 +00:00
ArtisticRoomba
34bfc59b18 Fix detective Vox spawning with their chosen outer clothing on the floor, force detective to have a selected outerclothing like all other sec roles (#33765)
fix detective vox spawning with their outer clothing on the floor
2024-12-08 23:50:14 +01:00
PJBot
98ad7a872f Automatic changelog update 2024-12-08 22:38:41 +00:00
Pieter-Jan Briers
f9da25881d Singularity equipment can now be activated with E interact (#33762)
These were coded to only listen to InteractHand, which doesn't follow our interaction model properly.
2024-12-08 23:37:32 +01:00
Errant
0c4dd9d1b9 Revert "Simplify separated screen top menu (#33047)" (Stable -> Master) (#33785) 2024-12-08 22:14:34 +01:00
Southbridge
73d5129644 Amber Station - Playtest Fixes (#33773)
* Fixed various issued identified during playtests.

* Fixed a firelock stuck closed

* Added more cameras and moved others

* Fixed an issue with disposals
2024-12-07 23:31:51 -07:00
PJBot
4661e9ef86 Automatic changelog update 2024-12-08 01:47:48 +00:00
Pieter-Jan Briers
299b13f21b Give silicons proper lobby/character editor previews (#33763)
* Give silicons proper lobby/character editor previews

No more naked dummies, properly show a borg/AI sprite now.

This means taking the JobEntity into account when spawning the dummy. For AIs I had to add a "JobPreviewEntity" field because they'd look like a posibrain otherwise. AI therefore uses a custom dummy entity I defined.

Also I had to add some margins to the UI, because otherwise the 32x32 sprite of the AI would look bad.

* Update Content.Shared/Roles/JobPrototype.cs

* Update Content.Client/Lobby/LobbyUIController.cs

* Update Resources/Prototypes/Entities/Mobs/Player/silicon.yml

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
2024-12-08 02:46:41 +01:00
github-actions[bot]
3d53e748fa Update Credits (#33772)
Co-authored-by: PJBot <pieterjan.briers+bot@gmail.com>
2024-12-08 01:57:20 +01:00
Myra
337952dcb4 Codeowners cleanup (#33297) 2024-12-08 01:01:57 +01:00
Emisse
c85642d920 let bagel be played at max pop (#33769) 2024-12-07 14:24:16 -07:00
SpaceManiac
20be8298b7 Organize the Sandbox Panel window (#33684)
* Organize Sandbox Panel

* Map Editing -> Editing

* Unset ToggleMode on Suicide button. Can hardly un-suicide, no?

* Remove 'Link machines' button that has done nothing for 3 years

* Remember Sandbox window's position instead of forcing to center

* Shows Spawns -> Show Spawns

* Remove SandboxSystem.MachineLinking
2024-12-07 19:13:56 +01:00
Emisse
7f5c3cf751 infiltrator update (#33759) 2024-12-07 01:36:03 -07:00
Southbridge
cf73cd5ddc Box Station - Now more festive! (#33751)
Added more holiday decorations
2024-12-06 23:53:36 -07:00
PJBot
1a96a2bcc8 Automatic changelog update 2024-12-07 05:59:31 +00:00
Piras314
0d45dfada9 Christmas Nuke Song (#33752)
* 圣诞歌曲

* Update Resources/Audio/StationEvents/attributions.yml

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
2024-12-06 23:58:23 -06:00
PJBot
44daf85566 Automatic changelog update 2024-12-07 03:41:00 +00:00
metalgearsloth
9365e3a99b Predicted gas pumps (#33717)
* Predicted gas pumps

I wanted to try out atmos and first thing I found.

* a

* Remove details range
2024-12-07 14:39:52 +11:00
Winkarst
4beb1016cc Make unknown shuttle events trigger an announcement (#33450)
* Make unknown shuttle events trigger an announcement

* Call base at the end

---------

Co-authored-by: Winkarst <74284083+Winkarst-cpu@users.noreply.github.co>
2024-12-06 22:39:35 +01:00
1649 changed files with 670639 additions and 232496 deletions

37
.github/CODEOWNERS vendored
View File

@@ -2,49 +2,30 @@
# Sorting by path instead of by who added it one day :(
# this isn't how codeowners rules work pls read the first comment instead of trying to force a sorting order
/Resources/ConfigPresets/WizardsDen/ @Chief-Engineer
# Moony's Gargantuan List Of Things She Cares About, or MGLOTSCA for short.
# You need to add your name to these entries, not make a new one, if you care about them.
/Content.*/Toolshed/ @moonheart08
**/Toolshed/** @moonheart08
*Command.cs @moonheart08
/Content.*/Administration/ @moonheart08 @DrSmugleaf @Chief-Engineer
/Content.*/Station/ @moonheart08
/Content.*/Maps/ @moonheart08
/Content.*/GameTicking/ @moonheart08 @EmoGarbage404
/Resources/ServerInfo/ @moonheart08 @Chief-Engineer
/Resources/ServerInfo/Guidebook/ @moonheart08 @EmoGarbage404
/Resources/ServerInfo/Guidebook/ServerRules/ @Chief-Engineer
/Resources/engineCommandPerms.yml @moonheart08 @Chief-Engineer
/Resources/clientCommandPerms.yml @moonheart08 @Chief-Engineer
/Resources/ConfigPresets/WizardsDen/ @nikthechampiongr @crazybrain23
/Content.*/Administration/ @DrSmugleaf @nikthechampiongr @crazybrain23
/Resources/ServerInfo/ @nikthechampiongr @crazybrain23
/Resources/ServerInfo/Guidebook/ServerRules/ @nikthechampiongr @crazybrain23
/Resources/Prototypes/Maps/** @Emisse
/Resources/Prototypes/Body/ @DrSmugleaf # suffering
/Resources/Prototypes/Entities/Mobs/Player/ @DrSmugleaf
/Resources/Prototypes/Entities/Mobs/Species/ @DrSmugleaf
/Resources/Prototypes/Guidebook/rules.yml @Chief-Engineer
/Resources/Prototypes/Guidebook/rules.yml @nikthechampiongr @crazybrain23
/Content.*/Body/ @DrSmugleaf
/Content.YAMLLinter @DrSmugleaf
/Content.Shared/Damage/ @DrSmugleaf
/Content.*/Anomaly/ @EmoGarbage404 @TheShuEd
/Content.*/Lathe/ @EmoGarbage404
/Content.*/Materials/ @EmoGarbage404
/Content.*/Mech/ @EmoGarbage404
/Content.*/Research/ @EmoGarbage404
/Content.*/Stack/ @EmoGarbage404
/Content.*/Xenoarchaeology/ @EmoGarbage404
/Content.*/Zombies/ @EmoGarbage404
/Resources/Prototypes/Entities/Structures/Specific/anomalies.yml @EmoGarbage404 @TheShuEd
/Resources/Prototypes/Research/ @EmoGarbage404
/Content.*/Anomaly/ @TheShuEd
/Resources/Prototypes/Entities/Structures/Specific/anomalies.yml @TheShuEd
/Content.*/Forensics/ @ficcialfaint
# SKREEEE
/Content.*.Database/ @PJB3005 @DrSmugleaf
/Content.Shared.Database/Log*.cs @PJB3005 @DrSmugleaf @Chief-Engineer
/Content.Shared.Database/Log*.cs @PJB3005 @DrSmugleaf @nikthechampiongr @crazybrain23
/Pow3r/ @PJB3005
/Content.Server/Power/Pow3r/ @PJB3005
@@ -52,7 +33,7 @@
/Content.*/Atmos/ @Partmedia
/Content.*/Botany/ @Partmedia
#Jezi
# Jezi
/Content.*/Medical @Jezithyr
/Content.*/Body @Jezithyr

4
.github/labeler.yml vendored
View File

@@ -16,6 +16,10 @@
- changed-files:
- any-glob-to-any-file: '**/*.swsl'
"Changes: Audio":
- changed-files:
- any-glob-to-any-file: '**/*.ogg'
"Changes: No C#":
- changed-files:
# Equiv to any-glob-to-all as long as this has one matcher. If ALL changed files are not C# files, then apply label.

View File

@@ -2,11 +2,11 @@
on:
push:
branches: [ master, staging, trying ]
branches: [ master, staging, stable ]
merge_group:
pull_request:
types: [ opened, reopened, synchronize, ready_for_review ]
branches: [ master ]
branches: [ master, staging, stable ]
jobs:
build:

View File

@@ -2,11 +2,11 @@ name: Build & Test Debug
on:
push:
branches: [ master, staging, trying ]
branches: [ master, staging, stable ]
merge_group:
pull_request:
types: [ opened, reopened, synchronize, ready_for_review ]
branches: [ master ]
branches: [ master, staging, stable ]
jobs:
build:

View File

@@ -14,7 +14,7 @@ jobs:
{
"0": "XS",
"10": "S",
"30": "M",
"100": "L",
"1000": "XL"
"100": "M",
"1000": "L",
"5000": "XL"
}

View File

@@ -2,7 +2,7 @@
on:
push:
branches: [ master, staging, trying ]
branches: [ master, staging, stable ]
paths:
- '**.cs'
- '**.csproj'
@@ -16,7 +16,7 @@ on:
merge_group:
pull_request:
types: [ opened, reopened, synchronize, ready_for_review ]
branches: [ master ]
branches: [ master, staging, stable ]
paths:
- '**.cs'
- '**.csproj'

View File

@@ -1,7 +1,7 @@
name: RGA schema validator
on:
push:
branches: [ master, staging, trying ]
branches: [ master, staging, stable ]
merge_group:
pull_request:
types: [ opened, reopened, synchronize, ready_for_review ]

View File

@@ -2,7 +2,7 @@ name: RSI Validator
on:
push:
branches: [ staging, trying ]
branches: [ master, staging, stable ]
merge_group:
pull_request:
paths:

View File

@@ -1,7 +1,7 @@
name: Map file schema validator
on:
push:
branches: [ master, staging, trying ]
branches: [ master, staging, stable ]
merge_group:
pull_request:
types: [ opened, reopened, synchronize, ready_for_review ]

View File

@@ -2,7 +2,7 @@ name: YAML Linter
on:
push:
branches: [ master, staging, trying ]
branches: [ master, staging, stable ]
merge_group:
pull_request:
types: [ opened, reopened, synchronize, ready_for_review ]

View File

@@ -31,19 +31,6 @@ public sealed partial class AtmosAlarmEntryContainer : BoxContainer
[AtmosAlarmType.Danger] = "atmos-alerts-window-danger-state",
};
private Dictionary<Gas, string> _gasShorthands = new Dictionary<Gas, string>()
{
[Gas.Ammonia] = "NH₃",
[Gas.CarbonDioxide] = "CO₂",
[Gas.Frezon] = "F",
[Gas.Nitrogen] = "N₂",
[Gas.NitrousOxide] = "N₂O",
[Gas.Oxygen] = "O₂",
[Gas.Plasma] = "P",
[Gas.Tritium] = "T",
[Gas.WaterVapor] = "H₂O",
};
public AtmosAlarmEntryContainer(NetEntity uid, EntityCoordinates? coordinates)
{
RobustXamlLoader.Load(this);
@@ -162,12 +149,11 @@ public sealed partial class AtmosAlarmEntryContainer : BoxContainer
foreach ((var gas, (var mol, var percent, var alert)) in keyValuePairs)
{
FixedPoint2 gasPercent = percent * 100f;
var gasShorthand = _gasShorthands.GetValueOrDefault(gas, "X");
var gasAbbreviation = Atmospherics.GasAbbreviations.GetValueOrDefault(gas, Loc.GetString("gas-unknown-abbreviation"));
var gasLabel = new Label()
{
Text = Loc.GetString("atmos-alerts-window-other-gases-value", ("shorthand", gasShorthand), ("value", gasPercent)),
Text = Loc.GetString("atmos-alerts-window-other-gases-value", ("shorthand", gasAbbreviation), ("value", gasPercent)),
FontOverride = normalFont,
FontColorOverride = GetAlarmStateColor(alert),
HorizontalAlignment = HAlignment.Center,

View File

@@ -0,0 +1,40 @@
using Content.Shared.Atmos.Components;
namespace Content.Client.Atmos.Consoles;
public sealed class AtmosMonitoringConsoleBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private AtmosMonitoringConsoleWindow? _menu;
public AtmosMonitoringConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) { }
protected override void Open()
{
base.Open();
_menu = new AtmosMonitoringConsoleWindow(this, Owner);
_menu.OpenCentered();
_menu.OnClose += Close;
}
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
if (state is not AtmosMonitoringConsoleBoundInterfaceState castState)
return;
EntMan.TryGetComponent<TransformComponent>(Owner, out var xform);
_menu?.UpdateUI(xform?.Coordinates, castState.AtmosNetworks);
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing)
return;
_menu?.Dispose();
}
}

View File

@@ -0,0 +1,295 @@
using Content.Client.Pinpointer.UI;
using Content.Shared.Atmos.Components;
using Content.Shared.Pinpointer;
using Robust.Client.Graphics;
using Robust.Shared.Collections;
using Robust.Shared.Map.Components;
using System.Linq;
using System.Numerics;
namespace Content.Client.Atmos.Consoles;
public sealed partial class AtmosMonitoringConsoleNavMapControl : NavMapControl
{
[Dependency] private readonly IEntityManager _entManager = default!;
public bool ShowPipeNetwork = true;
public int? FocusNetId = null;
private const int ChunkSize = 4;
private readonly Color _basePipeNetColor = Color.LightGray;
private readonly Color _unfocusedPipeNetColor = Color.DimGray;
private List<AtmosMonitoringConsoleLine> _atmosPipeNetwork = new();
private Dictionary<Color, Color> _sRGBLookUp = new Dictionary<Color, Color>();
// Look up tables for merging continuous lines. Indexed by line color
private Dictionary<Color, Dictionary<Vector2i, Vector2i>> _horizLines = new();
private Dictionary<Color, Dictionary<Vector2i, Vector2i>> _horizLinesReversed = new();
private Dictionary<Color, Dictionary<Vector2i, Vector2i>> _vertLines = new();
private Dictionary<Color, Dictionary<Vector2i, Vector2i>> _vertLinesReversed = new();
public AtmosMonitoringConsoleNavMapControl() : base()
{
PostWallDrawingAction += DrawAllPipeNetworks;
}
protected override void UpdateNavMap()
{
base.UpdateNavMap();
if (!_entManager.TryGetComponent<AtmosMonitoringConsoleComponent>(Owner, out var console))
return;
if (!_entManager.TryGetComponent<MapGridComponent>(MapUid, out var grid))
return;
_atmosPipeNetwork = GetDecodedAtmosPipeChunks(console.AtmosPipeChunks, grid);
}
private void DrawAllPipeNetworks(DrawingHandleScreen handle)
{
if (!ShowPipeNetwork)
return;
// Draw networks
if (_atmosPipeNetwork != null && _atmosPipeNetwork.Any())
DrawPipeNetwork(handle, _atmosPipeNetwork);
}
private void DrawPipeNetwork(DrawingHandleScreen handle, List<AtmosMonitoringConsoleLine> atmosPipeNetwork)
{
var offset = GetOffset();
offset = offset with { Y = -offset.Y };
if (WorldRange / WorldMaxRange > 0.5f)
{
var pipeNetworks = new Dictionary<Color, ValueList<Vector2>>();
foreach (var chunkedLine in atmosPipeNetwork)
{
var start = ScalePosition(chunkedLine.Origin - offset);
var end = ScalePosition(chunkedLine.Terminus - offset);
if (!pipeNetworks.TryGetValue(chunkedLine.Color, out var subNetwork))
subNetwork = new ValueList<Vector2>();
subNetwork.Add(start);
subNetwork.Add(end);
pipeNetworks[chunkedLine.Color] = subNetwork;
}
foreach ((var color, var subNetwork) in pipeNetworks)
{
if (subNetwork.Count > 0)
handle.DrawPrimitives(DrawPrimitiveTopology.LineList, subNetwork.Span, color);
}
}
else
{
var pipeVertexUVs = new Dictionary<Color, ValueList<Vector2>>();
foreach (var chunkedLine in atmosPipeNetwork)
{
var leftTop = ScalePosition(new Vector2
(Math.Min(chunkedLine.Origin.X, chunkedLine.Terminus.X) - 0.1f,
Math.Min(chunkedLine.Origin.Y, chunkedLine.Terminus.Y) - 0.1f)
- offset);
var rightTop = ScalePosition(new Vector2
(Math.Max(chunkedLine.Origin.X, chunkedLine.Terminus.X) + 0.1f,
Math.Min(chunkedLine.Origin.Y, chunkedLine.Terminus.Y) - 0.1f)
- offset);
var leftBottom = ScalePosition(new Vector2
(Math.Min(chunkedLine.Origin.X, chunkedLine.Terminus.X) - 0.1f,
Math.Max(chunkedLine.Origin.Y, chunkedLine.Terminus.Y) + 0.1f)
- offset);
var rightBottom = ScalePosition(new Vector2
(Math.Max(chunkedLine.Origin.X, chunkedLine.Terminus.X) + 0.1f,
Math.Max(chunkedLine.Origin.Y, chunkedLine.Terminus.Y) + 0.1f)
- offset);
if (!pipeVertexUVs.TryGetValue(chunkedLine.Color, out var pipeVertexUV))
pipeVertexUV = new ValueList<Vector2>();
pipeVertexUV.Add(leftBottom);
pipeVertexUV.Add(leftTop);
pipeVertexUV.Add(rightBottom);
pipeVertexUV.Add(leftTop);
pipeVertexUV.Add(rightBottom);
pipeVertexUV.Add(rightTop);
pipeVertexUVs[chunkedLine.Color] = pipeVertexUV;
}
foreach ((var color, var pipeVertexUV) in pipeVertexUVs)
{
if (pipeVertexUV.Count > 0)
handle.DrawPrimitives(DrawPrimitiveTopology.TriangleList, pipeVertexUV.Span, color);
}
}
}
private List<AtmosMonitoringConsoleLine> GetDecodedAtmosPipeChunks(Dictionary<Vector2i, AtmosPipeChunk>? chunks, MapGridComponent? grid)
{
var decodedOutput = new List<AtmosMonitoringConsoleLine>();
if (chunks == null || grid == null)
return decodedOutput;
// Clear stale look up table values
_horizLines.Clear();
_horizLinesReversed.Clear();
_vertLines.Clear();
_vertLinesReversed.Clear();
// Generate masks
var northMask = (ulong)1 << 0;
var southMask = (ulong)1 << 1;
var westMask = (ulong)1 << 2;
var eastMask = (ulong)1 << 3;
foreach ((var chunkOrigin, var chunk) in chunks)
{
var list = new List<AtmosMonitoringConsoleLine>();
foreach (var ((netId, hexColor), atmosPipeData) in chunk.AtmosPipeData)
{
// Determine the correct coloration for the pipe
var color = Color.FromHex(hexColor) * _basePipeNetColor;
if (FocusNetId != null && FocusNetId != netId)
color *= _unfocusedPipeNetColor;
// Get the associated line look up tables
if (!_horizLines.TryGetValue(color, out var horizLines))
{
horizLines = new();
_horizLines[color] = horizLines;
}
if (!_horizLinesReversed.TryGetValue(color, out var horizLinesReversed))
{
horizLinesReversed = new();
_horizLinesReversed[color] = horizLinesReversed;
}
if (!_vertLines.TryGetValue(color, out var vertLines))
{
vertLines = new();
_vertLines[color] = vertLines;
}
if (!_vertLinesReversed.TryGetValue(color, out var vertLinesReversed))
{
vertLinesReversed = new();
_vertLinesReversed[color] = vertLinesReversed;
}
// Loop over the chunk
for (var tileIdx = 0; tileIdx < ChunkSize * ChunkSize; tileIdx++)
{
if (atmosPipeData == 0)
continue;
var mask = (ulong)SharedNavMapSystem.AllDirMask << tileIdx * SharedNavMapSystem.Directions;
if ((atmosPipeData & mask) == 0)
continue;
var relativeTile = GetTileFromIndex(tileIdx);
var tile = (chunk.Origin * ChunkSize + relativeTile) * grid.TileSize;
tile = tile with { Y = -tile.Y };
// Calculate the draw point offsets
var vertLineOrigin = (atmosPipeData & northMask << tileIdx * SharedNavMapSystem.Directions) > 0 ?
new Vector2(grid.TileSize * 0.5f, -grid.TileSize * 1f) : new Vector2(grid.TileSize * 0.5f, -grid.TileSize * 0.5f);
var vertLineTerminus = (atmosPipeData & southMask << tileIdx * SharedNavMapSystem.Directions) > 0 ?
new Vector2(grid.TileSize * 0.5f, -grid.TileSize * 0f) : new Vector2(grid.TileSize * 0.5f, -grid.TileSize * 0.5f);
var horizLineOrigin = (atmosPipeData & eastMask << tileIdx * SharedNavMapSystem.Directions) > 0 ?
new Vector2(grid.TileSize * 1f, -grid.TileSize * 0.5f) : new Vector2(grid.TileSize * 0.5f, -grid.TileSize * 0.5f);
var horizLineTerminus = (atmosPipeData & westMask << tileIdx * SharedNavMapSystem.Directions) > 0 ?
new Vector2(grid.TileSize * 0f, -grid.TileSize * 0.5f) : new Vector2(grid.TileSize * 0.5f, -grid.TileSize * 0.5f);
// Since we can have pipe lines that have a length of a half tile,
// double the vectors and convert to vector2i so we can merge them
AddOrUpdateNavMapLine(ConvertVector2ToVector2i(tile + horizLineOrigin, 2), ConvertVector2ToVector2i(tile + horizLineTerminus, 2), horizLines, horizLinesReversed);
AddOrUpdateNavMapLine(ConvertVector2ToVector2i(tile + vertLineOrigin, 2), ConvertVector2ToVector2i(tile + vertLineTerminus, 2), vertLines, vertLinesReversed);
}
}
}
// Scale the vector2is back down and convert to vector2
foreach (var (color, horizLines) in _horizLines)
{
// Get the corresponding sRBG color
var sRGB = GetsRGBColor(color);
foreach (var (origin, terminal) in horizLines)
decodedOutput.Add(new AtmosMonitoringConsoleLine
(ConvertVector2iToVector2(origin, 0.5f), ConvertVector2iToVector2(terminal, 0.5f), sRGB));
}
foreach (var (color, vertLines) in _vertLines)
{
// Get the corresponding sRBG color
var sRGB = GetsRGBColor(color);
foreach (var (origin, terminal) in vertLines)
decodedOutput.Add(new AtmosMonitoringConsoleLine
(ConvertVector2iToVector2(origin, 0.5f), ConvertVector2iToVector2(terminal, 0.5f), sRGB));
}
return decodedOutput;
}
private Vector2 ConvertVector2iToVector2(Vector2i vector, float scale = 1f)
{
return new Vector2(vector.X * scale, vector.Y * scale);
}
private Vector2i ConvertVector2ToVector2i(Vector2 vector, float scale = 1f)
{
return new Vector2i((int)MathF.Round(vector.X * scale), (int)MathF.Round(vector.Y * scale));
}
private Vector2i GetTileFromIndex(int index)
{
var x = index / ChunkSize;
var y = index % ChunkSize;
return new Vector2i(x, y);
}
private Color GetsRGBColor(Color color)
{
if (!_sRGBLookUp.TryGetValue(color, out var sRGB))
{
sRGB = Color.ToSrgb(color);
_sRGBLookUp[color] = sRGB;
}
return sRGB;
}
}
public struct AtmosMonitoringConsoleLine
{
public readonly Vector2 Origin;
public readonly Vector2 Terminus;
public readonly Color Color;
public AtmosMonitoringConsoleLine(Vector2 origin, Vector2 terminus, Color color)
{
Origin = origin;
Terminus = terminus;
Color = color;
}
}

View File

@@ -0,0 +1,69 @@
using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.Consoles;
using Robust.Shared.GameStates;
namespace Content.Client.Atmos.Consoles;
public sealed class AtmosMonitoringConsoleSystem : SharedAtmosMonitoringConsoleSystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<AtmosMonitoringConsoleComponent, ComponentHandleState>(OnHandleState);
}
private void OnHandleState(EntityUid uid, AtmosMonitoringConsoleComponent component, ref ComponentHandleState args)
{
Dictionary<Vector2i, Dictionary<(int, string), ulong>> modifiedChunks;
Dictionary<NetEntity, AtmosDeviceNavMapData> atmosDevices;
switch (args.Current)
{
case AtmosMonitoringConsoleDeltaState delta:
{
modifiedChunks = delta.ModifiedChunks;
atmosDevices = delta.AtmosDevices;
foreach (var index in component.AtmosPipeChunks.Keys)
{
if (!delta.AllChunks!.Contains(index))
component.AtmosPipeChunks.Remove(index);
}
break;
}
case AtmosMonitoringConsoleState state:
{
modifiedChunks = state.Chunks;
atmosDevices = state.AtmosDevices;
foreach (var index in component.AtmosPipeChunks.Keys)
{
if (!state.Chunks.ContainsKey(index))
component.AtmosPipeChunks.Remove(index);
}
break;
}
default:
return;
}
foreach (var (origin, chunk) in modifiedChunks)
{
var newChunk = new AtmosPipeChunk(origin);
newChunk.AtmosPipeData = new Dictionary<(int, string), ulong>(chunk);
component.AtmosPipeChunks[origin] = newChunk;
}
component.AtmosDevices.Clear();
foreach (var (nuid, atmosDevice) in atmosDevices)
{
component.AtmosDevices[nuid] = atmosDevice;
}
}
}

View File

@@ -0,0 +1,99 @@
<controls:FancyWindow xmlns="https://spacestation14.io"
xmlns:ui="clr-namespace:Content.Client.Atmos.Consoles"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
Title="{Loc 'atmos-monitoring-window-title'}"
Resizable="False"
SetSize="1120 750"
MinSize="1120 750">
<BoxContainer Orientation="Vertical">
<!-- Main display -->
<BoxContainer Orientation="Horizontal" VerticalExpand="True" HorizontalExpand="True">
<!-- Nav map -->
<BoxContainer Orientation="Vertical" VerticalExpand="True" HorizontalExpand="True">
<ui:AtmosMonitoringConsoleNavMapControl Name="NavMap" Margin="5 5" VerticalExpand="True" HorizontalExpand="True">
<!-- System warning -->
<PanelContainer Name="SystemWarningPanel"
HorizontalAlignment="Center"
VerticalAlignment="Top"
HorizontalExpand="True"
Margin="0 48 0 0"
Visible="False">
<RichTextLabel Name="SystemWarningLabel" Margin="12 8 12 8"/>
</PanelContainer>
</ui:AtmosMonitoringConsoleNavMapControl>
<!-- Nav map legend -->
<BoxContainer Orientation="Horizontal" Margin="0 10 0 10">
<TextureRect Stretch="KeepAspectCentered"
TexturePath="/Textures/Interface/NavMap/beveled_square.png"
Modulate="#a9a9a9"
SetSize="16 16"
Margin="20 0 5 0"/>
<Label Text="{Loc 'atmos-monitoring-window-label-gas-opening'}"/>
<TextureRect Stretch="KeepAspectCentered"
TexturePath="/Textures/Interface/NavMap/beveled_circle.png"
SetSize="16 16"
Modulate="#a9a9a9"
Margin="20 0 5 0"/>
<Label Text="{Loc 'atmos-monitoring-window-label-gas-scrubber'}"/>
<TextureRect Stretch="KeepAspectCentered"
TexturePath="/Textures/Interface/NavMap/beveled_arrow_east.png"
SetSize="16 16"
Modulate="#a9a9a9"
Margin="20 0 5 0"/>
<Label Text="{Loc 'atmos-monitoring-window-label-gas-flow-regulator'}"/>
<TextureRect Stretch="KeepAspectCentered"
TexturePath="/Textures/Interface/NavMap/beveled_hexagon.png"
SetSize="16 16"
Modulate="#a9a9a9"
Margin="20 0 5 0"/>
<Label Text="{Loc 'atmos-monitoring-window-label-thermoregulator'}"/>
</BoxContainer>
</BoxContainer>
<!-- Atmosphere status -->
<BoxContainer Orientation="Vertical" VerticalExpand="True" SetWidth="440" Margin="0 0 10 10">
<!-- Station name -->
<controls:StripeBack>
<PanelContainer>
<RichTextLabel Name="StationName" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0 5 0 3"/>
</PanelContainer>
</controls:StripeBack>
<!-- Alarm status (entries added by C# code) -->
<TabContainer Name="MasterTabContainer" VerticalExpand="True" HorizontalExpand="True" Margin="0 10 0 0">
<ScrollContainer HorizontalExpand="True" Margin="8, 8, 8, 8">
<BoxContainer Name="AtmosNetworksTable" Orientation="Vertical" VerticalExpand="True" HorizontalExpand="True" Margin="0 0 0 10"/>
</ScrollContainer>
</TabContainer>
<!-- Overlay toggles -->
<BoxContainer Orientation="Vertical" Margin="0 10 0 0">
<Label Text="{Loc 'atmos-monitoring-window-toggle-overlays'}" Margin="0 0 0 5"/>
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<CheckBox Name="ShowPipeNetwork" Text="{Loc 'atmos-monitoring-window-show-pipe-network'}" Pressed="True" HorizontalExpand="True"/>
<CheckBox Name="ShowGasPipeSensors" Text="{Loc 'atmos-monitoring-window-show-gas-pipe-sensors'}" Pressed="False" HorizontalExpand="True"/>
</BoxContainer>
</BoxContainer>
</BoxContainer>
</BoxContainer>
<!-- Footer -->
<BoxContainer Orientation="Vertical">
<PanelContainer StyleClasses="LowDivider" />
<BoxContainer Orientation="Horizontal" Margin="10 2 5 0" VerticalAlignment="Bottom">
<Label Text="{Loc 'atmos-monitoring-window-flavor-left'}" StyleClasses="WindowFooterText" />
<Label Text="{Loc 'atmos-monitoring-window-flavor-right'}" StyleClasses="WindowFooterText"
HorizontalAlignment="Right" HorizontalExpand="True" Margin="0 0 5 0" />
<TextureRect StyleClasses="NTLogoDark" Stretch="KeepAspectCentered"
VerticalAlignment="Center" HorizontalAlignment="Right" SetSize="19 19"/>
</BoxContainer>
</BoxContainer>
</BoxContainer>
</controls:FancyWindow>

View File

@@ -0,0 +1,455 @@
using Content.Client.Pinpointer.UI;
using Content.Client.UserInterface.Controls;
using Content.Shared.Atmos.Components;
using Content.Shared.Prototypes;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
namespace Content.Client.Atmos.Consoles;
[GenerateTypedNameReferences]
public sealed partial class AtmosMonitoringConsoleWindow : FancyWindow
{
private readonly IEntityManager _entManager;
private readonly IPrototypeManager _protoManager;
private readonly SpriteSystem _spriteSystem;
private EntityUid? _owner;
private NetEntity? _focusEntity;
private int? _focusNetId;
private bool _autoScrollActive = false;
private readonly Color _unfocusedDeviceColor = Color.DimGray;
private ProtoId<NavMapBlipPrototype> _navMapConsoleProtoId = "NavMapConsole";
private ProtoId<NavMapBlipPrototype> _gasPipeSensorProtoId = "GasPipeSensor";
public AtmosMonitoringConsoleWindow(AtmosMonitoringConsoleBoundUserInterface userInterface, EntityUid? owner)
{
RobustXamlLoader.Load(this);
_entManager = IoCManager.Resolve<IEntityManager>();
_protoManager = IoCManager.Resolve<IPrototypeManager>();
_spriteSystem = _entManager.System<SpriteSystem>();
// Pass the owner to nav map
_owner = owner;
NavMap.Owner = _owner;
// Set nav map grid uid
var stationName = Loc.GetString("atmos-monitoring-window-unknown-location");
EntityCoordinates? consoleCoords = null;
if (_entManager.TryGetComponent<TransformComponent>(owner, out var xform))
{
consoleCoords = xform.Coordinates;
NavMap.MapUid = xform.GridUid;
// Assign station name
if (_entManager.TryGetComponent<MetaDataComponent>(xform.GridUid, out var stationMetaData))
stationName = stationMetaData.EntityName;
var msg = new FormattedMessage();
msg.TryAddMarkup(Loc.GetString("atmos-monitoring-window-station-name", ("stationName", stationName)), out _);
StationName.SetMessage(msg);
}
else
{
StationName.SetMessage(stationName);
NavMap.Visible = false;
}
// Set trackable entity selected action
NavMap.TrackedEntitySelectedAction += SetTrackedEntityFromNavMap;
// Update nav map
NavMap.ForceNavMapUpdate();
// Set tab container headers
MasterTabContainer.SetTabTitle(0, Loc.GetString("atmos-monitoring-window-tab-networks"));
// Set UI toggles
ShowPipeNetwork.OnToggled += _ => OnShowPipeNetworkToggled();
ShowGasPipeSensors.OnToggled += _ => OnShowGasPipeSensors();
// Set nav map colors
if (!_entManager.TryGetComponent<AtmosMonitoringConsoleComponent>(_owner, out var console))
return;
NavMap.TileColor = console.NavMapTileColor;
NavMap.WallColor = console.NavMapWallColor;
// Initalize
UpdateUI(consoleCoords, Array.Empty<AtmosMonitoringConsoleEntry>());
}
#region Toggle handling
private void OnShowPipeNetworkToggled()
{
if (_owner == null)
return;
if (!_entManager.TryGetComponent<AtmosMonitoringConsoleComponent>(_owner.Value, out var console))
return;
NavMap.ShowPipeNetwork = ShowPipeNetwork.Pressed;
foreach (var (netEnt, device) in console.AtmosDevices)
{
if (device.NavMapBlip == _gasPipeSensorProtoId)
continue;
if (ShowPipeNetwork.Pressed)
AddTrackedEntityToNavMap(device);
else
NavMap.TrackedEntities.Remove(netEnt);
}
}
private void OnShowGasPipeSensors()
{
if (_owner == null)
return;
if (!_entManager.TryGetComponent<AtmosMonitoringConsoleComponent>(_owner.Value, out var console))
return;
foreach (var (netEnt, device) in console.AtmosDevices)
{
if (device.NavMapBlip != _gasPipeSensorProtoId)
continue;
if (ShowGasPipeSensors.Pressed)
AddTrackedEntityToNavMap(device, true);
else
NavMap.TrackedEntities.Remove(netEnt);
}
}
#endregion
public void UpdateUI
(EntityCoordinates? consoleCoords,
AtmosMonitoringConsoleEntry[] atmosNetworks)
{
if (_owner == null)
return;
if (!_entManager.TryGetComponent<AtmosMonitoringConsoleComponent>(_owner.Value, out var console))
return;
// Reset nav map values
NavMap.TrackedCoordinates.Clear();
NavMap.TrackedEntities.Clear();
if (_focusEntity != null && !console.AtmosDevices.Any(x => x.Key == _focusEntity))
ClearFocus();
// Add tracked entities to the nav map
UpdateNavMapBlips();
// Show the monitor location
var consoleNetEnt = _entManager.GetNetEntity(_owner);
if (consoleCoords != null && consoleNetEnt != null)
{
var proto = _protoManager.Index(_navMapConsoleProtoId);
if (proto.TexturePaths != null && proto.TexturePaths.Length != 0)
{
var texture = _spriteSystem.Frame0(new SpriteSpecifier.Texture(proto.TexturePaths[0]));
var blip = new NavMapBlip(consoleCoords.Value, texture, proto.Color, proto.Blinks, proto.Selectable);
NavMap.TrackedEntities[consoleNetEnt.Value] = blip;
}
}
// Update the nav map
NavMap.ForceNavMapUpdate();
// Clear excess children from the tables
while (AtmosNetworksTable.ChildCount > atmosNetworks.Length)
AtmosNetworksTable.RemoveChild(AtmosNetworksTable.GetChild(AtmosNetworksTable.ChildCount - 1));
// Update all entries in each table
for (int index = 0; index < atmosNetworks.Length; index++)
{
var entry = atmosNetworks.ElementAt(index);
UpdateUIEntry(entry, index, AtmosNetworksTable, console);
}
}
private void UpdateNavMapBlips()
{
if (_owner == null || !_entManager.TryGetComponent<AtmosMonitoringConsoleComponent>(_owner.Value, out var console))
return;
if (NavMap.Visible)
{
foreach (var (netEnt, device) in console.AtmosDevices)
{
// Update the focus network ID, incase it has changed
if (_focusEntity == netEnt)
{
_focusNetId = device.NetId;
NavMap.FocusNetId = _focusNetId;
}
var isSensor = device.NavMapBlip == _gasPipeSensorProtoId;
// Skip network devices if the toggled is off
if (!ShowPipeNetwork.Pressed && !isSensor)
continue;
// Skip gas pipe sensors if the toggle is off
if (!ShowGasPipeSensors.Pressed && isSensor)
continue;
AddTrackedEntityToNavMap(device, isSensor);
}
}
}
private void AddTrackedEntityToNavMap(AtmosDeviceNavMapData metaData, bool isSensor = false)
{
var proto = _protoManager.Index(metaData.NavMapBlip);
if (proto.TexturePaths == null || proto.TexturePaths.Length == 0)
return;
var idx = Math.Clamp((int)metaData.Direction / 2, 0, proto.TexturePaths.Length - 1);
var texture = proto.TexturePaths.Length > 0 ? proto.TexturePaths[idx] : proto.TexturePaths[0];
var color = isSensor ? proto.Color : proto.Color * metaData.PipeColor;
if (_focusNetId != null && metaData.NetId != _focusNetId)
color *= _unfocusedDeviceColor;
var blinks = proto.Blinks || _focusEntity == metaData.NetEntity;
var coords = _entManager.GetCoordinates(metaData.NetCoordinates);
var blip = new NavMapBlip(coords, _spriteSystem.Frame0(new SpriteSpecifier.Texture(texture)), color, blinks, proto.Selectable, proto.Scale);
NavMap.TrackedEntities[metaData.NetEntity] = blip;
}
private void UpdateUIEntry(AtmosMonitoringConsoleEntry data, int index, Control table, AtmosMonitoringConsoleComponent console)
{
// Make new UI entry if required
if (index >= table.ChildCount)
{
var newEntryContainer = new AtmosMonitoringEntryContainer(data);
// On click
newEntryContainer.FocusButton.OnButtonUp += args =>
{
if (_focusEntity == newEntryContainer.Data.NetEntity)
{
ClearFocus();
}
else
{
SetFocus(newEntryContainer.Data.NetEntity, newEntryContainer.Data.NetId);
var coords = _entManager.GetCoordinates(newEntryContainer.Data.Coordinates);
NavMap.CenterToCoordinates(coords);
}
// Update affected UI elements across all tables
UpdateConsoleTable(console, AtmosNetworksTable, _focusEntity);
};
// Add the entry to the current table
table.AddChild(newEntryContainer);
}
// Update values and UI elements
var tableChild = table.GetChild(index);
if (tableChild is not AtmosMonitoringEntryContainer)
{
table.RemoveChild(tableChild);
UpdateUIEntry(data, index, table, console);
return;
}
var entryContainer = (AtmosMonitoringEntryContainer)tableChild;
entryContainer.UpdateEntry(data, data.NetEntity == _focusEntity);
}
private void UpdateConsoleTable(AtmosMonitoringConsoleComponent console, Control table, NetEntity? currTrackedEntity)
{
foreach (var tableChild in table.Children)
{
if (tableChild is not AtmosAlarmEntryContainer)
continue;
var entryContainer = (AtmosAlarmEntryContainer)tableChild;
if (entryContainer.NetEntity != currTrackedEntity)
entryContainer.RemoveAsFocus();
else if (entryContainer.NetEntity == currTrackedEntity)
entryContainer.SetAsFocus();
}
}
private void SetTrackedEntityFromNavMap(NetEntity? focusEntity)
{
if (focusEntity == null)
return;
if (!_entManager.TryGetComponent<AtmosMonitoringConsoleComponent>(_owner, out var console))
return;
foreach (var (netEnt, device) in console.AtmosDevices)
{
if (netEnt != focusEntity)
continue;
if (device.NavMapBlip != _gasPipeSensorProtoId)
return;
// Set new focus
SetFocus(focusEntity.Value, device.NetId);
// Get the scroll position of the selected entity on the selected button the UI
ActivateAutoScrollToFocus();
break;
}
}
protected override void FrameUpdate(FrameEventArgs args)
{
AutoScrollToFocus();
}
private void ActivateAutoScrollToFocus()
{
_autoScrollActive = true;
}
private void AutoScrollToFocus()
{
if (!_autoScrollActive)
return;
var scroll = AtmosNetworksTable.Parent as ScrollContainer;
if (scroll == null)
return;
if (!TryGetVerticalScrollbar(scroll, out var vScrollbar))
return;
if (!TryGetNextScrollPosition(out float? nextScrollPosition))
return;
vScrollbar.ValueTarget = nextScrollPosition.Value;
if (MathHelper.CloseToPercent(vScrollbar.Value, vScrollbar.ValueTarget))
_autoScrollActive = false;
}
private bool TryGetVerticalScrollbar(ScrollContainer scroll, [NotNullWhen(true)] out VScrollBar? vScrollBar)
{
vScrollBar = null;
foreach (var control in scroll.Children)
{
if (control is not VScrollBar)
continue;
vScrollBar = (VScrollBar)control;
return true;
}
return false;
}
private bool TryGetNextScrollPosition([NotNullWhen(true)] out float? nextScrollPosition)
{
nextScrollPosition = null;
var scroll = AtmosNetworksTable.Parent as ScrollContainer;
if (scroll == null)
return false;
var container = scroll.Children.ElementAt(0) as BoxContainer;
if (container == null || container.Children.Count() == 0)
return false;
// Exit if the heights of the children haven't been initialized yet
if (!container.Children.Any(x => x.Height > 0))
return false;
nextScrollPosition = 0;
foreach (var control in container.Children)
{
if (control is not AtmosMonitoringEntryContainer)
continue;
var entry = (AtmosMonitoringEntryContainer)control;
if (entry.Data.NetEntity == _focusEntity)
return true;
nextScrollPosition += control.Height;
}
// Failed to find control
nextScrollPosition = null;
return false;
}
private void SetFocus(NetEntity focusEntity, int focusNetId)
{
_focusEntity = focusEntity;
_focusNetId = focusNetId;
NavMap.FocusNetId = focusNetId;
OnFocusChanged();
}
private void ClearFocus()
{
_focusEntity = null;
_focusNetId = null;
NavMap.FocusNetId = null;
OnFocusChanged();
}
private void OnFocusChanged()
{
UpdateNavMapBlips();
NavMap.ForceNavMapUpdate();
if (!_entManager.TryGetComponent<AtmosMonitoringConsoleComponent>(_owner, out var console))
return;
for (int index = 0; index < AtmosNetworksTable.ChildCount; index++)
{
var entry = (AtmosMonitoringEntryContainer)AtmosNetworksTable.GetChild(index);
if (entry == null)
continue;
UpdateUIEntry(entry.Data, index, AtmosNetworksTable, console);
}
}
}

View File

@@ -0,0 +1,74 @@
<BoxContainer xmlns="https://spacestation14.io"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="clr-namespace:Content.Client.Stylesheets"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
Orientation="Vertical" HorizontalExpand ="True" Margin="0 0 0 3">
<!-- Network selection button -->
<Button Name="FocusButton" HorizontalExpand="True" VerticalExpand="True" Margin="0 0 6 8" StyleClasses="OpenLeft" Access="Public">
<BoxContainer HorizontalExpand="True" VerticalExpand="True" Orientation="Vertical">
<BoxContainer HorizontalExpand="True" VerticalExpand="True" Orientation="Horizontal" SetHeight="32">
<PanelContainer Name="NetworkColorStripe" HorizontalAlignment="Left" SetWidth="8" VerticalExpand="True" Margin="-8 -2 0 0">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#d7d7d7"/>
</PanelContainer.PanelOverride>
</PanelContainer>
<Label Name="NetworkNameLabel" Text="???" HorizontalExpand="True" HorizontalAlignment="Center"/>
</BoxContainer>
<!-- Panel that appears on selecting the device -->
<PanelContainer HorizontalExpand="True" Margin="-8 0 -14 -4" Access="Public">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#25252a"/>
</PanelContainer.PanelOverride>
<BoxContainer Name="MainDataContainer" HorizontalExpand="True" VerticalExpand="True" Orientation="Vertical">
<Control>
<BoxContainer HorizontalExpand="True" VerticalExpand="True" Orientation="Vertical">
<BoxContainer HorizontalExpand="True" Orientation="Horizontal">
<Label Name="TemperatureHeaderLabel" Text="{Loc 'atmos-alerts-window-temperature-label'}" HorizontalAlignment="Center" HorizontalExpand="True" FontColorOverride="#a9a9a9" Margin="0 2 0 0" SetHeight="24"></Label>
<Label Name="PressureHeaderLabel" Text="{Loc 'atmos-alerts-window-pressure-label'}" HorizontalAlignment="Center" HorizontalExpand="True" FontColorOverride="#a9a9a9" Margin="0 2 0 0" SetHeight="24"></Label>
<Label Name="TotalMolHeaderLabel" Text="{Loc 'atmos-alerts-window-total-mol-label'}" HorizontalAlignment="Center" HorizontalExpand="True" FontColorOverride="#a9a9a9" Margin="0 2 0 0" SetHeight="24"></Label>
</BoxContainer>
<PanelContainer HorizontalExpand="True">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#202023"/>
</PanelContainer.PanelOverride>
<BoxContainer HorizontalExpand="True" Orientation="Horizontal">
<Label Name="TemperatureLabel" Text="???" HorizontalAlignment="Center" HorizontalExpand="True" FontColorOverride="#a9a9a9" Margin="0 2 0 0" SetHeight="24"></Label>
<Label Name="PressureLabel" Text="???" HorizontalAlignment="Center" HorizontalExpand="True" FontColorOverride="#a9a9a9" Margin="0 2 0 0" SetHeight="24"></Label>
<Label Name="TotalMolLabel" Text="???" HorizontalAlignment="Center" HorizontalExpand="True" FontColorOverride="#a9a9a9" Margin="0 2 0 0" SetHeight="24"></Label>
</BoxContainer>
</PanelContainer>
<BoxContainer HorizontalExpand="True" Orientation="Horizontal" Margin="8 0">
<TextureRect Name="ArrowTexture" VerticalAlignment="Center" SetSize="12 12" Stretch="KeepAspectCentered" Margin="3 0" TexturePath="/Textures/Interface/Nano/triangle_right.png"></TextureRect>
<Label Name="GasesHeaderLabel" Text="{Loc 'atmos-monitoring-window-label-gases'}" HorizontalAlignment="Left" HorizontalExpand="True" FontColorOverride="#a9a9a9" Margin="4 0 0 0" SetHeight="24"></Label>
</BoxContainer>
</BoxContainer>
</Control>
<!-- Atmosphere status -->
<Control Name="FocusContainer" ReservesSpace="False" Visible="False">
<!-- Main container for displaying atmospheric data -->
<BoxContainer HorizontalExpand="True" VerticalExpand="True" Orientation="Vertical">
<PanelContainer HorizontalExpand="True">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#202023"/>
</PanelContainer.PanelOverride>
<!-- Gas entries added via C# code -->
<GridContainer Name="GasGridContainer" HorizontalExpand="True" Columns = "4"></GridContainer>
</PanelContainer>
</BoxContainer>
</Control>
</BoxContainer>
<!-- If the alarm is inactive, this is label is displayed instead -->
<Label Name="NoDataLabel" Text="{Loc 'atmos-alerts-window-no-data-available'}" HorizontalAlignment="Center" Margin="0 15" FontColorOverride="#a9a9a9" ReservesSpace="False" Visible="False"></Label>
</PanelContainer>
</BoxContainer>
</Button>
</BoxContainer>

View File

@@ -0,0 +1,166 @@
using Content.Client.Stylesheets;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Components;
using Content.Shared.FixedPoint;
using Content.Shared.Temperature;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using System.Linq;
namespace Content.Client.Atmos.Consoles;
[GenerateTypedNameReferences]
public sealed partial class AtmosMonitoringEntryContainer : BoxContainer
{
public AtmosMonitoringConsoleEntry Data;
private readonly IEntityManager _entManager;
private readonly IResourceCache _cache;
public AtmosMonitoringEntryContainer(AtmosMonitoringConsoleEntry data)
{
RobustXamlLoader.Load(this);
_entManager = IoCManager.Resolve<IEntityManager>();
_cache = IoCManager.Resolve<IResourceCache>();
Data = data;
// Modulate colored stripe
NetworkColorStripe.Modulate = data.Color;
// Load fonts
var headerFont = new VectorFont(_cache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Bold.ttf"), 11);
var normalFont = new VectorFont(_cache.GetResource<FontResource>("/Fonts/NotoSansDisplay/NotoSansDisplay-Regular.ttf"), 11);
// Set fonts
TemperatureHeaderLabel.FontOverride = headerFont;
PressureHeaderLabel.FontOverride = headerFont;
TotalMolHeaderLabel.FontOverride = headerFont;
GasesHeaderLabel.FontOverride = headerFont;
TemperatureLabel.FontOverride = normalFont;
PressureLabel.FontOverride = normalFont;
TotalMolLabel.FontOverride = normalFont;
NoDataLabel.FontOverride = headerFont;
}
public void UpdateEntry(AtmosMonitoringConsoleEntry updatedData, bool isFocus)
{
// Load fonts
var normalFont = new VectorFont(_cache.GetResource<FontResource>("/Fonts/NotoSansDisplay/NotoSansDisplay-Regular.ttf"), 11);
// Update name and values
if (!string.IsNullOrEmpty(updatedData.Address))
NetworkNameLabel.Text = Loc.GetString("atmos-alerts-window-alarm-label", ("name", updatedData.EntityName), ("address", updatedData.Address));
else
NetworkNameLabel.Text = Loc.GetString(updatedData.EntityName);
Data = updatedData;
// Modulate colored stripe
NetworkColorStripe.Modulate = Data.Color;
// Focus updates
if (isFocus)
SetAsFocus();
else
RemoveAsFocus();
// Check if powered
if (!updatedData.IsPowered)
{
MainDataContainer.Visible = false;
NoDataLabel.Visible = true;
return;
}
// Set container visibility
MainDataContainer.Visible = true;
NoDataLabel.Visible = false;
// Update temperature
var isNotVacuum = updatedData.TotalMolData > 1e-6f;
var tempK = (FixedPoint2)updatedData.TemperatureData;
var tempC = (FixedPoint2)TemperatureHelpers.KelvinToCelsius(tempK.Float());
TemperatureLabel.Text = isNotVacuum ?
Loc.GetString("atmos-alerts-window-temperature-value", ("valueInC", tempC), ("valueInK", tempK)) :
Loc.GetString("atmos-alerts-window-invalid-value");
TemperatureLabel.FontColorOverride = isNotVacuum ? Color.DarkGray : StyleNano.DisabledFore;
// Update pressure
PressureLabel.Text = Loc.GetString("atmos-alerts-window-pressure-value", ("value", (FixedPoint2)updatedData.PressureData));
PressureLabel.FontColorOverride = isNotVacuum ? Color.DarkGray : StyleNano.DisabledFore;
// Update total mol
TotalMolLabel.Text = Loc.GetString("atmos-alerts-window-total-mol-value", ("value", (FixedPoint2)updatedData.TotalMolData));
TotalMolLabel.FontColorOverride = isNotVacuum ? Color.DarkGray : StyleNano.DisabledFore;
// Update other present gases
GasGridContainer.RemoveAllChildren();
if (updatedData.GasData.Count() == 0)
{
// No gases
var gasLabel = new Label()
{
Text = Loc.GetString("atmos-alerts-window-other-gases-value-nil"),
FontOverride = normalFont,
FontColorOverride = StyleNano.DisabledFore,
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center,
HorizontalExpand = true,
Margin = new Thickness(0, 2, 0, 0),
SetHeight = 24f,
};
GasGridContainer.AddChild(gasLabel);
}
else
{
// Add an entry for each gas
foreach (var (gas, percent) in updatedData.GasData)
{
var gasPercent = (FixedPoint2)0f;
gasPercent = percent * 100f;
var gasAbbreviation = Atmospherics.GasAbbreviations.GetValueOrDefault(gas, Loc.GetString("gas-unknown-abbreviation"));
var gasLabel = new Label()
{
Text = Loc.GetString("atmos-alerts-window-other-gases-value", ("shorthand", gasAbbreviation), ("value", gasPercent)),
FontOverride = normalFont,
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center,
HorizontalExpand = true,
Margin = new Thickness(0, 2, 0, 0),
SetHeight = 24f,
};
GasGridContainer.AddChild(gasLabel);
}
}
}
public void SetAsFocus()
{
FocusButton.AddStyleClass(StyleNano.StyleClassButtonColorGreen);
ArrowTexture.TexturePath = "/Textures/Interface/Nano/inverted_triangle.svg.png";
FocusContainer.Visible = true;
}
public void RemoveAsFocus()
{
FocusButton.RemoveStyleClass(StyleNano.StyleClassButtonColorGreen);
ArrowTexture.TexturePath = "/Textures/Interface/Nano/triangle_right.png";
FocusContainer.Visible = false;
}
}

View File

@@ -0,0 +1,23 @@
using Content.Client.Atmos.UI;
using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.EntitySystems;
using Content.Shared.Atmos.Piping.Binary.Components;
namespace Content.Client.Atmos.EntitySystems;
public sealed class GasPressurePumpSystem : SharedGasPressurePumpSystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<GasPressurePumpComponent, AfterAutoHandleStateEvent>(OnPumpUpdate);
}
private void OnPumpUpdate(Entity<GasPressurePumpComponent> ent, ref AfterAutoHandleStateEvent args)
{
if (UserInterfaceSystem.TryGetOpenUi<GasPressurePumpBoundUserInterface>(ent.Owner, GasPressurePumpUiKey.Key, out var bui))
{
bui.Update();
}
}
}

View File

@@ -1,65 +1,63 @@
using Content.Shared.Atmos;
using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.Piping.Binary.Components;
using Content.Shared.IdentityManagement;
using Content.Shared.Localizations;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface;
namespace Content.Client.Atmos.UI
namespace Content.Client.Atmos.UI;
/// <summary>
/// Initializes a <see cref="GasPressurePumpWindow"/> and updates it when new server messages are received.
/// </summary>
[UsedImplicitly]
public sealed class GasPressurePumpBoundUserInterface : BoundUserInterface
{
/// <summary>
/// Initializes a <see cref="GasPressurePumpWindow"/> and updates it when new server messages are received.
/// </summary>
[UsedImplicitly]
public sealed class GasPressurePumpBoundUserInterface : BoundUserInterface
[ViewVariables]
private const float MaxPressure = Atmospherics.MaxOutputPressure;
[ViewVariables]
private GasPressurePumpWindow? _window;
public GasPressurePumpBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
[ViewVariables]
private const float MaxPressure = Atmospherics.MaxOutputPressure;
}
[ViewVariables]
private GasPressurePumpWindow? _window;
protected override void Open()
{
base.Open();
public GasPressurePumpBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
_window = this.CreateWindow<GasPressurePumpWindow>();
protected override void Open()
{
base.Open();
_window.ToggleStatusButtonPressed += OnToggleStatusButtonPressed;
_window.PumpOutputPressureChanged += OnPumpOutputPressurePressed;
Update();
}
_window = this.CreateWindow<GasPressurePumpWindow>();
public void Update()
{
if (_window == null)
return;
_window.ToggleStatusButtonPressed += OnToggleStatusButtonPressed;
_window.PumpOutputPressureChanged += OnPumpOutputPressurePressed;
}
_window.Title = Identity.Name(Owner, EntMan);
private void OnToggleStatusButtonPressed()
{
if (_window is null) return;
SendMessage(new GasPressurePumpToggleStatusMessage(_window.PumpStatus));
}
if (!EntMan.TryGetComponent(Owner, out GasPressurePumpComponent? pump))
return;
private void OnPumpOutputPressurePressed(string value)
{
var pressure = UserInputParser.TryFloat(value, out var parsed) ? parsed : 0f;
if (pressure > MaxPressure) pressure = MaxPressure;
_window.SetPumpStatus(pump.Enabled);
_window.MaxPressure = pump.MaxTargetPressure;
_window.SetOutputPressure(pump.TargetPressure);
}
SendMessage(new GasPressurePumpChangeOutputPressureMessage(pressure));
}
private void OnToggleStatusButtonPressed()
{
if (_window is null) return;
SendPredictedMessage(new GasPressurePumpToggleStatusMessage(_window.PumpStatus));
}
/// <summary>
/// Update the UI state based on server-sent info
/// </summary>
/// <param name="state"></param>
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
if (_window == null || state is not GasPressurePumpBoundUserInterfaceState cast)
return;
_window.Title = (cast.PumpLabel);
_window.SetPumpStatus(cast.Enabled);
_window.SetOutputPressure(cast.OutputPressure);
}
private void OnPumpOutputPressurePressed(float value)
{
SendPredictedMessage(new GasPressurePumpChangeOutputPressureMessage(value));
}
}

View File

@@ -1,22 +1,18 @@
<DefaultWindow xmlns="https://spacestation14.io"
<controls:FancyWindow xmlns="https://spacestation14.io"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
MinSize="200 120" Title="Pressure Pump">
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
SetSize="340 110" MinSize="340 110" Title="Pressure Pump">
<BoxContainer Orientation="Vertical" Margin="5 5 5 5" SeparationOverride="10">
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<Label Text="{Loc comp-gas-pump-ui-pump-status}"/>
<Control MinSize="5 0" />
<Label Text="{Loc comp-gas-pump-ui-pump-status}" Margin="0 0 5 0"/>
<Button Name="ToggleStatusButton"/>
<Control HorizontalExpand="True"/>
<Button HorizontalAlignment="Right" Name="SetOutputPressureButton" Text="{Loc comp-gas-pump-ui-pump-set-rate}" Disabled="True" Margin="0 0 5 0"/>
<Button Name="SetMaxPressureButton" Text="{Loc comp-gas-pump-ui-pump-set-max}" />
</BoxContainer>
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<Label Text="{Loc comp-gas-pump-ui-pump-output-pressure}"/>
<Control MinSize="5 0" />
<LineEdit Name="PumpPressureOutputInput" MinSize="70 0" />
<Control MinSize="5 0" />
<Button Name="SetMaxPressureButton" Text="{Loc comp-gas-pump-ui-pump-set-max}" />
<Control MinSize="5 0" />
<Control HorizontalExpand="True" />
<Button Name="SetOutputPressureButton" Text="{Loc comp-gas-pump-ui-pump-set-rate}" HorizontalAlignment="Right" Disabled="True"/>
<FloatSpinBox HorizontalExpand="True" Name="PumpPressureOutputInput" MinSize="70 0" />
</BoxContainer>
</BoxContainer>
</DefaultWindow>
</controls:FancyWindow>

View File

@@ -1,14 +1,8 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using Content.Client.Atmos.EntitySystems;
using Content.Client.UserInterface.Controls;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Prototypes;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Localization;
namespace Content.Client.Atmos.UI
{
@@ -16,12 +10,25 @@ namespace Content.Client.Atmos.UI
/// Client-side UI used to control a gas pressure pump.
/// </summary>
[GenerateTypedNameReferences]
public sealed partial class GasPressurePumpWindow : DefaultWindow
public sealed partial class GasPressurePumpWindow : FancyWindow
{
public bool PumpStatus = true;
public event Action? ToggleStatusButtonPressed;
public event Action<string>? PumpOutputPressureChanged;
public event Action<float>? PumpOutputPressureChanged;
public float MaxPressure
{
get => _maxPressure;
set
{
_maxPressure = value;
PumpPressureOutputInput.Value = MathF.Min(value, PumpPressureOutputInput.Value);
}
}
private float _maxPressure = Atmospherics.MaxOutputPressure;
public GasPressurePumpWindow()
{
@@ -30,23 +37,25 @@ namespace Content.Client.Atmos.UI
ToggleStatusButton.OnPressed += _ => SetPumpStatus(!PumpStatus);
ToggleStatusButton.OnPressed += _ => ToggleStatusButtonPressed?.Invoke();
PumpPressureOutputInput.OnTextChanged += _ => SetOutputPressureButton.Disabled = false;
PumpPressureOutputInput.OnValueChanged += _ => SetOutputPressureButton.Disabled = false;
SetOutputPressureButton.OnPressed += _ =>
{
PumpOutputPressureChanged?.Invoke(PumpPressureOutputInput.Text ??= "");
PumpPressureOutputInput.Value = Math.Clamp(PumpPressureOutputInput.Value, 0f, _maxPressure);
PumpOutputPressureChanged?.Invoke(PumpPressureOutputInput.Value);
SetOutputPressureButton.Disabled = true;
};
SetMaxPressureButton.OnPressed += _ =>
{
PumpPressureOutputInput.Text = Atmospherics.MaxOutputPressure.ToString(CultureInfo.CurrentCulture);
PumpPressureOutputInput.Value = _maxPressure;
SetOutputPressureButton.Disabled = false;
};
}
public void SetOutputPressure(float pressure)
{
PumpPressureOutputInput.Text = pressure.ToString(CultureInfo.CurrentCulture);
PumpPressureOutputInput.Value = pressure;
}
public void SetPumpStatus(bool enabled)

View File

@@ -2,6 +2,7 @@ using System.Numerics;
using Content.Client.Chat.Managers;
using Content.Shared.CCVar;
using Content.Shared.Chat;
using Content.Shared.Speech;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
@@ -141,7 +142,12 @@ namespace Content.Client.Chat.UI
Modulate = Color.White;
}
var offset = (-_eyeManager.CurrentEye.Rotation).ToWorldVec() * -EntityVerticalOffset;
var baseOffset = 0f;
if (_entityManager.TryGetComponent<SpeechComponent>(_senderEntity, out var speech))
baseOffset = speech.SpeechBubbleOffset;
var offset = (-_eyeManager.CurrentEye.Rotation).ToWorldVec() * -(EntityVerticalOffset + baseOffset);
var worldPos = _transformSystem.GetWorldPosition(xform) + offset;
var lowerCenter = _eyeManager.WorldToScreen(worldPos) / UIScale;

View File

@@ -12,6 +12,7 @@ using Robust.Shared.Utility;
using System.Linq;
using System.Numerics;
using Content.Shared.FixedPoint;
using Robust.Client.Graphics;
using static Robust.Client.UserInterface.Controls.BoxContainer;
namespace Content.Client.Chemistry.UI
@@ -90,10 +91,40 @@ namespace Content.Client.Chemistry.UI
private ReagentButton MakeReagentButton(string text, ChemMasterReagentAmount amount, ReagentId id, bool isBuffer, string styleClass)
{
var button = new ReagentButton(text, amount, id, isBuffer, styleClass);
button.OnPressed += args
=> OnReagentButtonPressed?.Invoke(args, button);
return button;
var reagentTransferButton = new ReagentButton(text, amount, id, isBuffer, styleClass);
reagentTransferButton.OnPressed += args
=> OnReagentButtonPressed?.Invoke(args, reagentTransferButton);
return reagentTransferButton;
}
/// <summary>
/// Conditionally generates a set of reagent buttons based on the supplied boolean argument.
/// This was moved outside of BuildReagentRow to facilitate conditional logic, stops indentation depth getting out of hand as well.
/// </summary>
private List<ReagentButton> CreateReagentTransferButtons(ReagentId reagent, bool isBuffer, bool addReagentButtons)
{
if (!addReagentButtons)
return new List<ReagentButton>(); // Return an empty list if reagentTransferButton creation is disabled.
var buttonConfigs = new (string text, ChemMasterReagentAmount amount, string styleClass)[]
{
("1", ChemMasterReagentAmount.U1, StyleBase.ButtonOpenBoth),
("5", ChemMasterReagentAmount.U5, StyleBase.ButtonOpenBoth),
("10", ChemMasterReagentAmount.U10, StyleBase.ButtonOpenBoth),
("25", ChemMasterReagentAmount.U25, StyleBase.ButtonOpenBoth),
("50", ChemMasterReagentAmount.U50, StyleBase.ButtonOpenBoth),
("100", ChemMasterReagentAmount.U100, StyleBase.ButtonOpenBoth),
(Loc.GetString("chem-master-window-buffer-all-amount"), ChemMasterReagentAmount.All, StyleBase.ButtonOpenLeft),
};
var buttons = new List<ReagentButton>();
foreach (var (text, amount, styleClass) in buttonConfigs)
{
var reagentTransferButton = MakeReagentButton(text, amount, reagent, isBuffer, styleClass);
buttons.Add(reagentTransferButton);
}
return buttons;
}
/// <summary>
@@ -102,25 +133,36 @@ namespace Content.Client.Chemistry.UI
/// <param name="state">State data sent by the server.</param>
public void UpdateState(BoundUserInterfaceState state)
{
var castState = (ChemMasterBoundUserInterfaceState) state;
var castState = (ChemMasterBoundUserInterfaceState)state;
if (castState.UpdateLabel)
LabelLine = GenerateLabel(castState);
// Ensure the Panel Info is updated, including UI elements for Buffer Volume, Output Container and so on
UpdatePanelInfo(castState);
var output = castState.OutputContainerInfo;
BufferCurrentVolume.Text = $" {castState.BufferCurrentVolume?.Int() ?? 0}u";
InputEjectButton.Disabled = castState.InputContainerInfo is null;
OutputEjectButton.Disabled = output is null;
CreateBottleButton.Disabled = output?.Reagents == null;
CreatePillButton.Disabled = output?.Entities == null;
OutputEjectButton.Disabled = castState.OutputContainerInfo is null;
CreateBottleButton.Disabled = castState.OutputContainerInfo?.Reagents == null;
CreatePillButton.Disabled = castState.OutputContainerInfo?.Entities == null;
UpdateDosageFields(castState);
}
//assign default values for pill and bottle fields.
private void UpdateDosageFields(ChemMasterBoundUserInterfaceState castState)
{
var output = castState.OutputContainerInfo;
var remainingCapacity = output is null ? 0 : (output.MaxVolume - output.CurrentVolume).Int();
var holdsReagents = output?.Reagents != null;
var pillNumberMax = holdsReagents ? 0 : remainingCapacity;
var bottleAmountMax = holdsReagents ? remainingCapacity : 0;
var bufferVolume = castState.BufferCurrentVolume?.Int() ?? 0;
PillDosage.Value = (int)Math.Min(bufferVolume, castState.PillDosageLimit);
PillTypeButtons[castState.SelectedPillType].Pressed = true;
PillNumber.IsValid = x => x >= 0 && x <= pillNumberMax;
PillDosage.IsValid = x => x > 0 && x <= castState.PillDosageLimit;
@@ -130,8 +172,19 @@ namespace Content.Client.Chemistry.UI
PillNumber.Value = pillNumberMax;
if (BottleDosage.Value > bottleAmountMax)
BottleDosage.Value = bottleAmountMax;
}
// Avoid division by zero
if (PillDosage.Value > 0)
{
PillNumber.Value = Math.Min(bufferVolume / PillDosage.Value, pillNumberMax);
}
else
{
PillNumber.Value = 0;
}
BottleDosage.Value = Math.Min(bottleAmountMax, bufferVolume);
}
/// <summary>
/// Generate a product label based on reagents in the buffer.
/// </summary>
@@ -178,46 +231,23 @@ namespace Content.Client.Chemistry.UI
var bufferVol = new Label
{
Text = $"{state.BufferCurrentVolume}u",
StyleClasses = {StyleNano.StyleClassLabelSecondaryColor}
StyleClasses = { StyleNano.StyleClassLabelSecondaryColor }
};
bufferHBox.AddChild(bufferVol);
// initialises rowCount to allow for striped rows
var rowCount = 0;
foreach (var (reagent, quantity) in state.BufferReagents)
{
// Try to get the prototype for the given reagent. This gives us its name.
_prototypeManager.TryIndex(reagent.Prototype, out ReagentPrototype? proto);
var reagentId = reagent;
_prototypeManager.TryIndex(reagentId.Prototype, out ReagentPrototype? proto);
var name = proto?.LocalizedName ?? Loc.GetString("chem-master-window-unknown-reagent-text");
if (proto != null)
{
BufferInfo.Children.Add(new BoxContainer
{
Orientation = LayoutOrientation.Horizontal,
Children =
{
new Label {Text = $"{name}: "},
new Label
{
Text = $"{quantity}u",
StyleClasses = {StyleNano.StyleClassLabelSecondaryColor}
},
// Padding
new Control {HorizontalExpand = true},
MakeReagentButton("1", ChemMasterReagentAmount.U1, reagent, true, StyleBase.ButtonOpenRight),
MakeReagentButton("5", ChemMasterReagentAmount.U5, reagent, true, StyleBase.ButtonOpenBoth),
MakeReagentButton("10", ChemMasterReagentAmount.U10, reagent, true, StyleBase.ButtonOpenBoth),
MakeReagentButton("25", ChemMasterReagentAmount.U25, reagent, true, StyleBase.ButtonOpenBoth),
MakeReagentButton("50", ChemMasterReagentAmount.U50, reagent, true, StyleBase.ButtonOpenBoth),
MakeReagentButton("100", ChemMasterReagentAmount.U100, reagent, true, StyleBase.ButtonOpenBoth),
MakeReagentButton(Loc.GetString("chem-master-window-buffer-all-amount"), ChemMasterReagentAmount.All, reagent, true, StyleBase.ButtonOpenLeft),
}
});
}
var reagentColor = proto?.SubstanceColor ?? default(Color);
BufferInfo.Children.Add(BuildReagentRow(reagentColor, rowCount++, name, reagentId, quantity, true, true));
}
}
private void BuildContainerUI(Control control, ContainerInfo? info, bool addReagentButtons)
{
control.Children.Clear();
@@ -228,104 +258,111 @@ namespace Content.Client.Chemistry.UI
{
Text = Loc.GetString("chem-master-window-no-container-loaded-text")
});
return;
}
else
// Name of the container and its fill status (Ex: 44/100u)
control.Children.Add(new BoxContainer
{
// Name of the container and its fill status (Ex: 44/100u)
control.Children.Add(new BoxContainer
Orientation = LayoutOrientation.Horizontal,
Children =
{
Orientation = LayoutOrientation.Horizontal,
Children =
new Label { Text = $"{info.DisplayName}: " },
new Label
{
new Label {Text = $"{info.DisplayName}: "},
new Label
{
Text = $"{info.CurrentVolume}/{info.MaxVolume}",
StyleClasses = {StyleNano.StyleClassLabelSecondaryColor}
}
Text = $"{info.CurrentVolume}/{info.MaxVolume}",
StyleClasses = { StyleNano.StyleClassLabelSecondaryColor }
}
});
IEnumerable<(string Name, ReagentId Id, FixedPoint2 Quantity)> contents;
if (info.Entities != null)
{
contents = info.Entities.Select(x => (x.Id, default(ReagentId), x.Quantity));
}
else if (info.Reagents != null)
});
// Initialises rowCount to allow for striped rows
var rowCount = 0;
// Handle entities if they are not null
if (info.Entities != null)
{
foreach (var (id, quantity) in info.Entities.Select(x => (x.Id, x.Quantity)))
{
contents = info.Reagents.Select(x =>
{
_prototypeManager.TryIndex(x.Reagent.Prototype, out ReagentPrototype? proto);
var name = proto?.LocalizedName
?? Loc.GetString("chem-master-window-unknown-reagent-text");
return (name, Id: x.Reagent, x.Quantity);
})
.OrderBy(r => r.Item1);
control.Children.Add(BuildReagentRow(default(Color), rowCount++, id, default(ReagentId), quantity, false, addReagentButtons));
}
else
}
// Handle reagents if they are not null
if (info.Reagents != null)
{
foreach (var reagent in info.Reagents)
{
return;
_prototypeManager.TryIndex(reagent.Reagent.Prototype, out ReagentPrototype? proto);
var name = proto?.LocalizedName ?? Loc.GetString("chem-master-window-unknown-reagent-text");
var reagentColor = proto?.SubstanceColor ?? default(Color);
control.Children.Add(BuildReagentRow(reagentColor, rowCount++, name, reagent.Reagent, reagent.Quantity, false, addReagentButtons));
}
foreach (var (name, id, quantity) in contents)
{
var inner = new BoxContainer
{
Orientation = LayoutOrientation.Horizontal,
Children =
{
new Label { Text = $"{name}: " },
new Label
{
Text = $"{quantity}u",
StyleClasses = { StyleNano.StyleClassLabelSecondaryColor },
}
}
};
if (addReagentButtons)
{
var cs = inner.Children;
// Padding
cs.Add(new Control { HorizontalExpand = true });
cs.Add(MakeReagentButton(
"1", ChemMasterReagentAmount.U1, id, false, StyleBase.ButtonOpenRight));
cs.Add(MakeReagentButton(
"5", ChemMasterReagentAmount.U5, id, false, StyleBase.ButtonOpenBoth));
cs.Add(MakeReagentButton(
"10", ChemMasterReagentAmount.U10, id, false, StyleBase.ButtonOpenBoth));
cs.Add(MakeReagentButton(
"25", ChemMasterReagentAmount.U25, id, false, StyleBase.ButtonOpenBoth));
cs.Add(MakeReagentButton(
"50", ChemMasterReagentAmount.U50, id, false, StyleBase.ButtonOpenBoth));
cs.Add(MakeReagentButton(
"100", ChemMasterReagentAmount.U100, id, false, StyleBase.ButtonOpenBoth));
cs.Add(MakeReagentButton(
Loc.GetString("chem-master-window-buffer-all-amount"),
ChemMasterReagentAmount.All, id, false, StyleBase.ButtonOpenLeft));
}
control.Children.Add(inner);
}
}
}
public String LabelLine
/// <summary>
/// Take reagent/entity data and present rows, labels, and buttons appropriately. todo sprites?
/// </summary>
private Control BuildReagentRow(Color reagentColor, int rowCount, string name, ReagentId reagent, FixedPoint2 quantity, bool isBuffer, bool addReagentButtons)
{
get
//Colors rows and sets fallback for reagentcolor to the same as background, this will hide colorPanel for entities hopefully
var rowColor1 = Color.FromHex("#1B1B1E");
var rowColor2 = Color.FromHex("#202025");
var currentRowColor = (rowCount % 2 == 1) ? rowColor1 : rowColor2;
if ((reagentColor == default(Color))|(!addReagentButtons))
{
return LabelLineEdit.Text;
reagentColor = currentRowColor;
}
set
//this calls the separated button builder, and stores the return to render after labels
var reagentButtonConstructors = CreateReagentTransferButtons(reagent, isBuffer, addReagentButtons);
// Create the row layout with the color panel
var rowContainer = new BoxContainer
{
LabelLineEdit.Text = value;
Orientation = LayoutOrientation.Horizontal,
Children =
{
new Label { Text = $"{name}: " },
new Label
{
Text = $"{quantity}u",
StyleClasses = { StyleNano.StyleClassLabelSecondaryColor }
},
// Padding
new Control { HorizontalExpand = true },
// Colored panels for reagents
new PanelContainer
{
Name = "colorPanel",
VerticalExpand = true,
MinWidth = 4,
PanelOverride = new StyleBoxFlat
{
BackgroundColor = reagentColor
},
Margin = new Thickness(0, 1)
}
}
};
// Add the reagent buttons after the color panel
foreach (var reagentTransferButton in reagentButtonConstructors)
{
rowContainer.AddChild(reagentTransferButton);
}
//Apply panencontainer to allow for striped rows
return new PanelContainer
{
PanelOverride = new StyleBoxFlat(currentRowColor),
Children = { rowContainer }
};
}
public string LabelLine
{
get => LabelLineEdit.Text;
set => LabelLineEdit.Text = value;
}
}

View File

@@ -1,17 +1,62 @@
<controls:FancyWindow xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
Title="{Loc 'comms-console-menu-title'}"
MinSize="400 225">
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True" Margin="5">
<TextEdit Name="MessageInput" HorizontalExpand="True" VerticalExpand="True" Margin="0 0 0 5" MinHeight="100" />
<Button Name="AnnounceButton" Text="{Loc 'comms-console-menu-announcement-button'}" ToolTip="{Loc 'comms-console-menu-announcement-button-tooltip'}" StyleClasses="OpenLeft" Access="Public" />
<Button Name="BroadcastButton" Text="{Loc 'comms-console-menu-broadcast-button'}" ToolTip="{Loc 'comms-console-menu-broadcast-button-tooltip'}" StyleClasses="OpenLeft" Access="Public" />
MinSize="400 300">
<OptionButton Name="AlertLevelButton" ToolTip="{Loc 'comms-console-menu-alert-level-button-tooltip'}" StyleClasses="OpenRight" Access="Public" />
<!-- Main Container -->
<BoxContainer Orientation="Vertical"
HorizontalExpand="False"
VerticalExpand="True"
Margin="6 6 6 5">
<Control MinSize="10 10" />
<TextEdit Name="MessageInput"
VerticalExpand="True"
HorizontalExpand="True"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
MinHeight="100"/>
<RichTextLabel Name="CountdownLabel" VerticalExpand="True" />
<Button Name="EmergencyShuttleButton" Text="Placeholder Text" ToolTip="{Loc 'comms-console-menu-emergency-shuttle-button-tooltip'}" Access="Public" />
<!-- ButtonsPart -->
<BoxContainer Orientation="Vertical"
VerticalAlignment="Bottom"
SeparationOverride="4">
<!-- AnnouncePart -->
<BoxContainer Orientation="Vertical"
Margin="0 2">
<Button Name="AnnounceButton"
Access="Public"
Text="{Loc 'comms-console-menu-announcement-button'}"
ToolTip="{Loc 'comms-console-menu-announcement-button-tooltip'}"
StyleClasses="OpenLeft"
Margin="0 0 1 0"
Disabled="True"/>
<Button Name="BroadcastButton"
Access="Public"
Text="{Loc 'comms-console-menu-broadcast-button'}"
ToolTip="{Loc 'comms-console-menu-broadcast-button-tooltip'}"
StyleClasses="OpenBoth"/>
<OptionButton Name="AlertLevelButton"
Access="Public"
ToolTip="{Loc 'comms-console-menu-alert-level-button-tooltip'}"
StyleClasses="OpenRight"/>
</BoxContainer>
<!-- EmergencyPart -->
<BoxContainer Orientation="Vertical"
SeparationOverride="6">
<RichTextLabel Name="CountdownLabel"/>
<Button Name="EmergencyShuttleButton"
Access="Public"
Text="Placeholder Text"
ToolTip="{Loc 'comms-console-menu-emergency-shuttle-button-tooltip'}"/>
</BoxContainer>
</BoxContainer>
</BoxContainer>
</controls:FancyWindow>

View File

@@ -12,6 +12,7 @@ using Content.Client.IoC;
using Content.Client.Launcher;
using Content.Client.Lobby;
using Content.Client.MainMenu;
using Content.Client.Overlays;
using Content.Client.Parallax.Managers;
using Content.Client.Players.PlayTimeTracking;
using Content.Client.Radiation.Overlays;
@@ -159,6 +160,7 @@ namespace Content.Client.Entry
_parallaxManager.LoadDefaultParallax();
_overlayManager.AddOverlay(new CP14BasePostProcessOverlay()); // CP14-PostProcess
_overlayManager.AddOverlay(new SingularityOverlay());
_overlayManager.AddOverlay(new RadiationPulseOverlay());
_chatManager.Initialize();

View File

@@ -0,0 +1,8 @@
using Content.Shared.Explosion.EntitySystems;
namespace Content.Client.Explosion;
public sealed class ScatteringGrenadeSystem : SharedScatteringGrenadeSystem
{
}

View File

@@ -0,0 +1,101 @@
using Content.Shared.Holopad;
using Content.Shared.Silicons.StationAi;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Shared.Player;
using System.Numerics;
namespace Content.Client.Holopad;
public sealed class HolopadBoundUserInterface : BoundUserInterface
{
[Dependency] private readonly ISharedPlayerManager _playerManager = default!;
[Dependency] private readonly IClyde _displayManager = default!;
[ViewVariables]
private HolopadWindow? _window;
public HolopadBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
IoCManager.InjectDependencies(this);
}
protected override void Open()
{
base.Open();
_window = this.CreateWindow<HolopadWindow>();
_window.Title = Loc.GetString("holopad-window-title", ("title", EntMan.GetComponent<MetaDataComponent>(Owner).EntityName));
if (this.UiKey is not HolopadUiKey)
{
Close();
return;
}
var uiKey = (HolopadUiKey)this.UiKey;
// AIs will see a different holopad interface to crew when interacting with them in the world
if (uiKey == HolopadUiKey.InteractionWindow && EntMan.HasComponent<StationAiHeldComponent>(_playerManager.LocalEntity))
uiKey = HolopadUiKey.InteractionWindowForAi;
_window.SetState(Owner, uiKey);
_window.UpdateState(new Dictionary<NetEntity, string>());
// Set message actions
_window.SendHolopadStartNewCallMessageAction += SendHolopadStartNewCallMessage;
_window.SendHolopadAnswerCallMessageAction += SendHolopadAnswerCallMessage;
_window.SendHolopadEndCallMessageAction += SendHolopadEndCallMessage;
_window.SendHolopadStartBroadcastMessageAction += SendHolopadStartBroadcastMessage;
_window.SendHolopadActivateProjectorMessageAction += SendHolopadActivateProjectorMessage;
_window.SendHolopadRequestStationAiMessageAction += SendHolopadRequestStationAiMessage;
// If this call is addressed to an AI, open the window in the bottom right hand corner of the screen
if (uiKey == HolopadUiKey.AiRequestWindow)
_window.OpenCenteredAt(new Vector2(1f, 1f));
// Otherwise offset to the left so the holopad can still be seen
else
_window.OpenCenteredAt(new Vector2(0.3333f, 0.50f));
}
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
var castState = (HolopadBoundInterfaceState)state;
EntMan.TryGetComponent<TransformComponent>(Owner, out var xform);
_window?.UpdateState(castState.Holopads);
}
public void SendHolopadStartNewCallMessage(NetEntity receiver)
{
SendMessage(new HolopadStartNewCallMessage(receiver));
}
public void SendHolopadAnswerCallMessage()
{
SendMessage(new HolopadAnswerCallMessage());
}
public void SendHolopadEndCallMessage()
{
SendMessage(new HolopadEndCallMessage());
}
public void SendHolopadStartBroadcastMessage()
{
SendMessage(new HolopadStartBroadcastMessage());
}
public void SendHolopadActivateProjectorMessage()
{
SendMessage(new HolopadActivateProjectorMessage());
}
public void SendHolopadRequestStationAiMessage()
{
SendMessage(new HolopadStationAiRequestMessage());
}
}

View File

@@ -0,0 +1,172 @@
using Content.Shared.Chat.TypingIndicator;
using Content.Shared.Holopad;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using System.Linq;
namespace Content.Client.Holopad;
public sealed class HolopadSystem : SharedHolopadSystem
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IGameTiming _timing = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<HolopadHologramComponent, ComponentInit>(OnComponentInit);
SubscribeLocalEvent<HolopadHologramComponent, BeforePostShaderRenderEvent>(OnShaderRender);
SubscribeAllEvent<TypingChangedEvent>(OnTypingChanged);
SubscribeNetworkEvent<PlayerSpriteStateRequest>(OnPlayerSpriteStateRequest);
SubscribeNetworkEvent<PlayerSpriteStateMessage>(OnPlayerSpriteStateMessage);
}
private void OnComponentInit(EntityUid uid, HolopadHologramComponent component, ComponentInit ev)
{
if (!TryComp<SpriteComponent>(uid, out var sprite))
return;
UpdateHologramSprite(uid);
}
private void OnShaderRender(EntityUid uid, HolopadHologramComponent component, BeforePostShaderRenderEvent ev)
{
if (ev.Sprite.PostShader == null)
return;
ev.Sprite.PostShader.SetParameter("t", (float)_timing.CurTime.TotalSeconds * component.ScrollRate);
}
private void OnTypingChanged(TypingChangedEvent ev, EntitySessionEventArgs args)
{
var uid = args.SenderSession.AttachedEntity;
if (!Exists(uid))
return;
if (!HasComp<HolopadUserComponent>(uid))
return;
var netEv = new HolopadUserTypingChangedEvent(GetNetEntity(uid.Value), ev.IsTyping);
RaiseNetworkEvent(netEv);
}
private void OnPlayerSpriteStateRequest(PlayerSpriteStateRequest ev)
{
var targetPlayer = GetEntity(ev.TargetPlayer);
var player = _playerManager.LocalSession?.AttachedEntity;
// Ignore the request if received by a player who isn't the target
if (targetPlayer != player)
return;
if (!TryComp<SpriteComponent>(player, out var playerSprite))
return;
var spriteLayerData = new List<PrototypeLayerData>();
if (playerSprite.Visible)
{
// Record the RSI paths, state names and shader paramaters of all visible layers
for (int i = 0; i < playerSprite.AllLayers.Count(); i++)
{
if (!playerSprite.TryGetLayer(i, out var layer))
continue;
if (!layer.Visible ||
string.IsNullOrEmpty(layer.ActualRsi?.Path.ToString()) ||
string.IsNullOrEmpty(layer.State.Name))
continue;
var layerDatum = new PrototypeLayerData();
layerDatum.RsiPath = layer.ActualRsi.Path.ToString();
layerDatum.State = layer.State.Name;
if (layer.CopyToShaderParameters != null)
{
var key = (string)layer.CopyToShaderParameters.LayerKey;
if (playerSprite.LayerMapTryGet(key, out var otherLayerIdx) &&
playerSprite.TryGetLayer(otherLayerIdx, out var otherLayer) &&
otherLayer.Visible)
{
layerDatum.MapKeys = new() { key };
layerDatum.CopyToShaderParameters = new PrototypeCopyToShaderParameters()
{
LayerKey = key,
ParameterTexture = layer.CopyToShaderParameters.ParameterTexture,
ParameterUV = layer.CopyToShaderParameters.ParameterUV
};
}
}
spriteLayerData.Add(layerDatum);
}
}
// Return the recorded data to the server
var evResponse = new PlayerSpriteStateMessage(ev.TargetPlayer, spriteLayerData.ToArray());
RaiseNetworkEvent(evResponse);
}
private void OnPlayerSpriteStateMessage(PlayerSpriteStateMessage ev)
{
UpdateHologramSprite(GetEntity(ev.SpriteEntity), ev.SpriteLayerData);
}
private void UpdateHologramSprite(EntityUid uid, PrototypeLayerData[]? layerData = null)
{
if (!TryComp<SpriteComponent>(uid, out var hologramSprite))
return;
if (!TryComp<HolopadHologramComponent>(uid, out var holopadhologram))
return;
for (int i = hologramSprite.AllLayers.Count() - 1; i >= 0; i--)
hologramSprite.RemoveLayer(i);
if (layerData == null || layerData.Length == 0)
{
layerData = new PrototypeLayerData[1];
layerData[0] = new PrototypeLayerData()
{
RsiPath = holopadhologram.RsiPath,
State = holopadhologram.RsiState
};
}
for (int i = 0; i < layerData.Length; i++)
{
var layer = layerData[i];
layer.Shader = "unshaded";
hologramSprite.AddLayer(layerData[i], i);
}
UpdateHologramShader(uid, hologramSprite, holopadhologram);
}
private void UpdateHologramShader(EntityUid uid, SpriteComponent sprite, HolopadHologramComponent holopadHologram)
{
// Find the texture height of the largest layer
float texHeight = sprite.AllLayers.Max(x => x.PixelSize.Y);
var instance = _prototypeManager.Index<ShaderPrototype>(holopadHologram.ShaderName).InstanceUnique();
instance.SetParameter("color1", new Vector3(holopadHologram.Color1.R, holopadHologram.Color1.G, holopadHologram.Color1.B));
instance.SetParameter("color2", new Vector3(holopadHologram.Color2.R, holopadHologram.Color2.G, holopadHologram.Color2.B));
instance.SetParameter("alpha", holopadHologram.Alpha);
instance.SetParameter("intensity", holopadHologram.Intensity);
instance.SetParameter("texHeight", texHeight);
instance.SetParameter("t", (float)_timing.CurTime.TotalSeconds * holopadHologram.ScrollRate);
sprite.PostShader = instance;
sprite.RaiseShaderEvent = true;
}
}

View File

@@ -0,0 +1,118 @@
<controls:FancyWindow xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
Resizable="False"
MaxSize="400 800"
MinSize="400 150">
<BoxContainer Orientation="Vertical" VerticalExpand="True" HorizontalExpand="True">
<BoxContainer Name="ControlsLockOutContainer" Orientation="Vertical" VerticalExpand="True" HorizontalExpand="True" ReservesSpace="False" Visible="False">
<!-- Header text -->
<controls:StripeBack>
<PanelContainer>
<RichTextLabel Name="EmergencyBroadcastText" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="10 10 10 10" ReservesSpace="False"/>
</PanelContainer>
</controls:StripeBack>
<Label Text="{Loc 'holopad-window-controls-locked-out'}" HorizontalAlignment="Center" Margin="10 5 10 0" ReservesSpace="False"/>
<RichTextLabel Name="LockOutIdText" HorizontalAlignment="Center" Margin="10 5 10 0" ReservesSpace="False"/>
<Label Name="LockOutCountDownText" Text="{Loc 'holopad-window-controls-unlock-countdown'}" HorizontalAlignment="Center" Margin="10 15 10 10" ReservesSpace="False"/>
</BoxContainer>
<BoxContainer Name="ControlsContainer" Orientation="Vertical" VerticalExpand="True" HorizontalExpand="True" ReservesSpace="False">
<!-- Active call controls (either this or the call placement controls will be active) -->
<BoxContainer Name="ActiveCallControlsContainer" Orientation="Vertical" VerticalExpand="True" HorizontalExpand="True" ReservesSpace="False">
<!-- Header text -->
<BoxContainer MinHeight="60" Orientation="Vertical" VerticalAlignment="Center">
<Label Name="CallStatusText" Margin="10 5 10 0" ReservesSpace="False"/>
<BoxContainer Name="CallerIdContainer" Orientation="Vertical" ReservesSpace="False">
<RichTextLabel Name="CallerIdText" HorizontalAlignment="Center" Margin="0 0 0 0"/>
<Label Text="{Loc 'holopad-window-relay-label'}" Margin="10 5 10 0" ReservesSpace="False"/>
<RichTextLabel Name="HolopadIdText" HorizontalAlignment="Center" Margin="0 0 0 10"/>
</BoxContainer>
</BoxContainer>
<!-- Controls (the answer call button is absent when the phone is not ringing) -->
<GridContainer Columns="2" ReservesSpace="False">
<Control HorizontalExpand="True" Margin="10 0 2 5">
<Button Name="AnswerCallButton" Text="{Loc 'holopad-window-answer-call'}" StyleClasses="OpenRight" Margin="0 0 0 5" Disabled="True"/>
</Control>
<Control HorizontalExpand="True" Margin="2 0 10 5">
<Button Name="EndCallButton" Text="{Loc 'holopad-window-end-call'}" StyleClasses="OpenLeft" Margin="0 0 0 5" Disabled="True"/>
</Control>
</GridContainer>
</BoxContainer>
<!-- Call placement controls (either this or the active call controls will be active) -->
<BoxContainer Name="CallPlacementControlsContainer" Orientation="Vertical" VerticalExpand="True" HorizontalExpand="True" ReservesSpace="False">
<controls:StripeBack>
<PanelContainer>
<BoxContainer Orientation="Vertical">
<RichTextLabel Name="SubtitleText" HorizontalAlignment="Center" Margin="0 5 0 0"/>
<RichTextLabel Name="OptionsText" HorizontalAlignment="Center" Margin="0 0 0 5"/>
</BoxContainer>
</PanelContainer>
</controls:StripeBack>
<!-- Request the station AI or activate the holopad projector (only one of these should be active at a time) -->
<BoxContainer Name="RequestStationAiContainer" Orientation="Vertical" ReservesSpace="False" Visible="False">
<Button Name="RequestStationAiButton" Text="{Loc 'holopad-window-request-station-ai'}" Margin="10 5 10 5" Disabled="False"/>
</BoxContainer>
<BoxContainer Name="ActivateProjectorContainer" Orientation="Vertical" ReservesSpace="False" Visible="False">
<Button Name="ActivateProjectorButton" Text="{Loc 'holopad-window-activate-projector'}" Margin="10 5 10 5" Disabled="False"/>
</BoxContainer>
<!-- List of contactable holopads (the list is created in C#) -->
<BoxContainer Name="HolopadContactListContainer" Orientation="Vertical" Margin="10 0 10 5" ReservesSpace="False" Visible="False">
<PanelContainer Name="HolopadContactListHeaderPanel">
<Label Text="{Loc 'holopad-window-select-contact-from-list'}" HorizontalAlignment="Center" Margin="0 3 0 3"/>
</PanelContainer>
<PanelContainer Name="HolopadContactListPanel">
<BoxContainer Orientation="Vertical">
<!-- Contact filter -->
<LineEdit Name="SearchLineEdit" HorizontalExpand="True" Margin="4, 4, 4, 0"
PlaceHolder="{Loc holopad-window-filter-line-placeholder}" />
<ScrollContainer HorizontalExpand="True" VerticalExpand="True" Margin="8, 8, 8, 8" MinHeight="256">
<!-- If there is no data yet, this will be displayed -->
<BoxContainer Name="FetchingAvailableHolopadsContainer" HorizontalAlignment="Center" HorizontalExpand="True" VerticalExpand="True" ReservesSpace="False">
<Label Text="{Loc 'holopad-window-fetching-contacts-list'}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</BoxContainer>
<!-- Container for the contacts -->
<BoxContainer Name="ContactsList" Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True" Margin="10 0 10 0"/>
</ScrollContainer>
</BoxContainer>
</PanelContainer>
</BoxContainer>
<!-- Button to start an emergency broadcast (the user requires a certain level of access to interact with it) -->
<BoxContainer Name="StartBroadcastContainer" Orientation="Vertical" ReservesSpace="False" Visible="False">
<Button Name="StartBroadcastButton" Text="{Loc 'holopad-window-emergency-broadcast'}" Margin="10 0 10 5" Disabled="False" ReservesSpace="False"/>
</BoxContainer>
</BoxContainer>
</BoxContainer>
<!-- Footer -->
<BoxContainer Orientation="Vertical">
<PanelContainer StyleClasses="LowDivider" />
<BoxContainer Orientation="Horizontal" Margin="10 2 5 0" VerticalAlignment="Bottom">
<Label Text="{Loc 'holopad-window-flavor-left'}" StyleClasses="WindowFooterText" />
<Label Text="{Loc 'holopad-window-flavor-right'}" StyleClasses="WindowFooterText"
HorizontalAlignment="Right" HorizontalExpand="True" Margin="0 0 5 0" />
<TextureRect StyleClasses="NTLogoDark" Stretch="KeepAspectCentered"
VerticalAlignment="Center" HorizontalAlignment="Right" SetSize="19 19"/>
</BoxContainer>
</BoxContainer>
</BoxContainer>
</controls:FancyWindow>

View File

@@ -0,0 +1,344 @@
using Content.Client.Popups;
using Content.Client.UserInterface.Controls;
using Content.Shared.Access.Systems;
using Content.Shared.Holopad;
using Content.Shared.Telephone;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using System.Linq;
namespace Content.Client.Holopad;
[GenerateTypedNameReferences]
public sealed partial class HolopadWindow : FancyWindow
{
[Dependency] private readonly IEntityManager _entManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IGameTiming _timing = default!;
private readonly SharedHolopadSystem _holopadSystem = default!;
private readonly SharedTelephoneSystem _telephoneSystem = default!;
private readonly AccessReaderSystem _accessReaderSystem = default!;
private readonly PopupSystem _popupSystem = default!;
private EntityUid? _owner = null;
private HolopadUiKey _currentUiKey;
private TelephoneState _currentState;
private TelephoneState _previousState;
private TimeSpan _buttonUnlockTime;
private float _updateTimer = 0.25f;
private const float UpdateTime = 0.25f;
private TimeSpan _buttonUnlockDelay = TimeSpan.FromSeconds(0.5f);
public event Action<NetEntity>? SendHolopadStartNewCallMessageAction;
public event Action? SendHolopadAnswerCallMessageAction;
public event Action? SendHolopadEndCallMessageAction;
public event Action? SendHolopadStartBroadcastMessageAction;
public event Action? SendHolopadActivateProjectorMessageAction;
public event Action? SendHolopadRequestStationAiMessageAction;
public HolopadWindow()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
_holopadSystem = _entManager.System<SharedHolopadSystem>();
_telephoneSystem = _entManager.System<SharedTelephoneSystem>();
_accessReaderSystem = _entManager.System<AccessReaderSystem>();
_popupSystem = _entManager.System<PopupSystem>();
_buttonUnlockTime = _timing.CurTime + _buttonUnlockDelay;
// Assign button actions
AnswerCallButton.OnPressed += args => { OnHolopadAnswerCallMessage(); };
EndCallButton.OnPressed += args => { OnHolopadEndCallMessage(); };
StartBroadcastButton.OnPressed += args => { OnHolopadStartBroadcastMessage(); };
ActivateProjectorButton.OnPressed += args => { OnHolopadActivateProjectorMessage(); };
RequestStationAiButton.OnPressed += args => { OnHolopadRequestStationAiMessage(); };
// XML formatting
AnswerCallButton.AddStyleClass("ButtonAccept");
EndCallButton.AddStyleClass("Caution");
StartBroadcastButton.AddStyleClass("Caution");
HolopadContactListPanel.PanelOverride = new StyleBoxFlat
{
BackgroundColor = new Color(47, 47, 59) * Color.DarkGray,
BorderColor = new Color(82, 82, 82), //new Color(70, 73, 102),
BorderThickness = new Thickness(2),
};
HolopadContactListHeaderPanel.PanelOverride = new StyleBoxFlat
{
BackgroundColor = new Color(82, 82, 82),
};
EmergencyBroadcastText.SetMessage(FormattedMessage.FromMarkupOrThrow(Loc.GetString("holopad-window-emergency-broadcast-in-progress")));
SubtitleText.SetMessage(FormattedMessage.FromMarkupOrThrow(Loc.GetString("holopad-window-subtitle")));
OptionsText.SetMessage(FormattedMessage.FromMarkupOrThrow(Loc.GetString("holopad-window-options")));
}
#region: Button actions
private void OnSendHolopadStartNewCallMessage(NetEntity receiver)
{
SendHolopadStartNewCallMessageAction?.Invoke(receiver);
}
private void OnHolopadAnswerCallMessage()
{
SendHolopadAnswerCallMessageAction?.Invoke();
}
private void OnHolopadEndCallMessage()
{
SendHolopadEndCallMessageAction?.Invoke();
if (_currentUiKey == HolopadUiKey.AiRequestWindow)
Close();
}
private void OnHolopadStartBroadcastMessage()
{
if (_playerManager.LocalSession?.AttachedEntity == null || _owner == null)
return;
var player = _playerManager.LocalSession.AttachedEntity;
if (!_accessReaderSystem.IsAllowed(player.Value, _owner.Value))
{
_popupSystem.PopupClient(Loc.GetString("holopad-window-access-denied"), _owner.Value, player.Value);
return;
}
SendHolopadStartBroadcastMessageAction?.Invoke();
}
private void OnHolopadActivateProjectorMessage()
{
SendHolopadActivateProjectorMessageAction?.Invoke();
}
private void OnHolopadRequestStationAiMessage()
{
SendHolopadRequestStationAiMessageAction?.Invoke();
}
#endregion
public void SetState(EntityUid owner, HolopadUiKey uiKey)
{
_owner = owner;
_currentUiKey = uiKey;
// Determines what UI containers are available to the user.
// Components of these will be toggled on and off when
// UpdateAppearance() is called
switch (uiKey)
{
case HolopadUiKey.InteractionWindow:
RequestStationAiContainer.Visible = true;
HolopadContactListContainer.Visible = true;
StartBroadcastContainer.Visible = true;
break;
case HolopadUiKey.InteractionWindowForAi:
ActivateProjectorContainer.Visible = true;
StartBroadcastContainer.Visible = true;
break;
case HolopadUiKey.AiActionWindow:
HolopadContactListContainer.Visible = true;
StartBroadcastContainer.Visible = true;
break;
case HolopadUiKey.AiRequestWindow:
break;
}
}
public void UpdateState(Dictionary<NetEntity, string> holopads)
{
if (_owner == null || !_entManager.TryGetComponent<TelephoneComponent>(_owner.Value, out var telephone))
return;
// Caller ID text
var callerId = _telephoneSystem.GetFormattedCallerIdForEntity(telephone.LastCallerId.Item1, telephone.LastCallerId.Item2, Color.LightGray, "Default", 11);
var holoapdId = _telephoneSystem.GetFormattedDeviceIdForEntity(telephone.LastCallerId.Item3, Color.LightGray, "Default", 11);
CallerIdText.SetMessage(FormattedMessage.FromMarkupOrThrow(callerId));
HolopadIdText.SetMessage(FormattedMessage.FromMarkupOrThrow(holoapdId));
LockOutIdText.SetMessage(FormattedMessage.FromMarkupOrThrow(callerId));
// Sort holopads alphabetically
var holopadArray = holopads.ToArray();
Array.Sort(holopadArray, AlphabeticalSort);
// Clear excess children from the contact list
while (ContactsList.ChildCount > holopadArray.Length)
ContactsList.RemoveChild(ContactsList.GetChild(ContactsList.ChildCount - 1));
// Make / update required children
for (int i = 0; i < holopadArray.Length; i++)
{
var (netEntity, label) = holopadArray[i];
if (i >= ContactsList.ChildCount)
{
var newContactButton = new HolopadContactButton();
newContactButton.OnPressed += args => { OnSendHolopadStartNewCallMessage(newContactButton.NetEntity); };
ContactsList.AddChild(newContactButton);
}
var child = ContactsList.GetChild(i);
if (child is not HolopadContactButton)
continue;
var contactButton = (HolopadContactButton)child;
contactButton.UpdateValues(netEntity, label);
}
// Update buttons
UpdateAppearance();
}
private void UpdateAppearance()
{
if (_owner == null || !_entManager.TryGetComponent<TelephoneComponent>(_owner.Value, out var telephone))
return;
if (_owner == null || !_entManager.TryGetComponent<HolopadComponent>(_owner.Value, out var holopad))
return;
var hasBroadcastAccess = !_holopadSystem.IsHolopadBroadcastOnCoolDown((_owner.Value, holopad));
var localPlayer = _playerManager.LocalSession?.AttachedEntity;
ControlsLockOutContainer.Visible = _holopadSystem.IsHolopadControlLocked((_owner.Value, holopad), localPlayer);
ControlsContainer.Visible = !ControlsLockOutContainer.Visible;
// Temporarily disable the interface buttons when the call state changes to prevent any misclicks
if (_currentState != telephone.CurrentState)
{
_previousState = _currentState;
_currentState = telephone.CurrentState;
_buttonUnlockTime = _timing.CurTime + _buttonUnlockDelay;
}
var lockButtons = _timing.CurTime < _buttonUnlockTime;
// Make / update required children
foreach (var child in ContactsList.Children)
{
if (child is not HolopadContactButton contactButton)
continue;
var passesFilter = string.IsNullOrEmpty(SearchLineEdit.Text) ||
contactButton.Text?.Contains(SearchLineEdit.Text, StringComparison.CurrentCultureIgnoreCase) == true;
contactButton.Visible = passesFilter;
contactButton.Disabled = (_currentState != TelephoneState.Idle || lockButtons);
}
// Update control text
var cooldown = _holopadSystem.GetHolopadBroadcastCoolDown((_owner.Value, holopad));
var cooldownString = $"{cooldown.Minutes:00}:{cooldown.Seconds:00}";
StartBroadcastButton.Text = _holopadSystem.IsHolopadBroadcastOnCoolDown((_owner.Value, holopad)) ?
Loc.GetString("holopad-window-emergency-broadcast-with-countdown", ("countdown", cooldownString)) :
Loc.GetString("holopad-window-emergency-broadcast");
var lockout = _holopadSystem.GetHolopadControlLockedPeriod((_owner.Value, holopad));
var lockoutString = $"{lockout.Minutes:00}:{lockout.Seconds:00}";
LockOutCountDownText.Text = Loc.GetString("holopad-window-controls-unlock-countdown", ("countdown", lockoutString));
switch (_currentState)
{
case TelephoneState.Idle:
CallStatusText.Text = Loc.GetString("holopad-window-no-calls-in-progress"); break;
case TelephoneState.Calling:
CallStatusText.Text = Loc.GetString("holopad-window-outgoing-call"); break;
case TelephoneState.Ringing:
CallStatusText.Text = (_currentUiKey == HolopadUiKey.AiRequestWindow) ?
Loc.GetString("holopad-window-ai-request") : Loc.GetString("holopad-window-incoming-call"); break;
case TelephoneState.InCall:
CallStatusText.Text = Loc.GetString("holopad-window-call-in-progress"); break;
case TelephoneState.EndingCall:
if (_previousState == TelephoneState.Calling || _previousState == TelephoneState.Idle)
CallStatusText.Text = Loc.GetString("holopad-window-call-rejected");
else
CallStatusText.Text = Loc.GetString("holopad-window-call-ending");
break;
}
// Update control disability
AnswerCallButton.Disabled = (_currentState != TelephoneState.Ringing || lockButtons);
EndCallButton.Disabled = (_currentState == TelephoneState.Idle || _currentState == TelephoneState.EndingCall || lockButtons);
StartBroadcastButton.Disabled = (_currentState != TelephoneState.Idle || !hasBroadcastAccess || lockButtons);
RequestStationAiButton.Disabled = (_currentState != TelephoneState.Idle || lockButtons);
ActivateProjectorButton.Disabled = (_currentState != TelephoneState.Idle || lockButtons);
// Update control visibility
FetchingAvailableHolopadsContainer.Visible = (ContactsList.ChildCount == 0);
ActiveCallControlsContainer.Visible = (_currentState != TelephoneState.Idle || _currentUiKey == HolopadUiKey.AiRequestWindow);
CallPlacementControlsContainer.Visible = !ActiveCallControlsContainer.Visible;
CallerIdContainer.Visible = (_currentState == TelephoneState.Ringing);
AnswerCallButton.Visible = (_currentState == TelephoneState.Ringing);
}
protected override void FrameUpdate(FrameEventArgs args)
{
base.FrameUpdate(args);
_updateTimer += args.DeltaSeconds;
if (_updateTimer >= UpdateTime)
{
_updateTimer -= UpdateTime;
UpdateAppearance();
}
}
private sealed class HolopadContactButton : Button
{
public NetEntity NetEntity;
public HolopadContactButton()
{
HorizontalExpand = true;
SetHeight = 32;
Margin = new Thickness(0f, 1f, 0f, 1f);
ReservesSpace = false;
}
public void UpdateValues(NetEntity netEntity, string label)
{
NetEntity = netEntity;
Text = Loc.GetString("holopad-window-contact-label", ("label", label));
}
}
private int AlphabeticalSort(KeyValuePair<NetEntity, string> x, KeyValuePair<NetEntity, string> y)
{
if (string.IsNullOrEmpty(x.Value))
return -1;
if (string.IsNullOrEmpty(y.Value))
return 1;
return x.Value.CompareTo(y.Value);
}
}

View File

@@ -455,7 +455,21 @@ public sealed class LobbyUIController : UIController, IOnStateEntered<LobbyState
{
EntityUid dummyEnt;
if (humanoid is not null)
EntProtoId? previewEntity = null;
if (humanoid != null && jobClothes)
{
job ??= GetPreferredJob(humanoid);
previewEntity = job.JobPreviewEntity ?? (EntProtoId?)job?.JobEntity;
}
if (previewEntity != null)
{
// Special type like borg or AI, do not spawn a human just spawn the entity.
dummyEnt = EntityManager.SpawnEntity(previewEntity, MapCoordinates.Nullspace);
return dummyEnt;
}
else if (humanoid is not null)
{
var dummy = _prototypeManager.Index<SpeciesPrototype>(humanoid.Species).DollPrototype;
dummyEnt = EntityManager.SpawnEntity(dummy, MapCoordinates.Nullspace);
@@ -469,7 +483,8 @@ public sealed class LobbyUIController : UIController, IOnStateEntered<LobbyState
if (humanoid != null && jobClothes)
{
job ??= GetPreferredJob(humanoid);
DebugTools.Assert(job != null);
GiveDummyJobClothes(dummyEnt, humanoid, job);
if (_prototypeManager.HasIndex<RoleLoadoutPrototype>(LoadoutSystem.GetJobPrototype(job.ID)))

View File

@@ -6,6 +6,7 @@
SeparationOverride="0"
Name="InternalHBox">
<SpriteView Scale="2 2"
Margin="0 4 4 4"
OverrideDirection="South"
Name="View"/>
<Label Name="DescriptionLabel"

View File

@@ -140,7 +140,7 @@
</BoxContainer>
<!-- Right side -->
<BoxContainer Orientation="Vertical" VerticalExpand="True" VerticalAlignment="Center">
<SpriteView Name="SpriteView" Scale="8 8" SizeFlagsStretchRatio="1" />
<SpriteView Name="SpriteView" Scale="8 8" Margin="4" SizeFlagsStretchRatio="1" />
<BoxContainer Orientation="Horizontal" HorizontalAlignment="Center" Margin="0 5">
<Button Name="SpriteRotateLeft" Text="◀" StyleClasses="OpenRight" />
<cc:VSeparator Margin="2 0 3 0" />

View File

@@ -0,0 +1,46 @@
using Content.Shared.Movement.Components;
using Content.Shared.Movement.Systems;
using Robust.Client.GameObjects;
using Robust.Shared.Timing;
namespace Content.Client.Movement.Systems;
/// <summary>
/// Controls the switching of motion and standing still animation
/// </summary>
public sealed class ClientSpriteMovementSystem : SharedSpriteMovementSystem
{
[Dependency] private readonly IGameTiming _timing = default!;
private EntityQuery<SpriteComponent> _spriteQuery;
public override void Initialize()
{
base.Initialize();
_spriteQuery = GetEntityQuery<SpriteComponent>();
SubscribeLocalEvent<SpriteMovementComponent, AfterAutoHandleStateEvent>(OnAfterAutoHandleState);
}
private void OnAfterAutoHandleState(Entity<SpriteMovementComponent> ent, ref AfterAutoHandleStateEvent args)
{
if (!_spriteQuery.TryGetComponent(ent, out var sprite))
return;
if (ent.Comp.IsMoving)
{
foreach (var (layer, state) in ent.Comp.MovementLayers)
{
sprite.LayerSetData(layer, state);
}
}
else
{
foreach (var (layer, state) in ent.Comp.NoMovementLayers)
{
sprite.LayerSetData(layer, state);
}
}
}
}

View File

@@ -1,51 +0,0 @@
using Content.Shared.Movement.Components;
using Content.Shared.Movement.Events;
using Content.Shared.Movement.Systems;
using Robust.Client.GameObjects;
using Robust.Shared.Timing;
namespace Content.Client.Movement.Systems;
/// <summary>
/// Handles setting sprite states based on whether an entity has movement input.
/// </summary>
public sealed class SpriteMovementSystem : EntitySystem
{
[Dependency] private readonly IGameTiming _timing = default!;
private EntityQuery<SpriteComponent> _spriteQuery;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SpriteMovementComponent, MoveInputEvent>(OnSpriteMoveInput);
_spriteQuery = GetEntityQuery<SpriteComponent>();
}
private void OnSpriteMoveInput(EntityUid uid, SpriteMovementComponent component, ref MoveInputEvent args)
{
if (!_timing.IsFirstTimePredicted)
return;
var oldMoving = (SharedMoverController.GetNormalizedMovement(args.OldMovement) & MoveButtons.AnyDirection) != MoveButtons.None;
var moving = (SharedMoverController.GetNormalizedMovement(args.Entity.Comp.HeldMoveButtons) & MoveButtons.AnyDirection) != MoveButtons.None;
if (oldMoving == moving || !_spriteQuery.TryGetComponent(uid, out var sprite))
return;
if (moving)
{
foreach (var (layer, state) in component.MovementLayers)
{
sprite.LayerSetData(layer, state);
}
}
else
{
foreach (var (layer, state) in component.NoMovementLayers)
{
sprite.LayerSetData(layer, state);
}
}
}
}

View File

@@ -9,6 +9,7 @@ using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Utility;
using Robust.Client.UserInterface.RichText;
using Content.Client.UserInterface.RichText;
using Robust.Shared.Input;
namespace Content.Client.Paper.UI
@@ -43,7 +44,8 @@ namespace Content.Client.Paper.UI
typeof(BulletTag),
typeof(ColorTag),
typeof(HeadingTag),
typeof(ItalicTag)
typeof(ItalicTag),
typeof(MonoTag)
};
public event Action<string>? OnSaved;

View File

@@ -385,26 +385,6 @@ public partial class NavMapControl : MapGridControl
if (PostWallDrawingAction != null)
PostWallDrawingAction.Invoke(handle);
// Beacons
if (_beacons.Pressed)
{
var rectBuffer = new Vector2(5f, 3f);
// Calculate font size for current zoom level
var fontSize = (int) Math.Round(1 / WorldRange * DefaultDisplayedRange * UIScale * _targetFontsize, 0);
var font = new VectorFont(_cache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Bold.ttf"), fontSize);
foreach (var beacon in _navMap.Beacons.Values)
{
var position = beacon.Position - offset;
position = ScalePosition(position with { Y = -position.Y });
var textDimensions = handle.GetDimensions(font, beacon.Text, 1f);
handle.DrawRect(new UIBox2(position - textDimensions / 2 - rectBuffer, position + textDimensions / 2 + rectBuffer), BackgroundColor);
handle.DrawString(font, position - textDimensions / 2, beacon.Text, beacon.Color);
}
}
var curTime = Timing.RealTime;
var blinkFrequency = 1f / 1f;
var lit = curTime.TotalSeconds % blinkFrequency > blinkFrequency / 2f;
@@ -443,11 +423,31 @@ public partial class NavMapControl : MapGridControl
position = ScalePosition(new Vector2(position.X, -position.Y));
var scalingCoefficient = MinmapScaleModifier * float.Sqrt(MinimapScale);
var positionOffset = new Vector2(scalingCoefficient * blip.Texture.Width, scalingCoefficient * blip.Texture.Height);
var positionOffset = new Vector2(scalingCoefficient * blip.Scale * blip.Texture.Width, scalingCoefficient * blip.Scale * blip.Texture.Height);
handle.DrawTextureRect(blip.Texture, new UIBox2(position - positionOffset, position + positionOffset), blip.Color);
}
}
// Beacons
if (_beacons.Pressed)
{
var rectBuffer = new Vector2(5f, 3f);
// Calculate font size for current zoom level
var fontSize = (int)Math.Round(1 / WorldRange * DefaultDisplayedRange * UIScale * _targetFontsize, 0);
var font = new VectorFont(_cache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Bold.ttf"), fontSize);
foreach (var beacon in _navMap.Beacons.Values)
{
var position = beacon.Position - offset;
position = ScalePosition(position with { Y = -position.Y });
var textDimensions = handle.GetDimensions(font, beacon.Text, 1f);
handle.DrawRect(new UIBox2(position - textDimensions / 2 - rectBuffer, position + textDimensions / 2 + rectBuffer), BackgroundColor);
handle.DrawString(font, position - textDimensions / 2, beacon.Text, beacon.Color);
}
}
}
protected override void FrameUpdate(FrameEventArgs args)
@@ -689,6 +689,9 @@ public partial class NavMapControl : MapGridControl
Vector2i foundTermius;
Vector2i foundOrigin;
if (origin == terminus)
return;
// Does our new line end at the beginning of an existing line?
if (lookup.Remove(terminus, out foundTermius))
{
@@ -739,13 +742,15 @@ public struct NavMapBlip
public Color Color;
public bool Blinks;
public bool Selectable;
public float Scale;
public NavMapBlip(EntityCoordinates coordinates, Texture texture, Color color, bool blinks, bool selectable = true)
public NavMapBlip(EntityCoordinates coordinates, Texture texture, Color color, bool blinks, bool selectable = true, float scale = 1f)
{
Coordinates = coordinates;
Texture = texture;
Color = color;
Blinks = blinks;
Selectable = selectable;
Scale = scale;
}
}

View File

@@ -6,6 +6,7 @@ using Robust.Shared.Utility;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Numerics;
using Vector4 = Robust.Shared.Maths.Vector4;
namespace Content.Client.Power;
@@ -104,6 +105,26 @@ public sealed partial class PowerMonitoringWindow
// Update power value
// Don't use SI prefixes, just give the number in W, so that it is readily apparent which consumer is using a lot of power.
button.PowerValue.Text = Loc.GetString("power-monitoring-window-button-value", ("value", Math.Round(entry.PowerValue).ToString("N0")));
// Update battery level if applicable
if (entry.BatteryLevel != null)
{
button.BatteryLevel.Value = entry.BatteryLevel.Value;
button.BatteryLevel.Visible = true;
button.BatteryPercentage.Text = entry.BatteryLevel.Value.ToString("P0");
button.BatteryPercentage.Visible = true;
// Set progress bar color based on percentage
var color = Color.FromHsv(new Vector4(entry.BatteryLevel.Value * 0.33f, 1, 1, 1));
button.BatteryLevel.ForegroundStyleBoxOverride = new StyleBoxFlat { BackgroundColor = color };
}
else
{
button.BatteryLevel.Visible = false;
button.BatteryPercentage.Visible = false;
}
}
private void UpdateEntrySourcesOrLoads(BoxContainer masterContainer, BoxContainer currentContainer, PowerMonitoringConsoleEntry[]? entries, SpriteSpecifier.Texture icon)
@@ -443,6 +464,11 @@ public sealed class PowerMonitoringButton : Button
public BoxContainer MainContainer;
public TextureRect TextureRect;
public Label NameLocalized;
public ProgressBar BatteryLevel;
public PanelContainer BackgroundPanel;
public Label BatteryPercentage;
public Label PowerValue;
public PowerMonitoringButton()
@@ -478,6 +504,49 @@ public sealed class PowerMonitoringButton : Button
MainContainer.AddChild(NameLocalized);
BatteryLevel = new ProgressBar()
{
SetWidth = 47f,
SetHeight = 20f,
Margin = new Thickness(15, 0, 0, 0),
MaxValue = 1,
Visible = false,
BackgroundStyleBoxOverride = new StyleBoxFlat { BackgroundColor = Color.Black },
};
MainContainer.AddChild(BatteryLevel);
BackgroundPanel = new PanelContainer
{
// Draw a half-transparent box over the battery level to make the text more readable.
PanelOverride = new StyleBoxFlat
{
BackgroundColor = new Color(0, 0, 0, 0.9f)
},
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center,
HorizontalExpand = true,
VerticalExpand = true,
// Box is undersized perfectly compared to the progress bar, so a little bit of the unaffected progress bar is visible.
SetSize = new Vector2(43f, 16f)
};
BatteryLevel.AddChild(BackgroundPanel);
BatteryPercentage = new Label()
{
VerticalAlignment = VAlignment.Center,
HorizontalAlignment = HAlignment.Center,
Align = Label.AlignMode.Center,
SetWidth = 45f,
MinWidth = 20f,
Margin = new Thickness(10, -4, 10, 0),
ClipText = true,
Visible = false,
};
BackgroundPanel.AddChild(BatteryPercentage);
PowerValue = new Label()
{
HorizontalAlignment = HAlignment.Right,

View File

@@ -110,7 +110,7 @@ namespace Content.Client.Sandbox
}
// Try copy tile.
if (!_map.TryFindGridAt(_transform.ToMapCoordinates(coords), out var gridUid, out var grid) || !_mapSystem.TryGetTileRef(gridUid, grid, coords, out var tileRef))
return false;
@@ -157,10 +157,5 @@ namespace Content.Client.Sandbox
{
_consoleHost.ExecuteCommand("physics shapes");
}
public void MachineLinking()
{
_consoleHost.ExecuteCommand("signallink");
}
}
}

View File

@@ -28,6 +28,7 @@ public sealed partial class SensorMonitoringWindow : FancyWindow, IComputerWindo
public SensorMonitoringWindow()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
}
public void UpdateState(ConsoleUIState state)

View File

@@ -54,7 +54,7 @@ public sealed partial class StoreMenu : DefaultWindow
foreach (var ((_, amount), proto) in currency)
{
balanceStr += Loc.GetString("store-ui-balance-display", ("amount", amount),
("currency", Loc.GetString(proto.DisplayName, ("amount", 1))));
("currency", Loc.GetString(proto.DisplayName, ("amount", 1)))) + "\n";
}
BalanceInfo.SetMarkup(balanceStr.TrimEnd());
@@ -63,7 +63,10 @@ public sealed partial class StoreMenu : DefaultWindow
foreach (var type in currency)
{
if (type.Value.CanWithdraw && type.Value.Cash != null && type.Key.Item2 > 0)
{
disabled = false;
break;
}
}
WithdrawButton.Disabled = disabled;

View File

@@ -18,7 +18,7 @@ public sealed partial class StoreWithdrawWindow : DefaultWindow
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
private Dictionary<FixedPoint2, CurrencyPrototype> _validCurrencies = new();
private Dictionary<CurrencyPrototype, FixedPoint2> _validCurrencies = new();
private HashSet<CurrencyWithdrawButton> _buttons = new();
public event Action<BaseButton.ButtonEventArgs, string, int>? OnWithdrawAttempt;
@@ -36,7 +36,7 @@ public sealed partial class StoreWithdrawWindow : DefaultWindow
if (!_prototypeManager.TryIndex(currency.Key, out var proto))
continue;
_validCurrencies.Add(currency.Value, proto);
_validCurrencies.Add(proto, currency.Value);
}
//this shouldn't ever happen but w/e
@@ -47,14 +47,17 @@ public sealed partial class StoreWithdrawWindow : DefaultWindow
_buttons.Clear();
foreach (var currency in _validCurrencies)
{
if (!currency.Key.CanWithdraw)
continue;
var button = new CurrencyWithdrawButton()
{
Id = currency.Value.ID,
Amount = currency.Key,
Id = currency.Key.ID,
Amount = currency.Value,
MinHeight = 20,
Text = Loc.GetString("store-withdraw-button-ui", ("currency",Loc.GetString(currency.Value.DisplayName, ("amount", currency.Key)))),
Text = Loc.GetString("store-withdraw-button-ui", ("currency",Loc.GetString(currency.Key.DisplayName, ("amount", currency.Value)))),
Disabled = false,
};
button.Disabled = false;
button.OnPressed += args =>
{
OnWithdrawAttempt?.Invoke(args, button.Id, WithdrawSlider.Value);
@@ -65,7 +68,7 @@ public sealed partial class StoreWithdrawWindow : DefaultWindow
ButtonContainer.AddChild(button);
}
var maxWithdrawAmount = _validCurrencies.Keys.Max().Int();
var maxWithdrawAmount = _validCurrencies.Values.Max().Int();
// setup withdraw slider
WithdrawSlider.MinValue = 1;

View File

@@ -110,6 +110,7 @@ namespace Content.Client.Stylesheets
public static readonly Color ButtonColorGoodDefault = Color.FromHex("#3E6C45");
public static readonly Color ButtonColorGoodHovered = Color.FromHex("#31843E");
public static readonly Color ButtonColorGoodDisabled = Color.FromHex("#164420");
//NavMap
public static readonly Color PointRed = Color.FromHex("#B02E26");
@@ -1499,6 +1500,20 @@ namespace Content.Client.Stylesheets
Element<Button>().Class("ButtonColorGreen").Pseudo(ContainerButton.StylePseudoClassHover)
.Prop(Control.StylePropertyModulateSelf, ButtonColorGoodHovered),
// Accept button (merge with green button?) ---
Element<Button>().Class("ButtonAccept")
.Prop(Control.StylePropertyModulateSelf, ButtonColorGoodDefault),
Element<Button>().Class("ButtonAccept").Pseudo(ContainerButton.StylePseudoClassNormal)
.Prop(Control.StylePropertyModulateSelf, ButtonColorGoodDefault),
Element<Button>().Class("ButtonAccept").Pseudo(ContainerButton.StylePseudoClassHover)
.Prop(Control.StylePropertyModulateSelf, ButtonColorGoodHovered),
Element<Button>().Class("ButtonAccept").Pseudo(ContainerButton.StylePseudoClassDisabled)
.Prop(Control.StylePropertyModulateSelf, ButtonColorGoodDisabled),
// ---
// Small Button ---

View File

@@ -0,0 +1,8 @@
using Content.Shared.Telephone;
namespace Content.Client.Telephone;
public sealed class TelephoneSystem : SharedTelephoneSystem
{
}

View File

@@ -104,7 +104,7 @@ public sealed class TippyUIController : UIController
? -WaddleRotation
: WaddleRotation;
if (EntityManager.TryGetComponent(_entity, out FootstepModifierComponent? step))
if (EntityManager.TryGetComponent(_entity, out FootstepModifierComponent? step) && step.FootstepSoundCollection != null)
{
var audioParams = step.FootstepSoundCollection.Params
.AddVolume(-7f)

View File

@@ -0,0 +1,34 @@
using System.Linq;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface.RichText;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
namespace Content.Client.UserInterface.RichText;
/// <summary>
/// Sets the font to a monospaced variant
/// </summary>
public sealed class MonoTag : IMarkupTag
{
[ValidatePrototypeId<FontPrototype>] public const string MonoFont = "Monospace";
[Dependency] private readonly IResourceCache _resourceCache = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
public string Name => "mono";
/// <inheritdoc/>
public void PushDrawContext(MarkupNode node, MarkupDrawingContext context)
{
var font = FontTag.CreateFont(context.Font, node, _resourceCache, _prototypeManager, MonoFont);
context.Font.Push(font);
}
/// <inheritdoc/>
public void PopDrawContext(MarkupNode node, MarkupDrawingContext context)
{
context.Font.Pop();
}
}

View File

@@ -572,6 +572,10 @@ public sealed class UserAHelpUIHandler : IAHelpUIHandler
_window.OnClose += () => { OnClose?.Invoke(); };
_window.OnOpen += () => { OnOpen?.Invoke(); };
_window.Contents.AddChild(_chatPanel);
var introText = Loc.GetString("bwoink-system-introductory-message");
var introMessage = new SharedBwoinkSystem.BwoinkTextMessage( _ownerId, SharedBwoinkSystem.SystemUserId, introText);
Receive(introMessage);
}
public void Dispose()

View File

@@ -1,4 +1,5 @@
using Content.Client.Administration.Managers;
using System.Numerics;
using Content.Client.Administration.Managers;
using Content.Client.Gameplay;
using Content.Client.Markers;
using Content.Client.Sandbox;
@@ -7,9 +8,7 @@ using Content.Client.UserInterface.Controls;
using Content.Client.UserInterface.Systems.DecalPlacer;
using Content.Client.UserInterface.Systems.Sandbox.Windows;
using Content.Shared.Input;
using Content.Shared.Silicons.StationAi;
using JetBrains.Annotations;
using Robust.Client.Console;
using Robust.Client.Debugging;
using Robust.Client.Graphics;
using Robust.Client.Input;
@@ -109,9 +108,13 @@ public sealed class SandboxUIController : UIController, IOnStateChanged<Gameplay
private void EnsureWindow()
{
if(_window is { Disposed: false })
if (_window is { Disposed: false })
return;
_window = UIManager.CreateWindow<SandboxWindow>();
// Pre-center the window without forcing it to the center every time.
_window.OpenCentered();
_window.Close();
_window.OnOpen += () => { SandboxButton!.Pressed = true; };
_window.OnClose += () => { SandboxButton!.Pressed = false; };
_window.ToggleLightButton.Pressed = !_light.Enabled;
@@ -149,7 +152,6 @@ public sealed class SandboxUIController : UIController, IOnStateChanged<Gameplay
_window.ToggleSubfloorButton.OnPressed += _ => _sandbox.ToggleSubFloor();
_window.ShowMarkersButton.OnPressed += _ => _sandbox.ShowMarkers();
_window.ShowBbButton.OnPressed += _ => _sandbox.ShowBb();
_window.MachineLinkingButton.OnPressed += _ => _sandbox.MachineLinking();
}
private void CheckSandboxVisibility()
@@ -164,7 +166,7 @@ public sealed class SandboxUIController : UIController, IOnStateChanged<Gameplay
{
if (_window != null)
{
_window.Dispose();
_window.Close();
_window = null;
}
@@ -209,7 +211,7 @@ public sealed class SandboxUIController : UIController, IOnStateChanged<Gameplay
if (_sandbox.SandboxAllowed && _window.IsOpen != true)
{
UIManager.ClickSound();
_window.OpenCentered();
_window.Open();
}
else
{

View File

@@ -4,20 +4,24 @@
Title="{Loc sandbox-window-title}"
Resizable="False">
<BoxContainer Orientation="Vertical" SeparationOverride="4">
<Button Name="AiOverlayButton" Access="Public" Text="{Loc sandbox-window-ai-overlay-button}" ToggleMode="True"/>
<Button Name="RespawnButton" Access="Public" Text="{Loc sandbox-window-respawn-button}"/>
<Button Name="SpawnEntitiesButton" Access="Public" Text="{Loc sandbox-window-spawn-entities-button}"/>
<Label Text="{Loc sandbox-window-map-editing-label}"/>
<Button Name="SpawnTilesButton" Access="Public" Text="{Loc sandbox-window-spawn-tiles-button}"/>
<Button Name="SpawnEntitiesButton" Access="Public" Text="{Loc sandbox-window-spawn-entities-button}"/>
<Button Name="SpawnDecalsButton" Access="Public" Text="{Loc sandbox-window-spawn-decals-button}"/>
<Button Name="GiveFullAccessButton" Access="Public" Text="{Loc sandbox-window-grant-full-access-button}"/>
<Button Name="GiveAghostButton" Access="Public" Text="{Loc sandbox-window-ghost-button}"/>
<Label Text="{Loc sandbox-window-visibility-label}"/>
<Button Name="ToggleLightButton" Access="Public" Text="{Loc sandbox-window-toggle-lights-button}" ToggleMode="True"/>
<Button Name="ToggleFovButton" Access="Public" Text="{Loc sandbox-window-toggle-fov-button}" ToggleMode="True"/>
<Button Name="ToggleShadowsButton" Access="Public" Text="{Loc sandbox-window-toggle-shadows-button}" ToggleMode="True"/>
<Button Name="ToggleSubfloorButton" Access="Public" Text="{Loc sandbox-window-toggle-subfloor-button}" ToggleMode="True"/>
<Button Name="SuicideButton" Access="Public" Text="{Loc sandbox-window-toggle-suicide-button}" ToggleMode="True"/>
<Button Name="AiOverlayButton" Access="Public" Text="{Loc sandbox-window-ai-overlay-button}" ToggleMode="True"/>
<Button Name="ShowMarkersButton" Access="Public" Text="{Loc sandbox-window-show-spawns-button}" ToggleMode="True"/>
<Button Name="ShowBbButton" Access="Public" Text="{Loc sandbox-window-show-bb-button}" ToggleMode="True"/>
<Button Name="MachineLinkingButton" Access="Public" Text="{Loc sandbox-window-link-machines-button}" ToggleMode="True"/>
<Label Text="{Loc sandbox-window-your-character-label}"/>
<Button Name="GiveAghostButton" Access="Public" Text="{Loc sandbox-window-ghost-button}"/>
<Button Name="GiveFullAccessButton" Access="Public" Text="{Loc sandbox-window-grant-full-access-button}"/>
<Button Name="SuicideButton" Access="Public" Text="{Loc sandbox-window-toggle-suicide-button}"/>
<Button Name="RespawnButton" Access="Public" Text="{Loc sandbox-window-respawn-button}"/>
</BoxContainer>
</windows:SandboxWindow>

View File

@@ -77,6 +77,7 @@ public sealed partial class GunSystem : SharedGunSystem
base.Initialize();
UpdatesOutsidePrediction = true;
SubscribeLocalEvent<AmmoCounterComponent, ItemStatusCollectMessage>(OnAmmoCounterCollect);
SubscribeLocalEvent<AmmoCounterComponent, UpdateClientAmmoEvent>(OnUpdateClientAmmo);
SubscribeAllEvent<MuzzleFlashEvent>(OnMuzzleFlash);
// Plays animated effects on the client.
@@ -86,6 +87,11 @@ public sealed partial class GunSystem : SharedGunSystem
InitializeSpentAmmo();
}
private void OnUpdateClientAmmo(EntityUid uid, AmmoCounterComponent ammoComp, ref UpdateClientAmmoEvent args)
{
UpdateAmmoCount(uid, ammoComp);
}
private void OnMuzzleFlash(MuzzleFlashEvent args)
{
var gunUid = GetEntity(args.Uid);

View File

@@ -0,0 +1,7 @@
using Content.Shared._CP14.Knowledge;
namespace Content.Client._CP14.Knowledge;
public sealed partial class ClientCP14KnowledgeSystem : SharedCP14KnowledgeSystem
{
}

View File

@@ -80,6 +80,9 @@ public sealed class CP14ClientModularCraftSystem : CP14SharedModularCraftSystem
start.Comp.RevealedLayers.Add(keyCode);
var index = sprite.AddLayer(defaultLayer);
sprite.LayerMapSet(keyCode, index);
if (indexedPart.Color is not null)
sprite.LayerSetColor(keyCode, indexedPart.Color.Value);
}
else
{
@@ -148,6 +151,7 @@ public sealed class CP14ClientModularCraftSystem : CP14SharedModularCraftSystem
{
RsiPath = indexedPart.RsiPath,
State = state,
Color = indexedPart.Color,
};
var key = $"{defaultKey}-{counterPart}-default";
@@ -203,6 +207,7 @@ public sealed class CP14ClientModularCraftSystem : CP14SharedModularCraftSystem
{
RsiPath = indexedPart.RsiPath,
State = state,
Color = indexedPart.Color,
};
var key = $"{defaultKey}-{counterPart}-default";

View File

@@ -16,11 +16,12 @@
<Label Text="{Loc 'cp14-ui-options-main-graphics-label'}"
StyleClasses="LabelKeyText"/>
<!-- CP14 Wave shader settings -->
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'cp14-ui-options-main-graphics-wave-shader'}" Margin="0 0 4 0"/>
<CheckBox Name="WaveShaderEnabled"/>
</BoxContainer>
<CheckBox Name="WaveShaderEnabled"
Text="{Loc 'cp14-ui-options-main-graphics-wave-shader'}"/>
<!-- TODO: Wave shader tooltip -->
<CheckBox Name="PostProcessCheckBox"
Text="{Loc 'cp14-ui-options-postprocess'}"
ToolTip="{Loc 'cp14-ui-options-postprocess-tooltip'}"/>
</BoxContainer>
</ScrollContainer>

View File

@@ -13,6 +13,7 @@ public sealed partial class CP14OptionsMenuMainTab : Control
RobustXamlLoader.Load(this);
Control.AddOptionCheckBox(CP14ConfigVars.WaveShaderEnabled, WaveShaderEnabled);
Control.AddOptionCheckBox(CP14ConfigVars.PostProcess, PostProcessCheckBox);
Control.Initialize();
}

View File

@@ -0,0 +1,77 @@
using Content.Shared._CP14.Configuration;
using System.Numerics;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Configuration;
using Robust.Shared.Enums;
using Robust.Shared.Graphics;
using Robust.Shared.Physics;
using Robust.Shared.Prototypes;
namespace Content.Client.Overlays;
// This overlay serves as the foundational post processing overlay.
// Ideally, for performance reasons, post processing designed to be present at all times, such as additive light blending or tonemapping, should be done as part of a single shader pass.
public sealed class CP14BasePostProcessOverlay : Overlay
{
[Dependency] private readonly IConfigurationManager _configManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly ILightManager _lightManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
public override bool RequestScreenTexture => true;
public override OverlaySpace Space => OverlaySpace.WorldSpace;
private readonly ShaderInstance _basePostProcessShader;
public CP14BasePostProcessOverlay()
{
IoCManager.InjectDependencies(this);
_basePostProcessShader = _prototypeManager.Index<ShaderPrototype>("BasePostProcess").InstanceUnique();
}
protected override bool BeforeDraw(in OverlayDrawArgs args)
{
if (!_configManager.GetCVar(CP14ConfigVars.PostProcess))
return false;
if (!_entityManager.TryGetComponent(_playerManager.LocalSession?.AttachedEntity, out EyeComponent? eyeComp))
return false;
if (args.Viewport.Eye != eyeComp.Eye)
return false;
if (!_lightManager.Enabled || !eyeComp.Eye.DrawLight || !eyeComp.Eye.DrawFov)
return false;
var playerEntity = _playerManager.LocalSession?.AttachedEntity;
if (playerEntity == null)
return false;
return true;
}
protected override void Draw(in OverlayDrawArgs args)
{
if (ScreenTexture == null)
return;
if (args.Viewport.Eye == null)
return;
var playerEntity = _playerManager.LocalSession?.AttachedEntity;
var worldHandle = args.WorldHandle;
var viewport = args.WorldBounds;
_basePostProcessShader.SetParameter("SCREEN_TEXTURE", ScreenTexture);
_basePostProcessShader.SetParameter("LIGHT_TEXTURE", args.Viewport.LightRenderTarget.Texture);
_basePostProcessShader.SetParameter("Zoom", args.Viewport.Eye.Zoom.X);
worldHandle.UseShader(_basePostProcessShader);
worldHandle.DrawRect(viewport, Color.White);
worldHandle.UseShader(null);
}
}

View File

@@ -12,6 +12,9 @@ public sealed class CP14WorkbenchBoundUserInterface : BoundUserInterface
{
private CP14WorkbenchWindow? _window;
[ViewVariables]
private string _search = string.Empty;
public CP14WorkbenchBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
@@ -23,6 +26,12 @@ public sealed class CP14WorkbenchBoundUserInterface : BoundUserInterface
_window = this.CreateWindow<CP14WorkbenchWindow>();
_window.OnCraft += entry => SendMessage(new CP14WorkbenchUiCraftMessage(entry.ProtoId));
_window.OnTextUpdated += search =>
{
_search = search.Trim().ToLowerInvariant();
_window.UpdateFilter(_search);
};
}
protected override void UpdateState(BoundUserInterfaceState state)
@@ -32,7 +41,7 @@ public sealed class CP14WorkbenchBoundUserInterface : BoundUserInterface
switch (state)
{
case CP14WorkbenchUiRecipesState recipesState:
_window?.UpdateRecipes(recipesState);
_window?.UpdateRecipes(recipesState, _search);
break;
}
}

View File

@@ -1,10 +1,20 @@
<Control xmlns="https://spacestation14.io">
<GridContainer Columns="2">
<TextureRect Name="View"
Margin="0,0,4,0"
MinSize="48 48"
HorizontalAlignment="Left"
Stretch="KeepAspectCentered"/>
<Label Name="Name"/>
<EntityPrototypeView
Name="EntityView"
Margin="0,0,4,0"
MinSize="48 48"
MaxSize="48 48"
Scale="2,2"
HorizontalAlignment="Left"
VerticalExpand="True" />
<TextureRect
Name="View"
Margin="0,0,4,0"
MinSize="48 48"
MaxSize="48 48"
HorizontalAlignment="Left"
Stretch="KeepAspectCentered" />
<Label Name="Name" />
</GridContainer>
</Control>

View File

@@ -31,7 +31,9 @@ public sealed partial class CP14WorkbenchRecipeControl : Control
{
var entityName = prototype.Name;
Name.Text = count <= 1 ? entityName : $"{entityName} x{count}";
View.Texture = _sprite.GetPrototypeIcon(prototype).Default;
View.Visible = false;
EntityView.SetPrototype(prototype);
}
public CP14WorkbenchRecipeControl(StackPrototype prototype, int count) : this()
@@ -43,6 +45,7 @@ public sealed partial class CP14WorkbenchRecipeControl : Control
if (icon is null)
return;
EntityView.Visible = false;
View.Texture = _sprite.Frame0(icon);
}
}

View File

@@ -1,11 +1,13 @@
<Control xmlns="https://spacestation14.io">
<Button Name="Button">
<GridContainer Columns="2">
<TextureRect Name="View"
Margin="0,0,4,0"
MinSize="48 48"
HorizontalAlignment="Left"
Stretch="KeepAspectCentered"/>
<EntityPrototypeView Name="View"
Margin="0,0,4,0"
MinSize="48 48"
MaxSize="48 48"
Scale="2,2"
HorizontalAlignment="Center"
VerticalExpand="True"/>
<Label Name="Name"/>
</GridContainer>
</Button>

View File

@@ -59,6 +59,6 @@ public sealed partial class CP14WorkbenchRequirementControl : Control
private void UpdateView()
{
View.Texture = _sprite.GetPrototypeIcon(_recipePrototype.Result).Default;
View.SetPrototype(_recipePrototype.Result);
}
}

View File

@@ -2,59 +2,68 @@
xmlns:graphics="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
Title="{Loc 'cp14-workbench-ui-title'}"
MinSize="700 600">
<BoxContainer Orientation="Vertical">
SetSize="700 500"
MinSize="700 300">
<BoxContainer Orientation="Horizontal">
<!-- Main -->
<BoxContainer HorizontalExpand="True" VerticalExpand="True" Orientation="Horizontal">
<GridContainer HorizontalExpand="True" VerticalExpand="True" Columns="2">
<!-- Product list (left side UI) -->
<BoxContainer SizeFlagsStretchRatio="0.5" HorizontalExpand="True" Orientation="Vertical" Margin="0 0 10 0">
<!-- Search Bar -->
<LineEdit Name="SearchBar" Margin="4" PlaceHolder="Search" HorizontalExpand="True" />
<!-- Crafts container -->
<ScrollContainer HorizontalExpand="True" VerticalExpand="True" MinSize="0 200">
<BoxContainer Name="CraftsContainer" Orientation="Vertical" HorizontalExpand="True"/>
<BoxContainer Name="CraftsContainer" Orientation="Vertical" HorizontalExpand="True" />
</ScrollContainer>
</BoxContainer>
<!-- Craft view -->
<BoxContainer HorizontalExpand="True" VerticalExpand="True" Orientation="Vertical">
<PanelContainer HorizontalExpand="True" VerticalExpand="True">
<!-- Background -->
<PanelContainer.PanelOverride>
<graphics:StyleBoxFlat BackgroundColor="#41332f"/>
</PanelContainer.PanelOverride>
<!-- Craft view (right side UI) -->
<BoxContainer SizeFlagsStretchRatio="0.5" Orientation="Vertical" HorizontalExpand="True"
VerticalExpand="True">
<PanelContainer HorizontalExpand="True" VerticalExpand="True">
<!-- Background -->
<PanelContainer.PanelOverride>
<graphics:StyleBoxFlat BackgroundColor="#41332f" />
</PanelContainer.PanelOverride>
<!-- Content -->
<BoxContainer HorizontalExpand="True" VerticalExpand="True" Orientation="Vertical">
<!-- Item info -->
<GridContainer HorizontalExpand="True" Columns="2">
<!-- Left panel - icon -->
<TextureRect Name="ItemView"
<!-- Content -->
<BoxContainer HorizontalExpand="True" VerticalExpand="True" Orientation="Vertical">
<!-- Item info -->
<!-- icon -->
<EntityPrototypeView Name="ItemView"
Scale="2,2"
Margin="0,0,4,0"
MinSize="64 64"
HorizontalAlignment="Left"
Stretch="KeepAspectCentered"/>
MaxSize="64 64"
HorizontalAlignment="Left" />
<!-- Right panel - name & description -->
<BoxContainer HorizontalExpand="True" VerticalExpand="True" Orientation="Vertical">
<Label Name="ItemName" Text="Name"/>
<Label Name="ItemDescription" Text="Description" ClipText="True"/>
</BoxContainer>
</GridContainer>
<controls:HLine Color="#404040" Thickness="2" Margin="0 5"/>
<!-- Required title -->
<Label Text="{Loc 'cp14-workbench-recipe-list'}"/>
<!-- Craft requirements content -->
<!-- Added by code -->
<BoxContainer Name="ItemRequirements" Orientation="Vertical" VerticalExpand="True" HorizontalExpand="True"/>
<controls:HLine Color="#404040" Thickness="2" Margin="0 5"/>
<!-- Craft button -->
<Button Name="CraftButton" Text="{Loc 'cp14-workbench-craft'}"/>
<!-- name & description -->
<BoxContainer Margin="5 0 0 0" HorizontalExpand="True" VerticalExpand="True"
Orientation="Vertical">
<RichTextLabel Name="ItemName" Margin="5" />
<RichTextLabel Name="ItemDescription" Margin="5" />
</BoxContainer>
</PanelContainer>
</BoxContainer>
</GridContainer>
<controls:HLine Color="#404040" Thickness="2" Margin="0 5" />
<!-- Required title -->
<Label Margin="5 0 0 0" Text="{Loc 'cp14-workbench-recipe-list'}" />
<!-- Craft requirements content -->
<!-- Added by code -->
<BoxContainer
Margin="5 0 0 0"
Name="ItemRequirements"
Orientation="Vertical" VerticalExpand="True"
HorizontalExpand="True" />
<controls:HLine Color="#404040" Thickness="5" Margin="0 5" />
<!-- Craft button -->
<Button Name="CraftButton" Text="{Loc 'cp14-workbench-craft'}" />
</BoxContainer>
</PanelContainer>
</BoxContainer>
</BoxContainer>
</BoxContainer>
</DefaultWindow>

View File

@@ -19,19 +19,22 @@ public sealed partial class CP14WorkbenchWindow : DefaultWindow
[Dependency] private readonly IEntityManager _entity = default!;
[Dependency] private readonly IPrototypeManager _prototype = default!;
private CP14WorkbenchUiRecipesState? _cachedState;
public event Action<CP14WorkbenchUiRecipesEntry>? OnCraft;
public event Action<string>? OnTextUpdated;
private readonly SpriteSystem _sprite;
private CP14WorkbenchUiRecipesEntry? _selectedEntry ;
private CP14WorkbenchUiRecipesEntry? _selectedEntry;
public CP14WorkbenchWindow()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
_sprite = _entity.System<SpriteSystem>();
SearchBar.OnTextChanged += _ =>
{
OnTextUpdated?.Invoke(SearchBar.Text);
};
CraftButton.OnPressed += _ =>
{
if (_selectedEntry is null)
@@ -41,13 +44,34 @@ public sealed partial class CP14WorkbenchWindow : DefaultWindow
};
}
public void UpdateRecipes(CP14WorkbenchUiRecipesState recipesState)
public void UpdateFilter(string? search)
{
if (_cachedState is null)
return;
UpdateRecipes(_cachedState, search);
}
public void UpdateRecipes(CP14WorkbenchUiRecipesState recipesState, string? search = null)
{
_cachedState = recipesState;
CraftsContainer.RemoveAllChildren();
List<CP14WorkbenchUiRecipesEntry> uncraftableList = new();
foreach (var entry in recipesState.Recipes)
{
if (search is not null && search != "")
{
if (!_prototype.TryIndex(entry.ProtoId, out var indexedEntry))
continue;
if (!_prototype.TryIndex(indexedEntry.Result, out var indexedResult))
continue;
if (!indexedResult.Name.Contains(search))
continue;
}
if (entry.Craftable)
{
var control = new CP14WorkbenchRequirementControl(entry);
@@ -89,7 +113,7 @@ public sealed partial class CP14WorkbenchWindow : DefaultWindow
var result = _prototype.Index(recipe.Result);
ItemView.Texture = _sprite.GetPrototypeIcon(recipe.Result).Default;
ItemView.SetPrototype(recipe.Result);
ItemName.Text = result.Name;
ItemDescription.Text = result.Description;

View File

@@ -2,6 +2,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using Robust.Shared;
using Robust.Shared.Audio.Components;
using Robust.Shared.Configuration;
using Robust.Shared.GameObjects;
using Robust.Shared.Log;
@@ -216,14 +217,17 @@ namespace Content.IntegrationTests.Tests
/// generally not spawn unrelated / detached entities. Any entities that do get spawned should be parented to
/// the spawned entity (e.g., in a container). If an entity needs to spawn an entity somewhere in null-space,
/// it should delete that entity when it is no longer required. This test mainly exists to prevent "entity leak"
/// bugs, where spawning some entity starts spawning unrelated entities in null space.
/// bugs, where spawning some entity starts spawning unrelated entities in null space that stick around after
/// the original entity is gone.
///
/// Note that this isn't really a strict requirement, and there are probably quite a few edge cases. Its a pretty
/// crude test to try catch issues like this, and possibly should just be disabled.
/// </remarks>
[Test]
public async Task SpawnAndDeleteEntityCountTest()
{
var settings = new PoolSettings { Connected = true, Dirty = true };
await using var pair = await PoolManager.GetServerClient(settings);
var mapManager = pair.Server.ResolveDependency<IMapManager>();
var mapSys = pair.Server.System<SharedMapSystem>();
var server = pair.Server;
var client = pair.Client;
@@ -261,6 +265,9 @@ namespace Content.IntegrationTests.Tests
await pair.RunTicksSync(3);
// We consider only non-audio entities, as some entities will just play sounds when they spawn.
int Count(IEntityManager ent) => ent.EntityCount - ent.Count<AudioComponent>();
foreach (var protoId in protoIds)
{
// TODO fix ninja
@@ -268,8 +275,8 @@ namespace Content.IntegrationTests.Tests
if (protoId == "MobHumanSpaceNinja")
continue;
var count = server.EntMan.EntityCount;
var clientCount = client.EntMan.EntityCount;
var count = Count(server.EntMan);
var clientCount = Count(client.EntMan);
EntityUid uid = default;
await server.WaitPost(() => uid = server.EntMan.SpawnEntity(protoId, coords));
await pair.RunTicksSync(3);
@@ -277,30 +284,30 @@ namespace Content.IntegrationTests.Tests
// If the entity deleted itself, check that it didn't spawn other entities
if (!server.EntMan.EntityExists(uid))
{
if (server.EntMan.EntityCount != count)
if (Count(server.EntMan) != count)
{
Assert.Fail($"Server prototype {protoId} failed on deleting itself");
}
if (client.EntMan.EntityCount != clientCount)
if (Count(client.EntMan) != clientCount)
{
Assert.Fail($"Client prototype {protoId} failed on deleting itself\n" +
$"Expected {clientCount} and found {client.EntMan.EntityCount}.\n" +
$"Expected {clientCount} and found {Count(client.EntMan)}.\n" +
$"Server was {count}.");
}
continue;
}
// Check that the number of entities has increased.
if (server.EntMan.EntityCount <= count)
if (Count(server.EntMan) <= count)
{
Assert.Fail($"Server prototype {protoId} failed on spawning as entity count didn't increase");
}
if (client.EntMan.EntityCount <= clientCount)
if (Count(client.EntMan) <= clientCount)
{
Assert.Fail($"Client prototype {protoId} failed on spawning as entity count didn't increase" +
$"Expected at least {clientCount} and found {client.EntMan.EntityCount}. " +
$"Expected at least {clientCount} and found {Count(client.EntMan)}. " +
$"Server was {count}");
}
@@ -308,15 +315,15 @@ namespace Content.IntegrationTests.Tests
await pair.RunTicksSync(3);
// Check that the number of entities has gone back to the original value.
if (server.EntMan.EntityCount != count)
if (Count(server.EntMan) != count)
{
Assert.Fail($"Server prototype {protoId} failed on deletion count didn't reset properly");
}
if (client.EntMan.EntityCount != clientCount)
if (Count(client.EntMan) != clientCount)
{
Assert.Fail($"Client prototype {protoId} failed on deletion count didn't reset properly:\n" +
$"Expected {clientCount} and found {client.EntMan.EntityCount}.\n" +
$"Expected {clientCount} and found {Count(client.EntMan)}.\n" +
$"Server was {count}.");
}
}

View File

@@ -0,0 +1,132 @@
using System.Collections.Generic;
using System.Linq;
using Content.Shared.Lathe;
using Content.Shared.Materials;
using Content.Shared.Prototypes;
using Content.Shared.Research.Prototypes;
using Content.Shared.Whitelist;
using Robust.Shared.GameObjects;
using Robust.Shared.Prototypes;
namespace Content.IntegrationTests.Tests.Lathe;
[TestFixture]
public sealed class LatheTest
{
[Test]
public async Task TestLatheRecipeIngredientsFitLathe()
{
await using var pair = await PoolManager.GetServerClient();
var server = pair.Server;
var mapData = await pair.CreateTestMap();
var entMan = server.EntMan;
var protoMan = server.ProtoMan;
var compFactory = server.ResolveDependency<IComponentFactory>();
var materialStorageSystem = server.System<SharedMaterialStorageSystem>();
var whitelistSystem = server.System<EntityWhitelistSystem>();
await server.WaitAssertion(() =>
{
// Find all the lathes
var latheProtos = protoMan.EnumeratePrototypes<EntityPrototype>()
.Where(p => !p.Abstract)
.Where(p => !pair.IsTestPrototype(p))
.Where(p => p.HasComponent<LatheComponent>());
// Find every EntityPrototype that can be inserted into a MaterialStorage
var materialEntityProtos = protoMan.EnumeratePrototypes<EntityPrototype>()
.Where(p => !p.Abstract)
.Where(p => !pair.IsTestPrototype(p))
.Where(p => p.HasComponent<PhysicalCompositionComponent>());
// Spawn all of the above material EntityPrototypes - we need actual entities to do whitelist checks
var materialEntities = new List<EntityUid>(materialEntityProtos.Count());
foreach (var materialEntityProto in materialEntityProtos)
{
materialEntities.Add(entMan.SpawnEntity(materialEntityProto.ID, mapData.GridCoords));
}
Assert.Multiple(() =>
{
// Check each lathe individually
foreach (var latheProto in latheProtos)
{
if (!latheProto.TryGetComponent<LatheComponent>(out var latheComp, compFactory))
continue;
if (!latheProto.TryGetComponent<MaterialStorageComponent>(out var storageComp, compFactory))
continue;
// Test which material-containing entities are accepted by this lathe
var acceptedMaterials = new HashSet<ProtoId<MaterialPrototype>>();
foreach (var materialEntity in materialEntities)
{
Assert.That(entMan.TryGetComponent<PhysicalCompositionComponent>(materialEntity, out var compositionComponent));
if (whitelistSystem.IsWhitelistFail(storageComp.Whitelist, materialEntity))
continue;
// Mark the lathe as accepting each material in the entity
foreach (var (material, _) in compositionComponent.MaterialComposition)
{
acceptedMaterials.Add(material);
}
}
// Collect all the recipes assigned to this lathe
var recipes = new List<ProtoId<LatheRecipePrototype>>();
recipes.AddRange(latheComp.StaticRecipes);
recipes.AddRange(latheComp.DynamicRecipes);
if (latheProto.TryGetComponent<EmagLatheRecipesComponent>(out var emagRecipesComp, compFactory))
{
recipes.AddRange(emagRecipesComp.EmagStaticRecipes);
recipes.AddRange(emagRecipesComp.EmagDynamicRecipes);
}
// Check each recipe assigned to this lathe
foreach (var recipeId in recipes)
{
Assert.That(protoMan.TryIndex(recipeId, out var recipeProto));
// Track the total material volume of the recipe
var totalQuantity = 0;
// Check each material called for by the recipe
foreach (var (materialId, quantity) in recipeProto.Materials)
{
Assert.That(protoMan.TryIndex(materialId, out var materialProto));
// Make sure the material is accepted by the lathe
Assert.That(acceptedMaterials, Does.Contain(materialId), $"Lathe {latheProto.ID} has recipe {recipeId} but does not accept any materials containing {materialId}");
totalQuantity += quantity;
}
// Make sure the recipe doesn't call for more material than the lathe can hold
if (storageComp.StorageLimit != null)
Assert.That(totalQuantity, Is.LessThanOrEqualTo(storageComp.StorageLimit), $"Lathe {latheProto.ID} has recipe {recipeId} which calls for {totalQuantity} units of materials but can only hold {storageComp.StorageLimit}");
}
}
});
});
await pair.CleanReturnAsync();
}
[Test]
public async Task AllLatheRecipesValidTest()
{
await using var pair = await PoolManager.GetServerClient();
var server = pair.Server;
var proto = server.ProtoMan;
Assert.Multiple(() =>
{
foreach (var recipe in proto.EnumeratePrototypes<LatheRecipePrototype>())
{
if (recipe.Result == null)
Assert.That(recipe.ResultReagents, Is.Not.Null, $"Recipe '{recipe.ID}' has no result or result reagents.");
}
});
await pair.CleanReturnAsync();
}
}

View File

@@ -50,7 +50,6 @@ namespace Content.IntegrationTests.Tests
"MeteorArena",
//CrystallEdge maps
"Village",
"Comoss",
//CrystallEdge Map replacement end
};

View File

@@ -96,26 +96,6 @@ public sealed class ResearchTest
});
});
await pair.CleanReturnAsync();
}
[Test]
public async Task AllLatheRecipesValidTest()
{
await using var pair = await PoolManager.GetServerClient();
var server = pair.Server;
var proto = server.ResolveDependency<IPrototypeManager>();
Assert.Multiple(() =>
{
foreach (var recipe in proto.EnumeratePrototypes<LatheRecipePrototype>())
{
if (recipe.Result == null)
Assert.That(recipe.ResultReagents, Is.Not.Null, $"Recipe '{recipe.ID}' has no result or result reagents.");
}
});
await pair.CleanReturnAsync();
}*/
}

View File

@@ -79,11 +79,11 @@ public sealed class StoreTests
var discountComponent = entManager.GetComponent<StoreDiscountComponent>(pda);
Assert.That(
discountComponent.Discounts,
Has.Exactly(3).Items,
$"After applying discount total discounted items count was expected to be '3' "
Has.Exactly(6).Items,
$"After applying discount total discounted items count was expected to be '6' "
+ $"but was actually {discountComponent.Discounts.Count}- this can be due to discount "
+ $"categories settings (maxItems, weight) not being realistically set, or default "
+ $"discounted count being changed from '3' in StoreDiscountSystem.InitializeDiscounts."
+ $"discounted count being changed from '6' in StoreDiscountSystem.InitializeDiscounts."
);
var discountedListingItems = storeComponent.FullListingsCatalog
.Where(x => x.IsCostModified)

View File

@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Content.Server.Administration.Managers;
using Robust.Shared.Toolshed;
namespace Content.IntegrationTests.Tests.Toolshed;
@@ -10,10 +11,23 @@ public sealed class AdminTest : ToolshedTest
[Test]
public async Task AllCommandsHavePermissions()
{
var toolMan = Server.ResolveDependency<ToolshedManager>();
var admin = Server.ResolveDependency<IAdminManager>();
var ignored = new HashSet<Assembly>()
{typeof(LocTest).Assembly, typeof(Robust.UnitTesting.Shared.Toolshed.LocTest).Assembly};
await Server.WaitAssertion(() =>
{
Assert.That(InvokeCommand("cmd:list where { acmd:perms isnull }", out var res));
Assert.That((IEnumerable<CommandSpec>) res, Is.Empty, "All commands must have admin permissions set up.");
Assert.Multiple(() =>
{
foreach (var cmd in toolMan.DefaultEnvironment.AllCommands())
{
if (ignored.Contains(cmd.Cmd.GetType().Assembly))
continue;
Assert.That(admin.TryGetCommandFlags(cmd, out _), $"Command does not have admin permissions set up: {cmd.FullName()}");
}
});
});
}
}

View File

@@ -1,6 +1,6 @@
using System.Collections.Generic;
using System.Globalization;
using Robust.Shared.IoC;
using System.Reflection;
using Robust.Shared.Localization;
using Robust.Shared.Toolshed;
@@ -14,10 +14,27 @@ public sealed class LocTest : ToolshedTest
[Test]
public async Task AllCommandsHaveDescriptions()
{
var locMan = Server.ResolveDependency<ILocalizationManager>();
var toolMan = Server.ResolveDependency<ToolshedManager>();
var locStrings = new HashSet<string>();
var ignored = new HashSet<Assembly>()
{typeof(LocTest).Assembly, typeof(Robust.UnitTesting.Shared.Toolshed.LocTest).Assembly};
await Server.WaitAssertion(() =>
{
Assert.That(InvokeCommand("cmd:list where { cmd:descloc loc:tryloc isnull }", out var res));
Assert.That((IEnumerable<CommandSpec>)res!, Is.Empty, "All commands must have localized descriptions.");
Assert.Multiple(() =>
{
foreach (var cmd in toolMan.DefaultEnvironment.AllCommands())
{
if (ignored.Contains(cmd.Cmd.GetType().Assembly))
continue;
var descLoc = cmd.DescLocStr();
Assert.That(locStrings.Add(descLoc), $"Duplicate command description key: {descLoc}");
Assert.That(locMan.TryGetString(descLoc, out _), $"Failed to get command description for command {cmd.FullName()}");
}
});
});
}
}

View File

@@ -74,15 +74,15 @@ public abstract class ToolshedTest : IInvocationContext
return (T) res!;
}
protected void ParseCommand(string command, Type? inputType = null, Type? expectedType = null, bool once = false)
protected void ParseCommand(string command, Type? inputType = null, Type? expectedType = null)
{
var parser = new ParserContext(command, Toolshed);
var success = CommandRun.TryParse(false, parser, inputType, expectedType, once, out _, out _, out var error);
var success = CommandRun.TryParse(parser, inputType, expectedType, out _);
if (error is not null)
ReportError(error);
if (parser.Error is not null)
ReportError(parser.Error);
if (error is null)
if (parser.Error is null)
Assert.That(success, $"Parse failed despite no error being reported. Parsed {command}");
}
@@ -153,11 +153,28 @@ public abstract class ToolshedTest : IInvocationContext
return _errors;
}
public bool HasErrors => _errors.Count > 0;
public void ClearErrors()
{
_errors.Clear();
}
public object? ReadVar(string name)
{
return Variables.GetValueOrDefault(name);
}
public void WriteVar(string name, object? value)
{
Variables[name] = value;
}
public IEnumerable<string> GetVars()
{
return Variables.Keys;
}
public Dictionary<string, object?> Variables { get; } = new();
protected void ExpectError(Type err)

View File

@@ -10,11 +10,7 @@ namespace Content.Server.Access;
public sealed class AddAccessLogCommand : ToolshedCommand
{
[CommandImplementation]
public void AddAccessLog(
[CommandInvocationContext] IInvocationContext ctx,
[CommandArgument] EntityUid input,
[CommandArgument] float seconds,
[CommandArgument] ValueRef<string> accessor)
public void AddAccessLog(IInvocationContext ctx, EntityUid input, float seconds, string accessor)
{
var accessReader = EnsureComp<AccessReaderComponent>(input);
@@ -23,19 +19,14 @@ public sealed class AddAccessLogCommand : ToolshedCommand
ctx.WriteLine($"WARNING: Surpassing the limit of the log by {accessLogCount - accessReader.AccessLogLimit+1} entries!");
var accessTime = TimeSpan.FromSeconds(seconds);
var accessName = accessor.Evaluate(ctx)!;
accessReader.AccessLog.Enqueue(new AccessRecord(accessTime, accessName));
accessReader.AccessLog.Enqueue(new AccessRecord(accessTime, accessor));
ctx.WriteLine($"Successfully added access log to {input} with this information inside:\n " +
$"Time of access: {accessTime}\n " +
$"Accessed by: {accessName}");
$"Accessed by: {accessor}");
}
[CommandImplementation]
public void AddAccessLogPiped(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] EntityUid input,
[CommandArgument] float seconds,
[CommandArgument] ValueRef<string> accessor)
public void AddAccessLogPiped(IInvocationContext ctx, [PipedArgument] EntityUid input, float seconds, string accessor)
{
AddAccessLog(ctx, input, seconds, accessor);
}

View File

@@ -408,6 +408,17 @@ namespace Content.Server.Administration.Managers
}
private async Task<(AdminData dat, int? rankId, bool specialLogin)?> LoadAdminData(ICommonSession session)
{
var result = await LoadAdminDataCore(session);
// Make sure admin didn't disconnect while data was loading.
if (session.Status != SessionStatus.InGame)
return null;
return result;
}
private async Task<(AdminData dat, int? rankId, bool specialLogin)?> LoadAdminDataCore(ICommonSession session)
{
var promoteHost = IsLocal(session) && _cfg.GetCVar(CCVars.ConsoleLoginLocal)
|| _promotedPlayers.Contains(session.UserId)

View File

@@ -337,10 +337,15 @@ public sealed class AdminSystem : EntitySystem
private void UpdatePanicBunker()
{
var admins = PanicBunker.CountDeadminnedAdmins
? _adminManager.AllAdmins
: _adminManager.ActiveAdmins;
var hasAdmins = admins.Any();
var hasAdmins = false;
foreach (var admin in _adminManager.AllAdmins)
{
if (_adminManager.HasAdminFlag(admin, AdminFlags.Admin, includeDeAdmin: PanicBunker.CountDeadminnedAdmins))
{
hasAdmins = true;
break;
}
}
// TODO Fix order dependent Cvars
// Please for the sake of my sanity don't make cvars & order dependent.

View File

@@ -204,6 +204,7 @@ public sealed partial class AdminVerbSystem
var recharger = EnsureComp<BatterySelfRechargerComponent>(args.Target);
recharger.AutoRecharge = true;
recharger.AutoRechargeRate = battery.MaxCharge; // Instant refill.
recharger.AutoRechargePause = false; // No delay.
},
Impact = LogImpact.Medium,
Message = Loc.GetString("admin-trick-infinite-battery-object-description"),
@@ -603,6 +604,7 @@ public sealed partial class AdminVerbSystem
recharger.AutoRecharge = true;
recharger.AutoRechargeRate = battery.MaxCharge; // Instant refill.
recharger.AutoRechargePause = false; // No delay.
}
},
Impact = LogImpact.Extreme,

View File

@@ -7,7 +7,7 @@ namespace Content.Server.Administration.Toolshed;
public sealed class MarkedCommand : ToolshedCommand
{
[CommandImplementation]
public IEnumerable<EntityUid> Marked([CommandInvocationContext] IInvocationContext ctx)
public IEnumerable<EntityUid> Marked(IInvocationContext ctx)
{
var res = (IEnumerable<EntityUid>?)ctx.ReadVar("marked");
res ??= Array.Empty<EntityUid>();

View File

@@ -23,7 +23,7 @@ public sealed class RejuvenateCommand : ToolshedCommand
}
[CommandImplementation]
public void Rejuvenate([CommandInvocationContext] IInvocationContext ctx)
public void Rejuvenate(IInvocationContext ctx)
{
_rejuvenate ??= GetSys<RejuvenateSystem>();
if (ExecutingEntity(ctx) is not { } ent)

View File

@@ -8,6 +8,7 @@ using Robust.Shared.Toolshed;
using Robust.Shared.Toolshed.Syntax;
using Robust.Shared.Toolshed.TypeParsers;
using System.Linq;
using Robust.Shared.Prototypes;
namespace Content.Server.Administration.Toolshed;
@@ -17,48 +18,38 @@ public sealed class SolutionCommand : ToolshedCommand
private SharedSolutionContainerSystem? _solutionContainer;
[CommandImplementation("get")]
public SolutionRef? Get(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] EntityUid input,
[CommandArgument] ValueRef<string> name
)
public SolutionRef? Get([PipedArgument] EntityUid input, string name)
{
_solutionContainer ??= GetSys<SharedSolutionContainerSystem>();
if (_solutionContainer.TryGetSolution(input, name.Evaluate(ctx)!, out var solution))
if (_solutionContainer.TryGetSolution(input, name, out var solution))
return new SolutionRef(solution.Value);
return null;
}
[CommandImplementation("get")]
public IEnumerable<SolutionRef> Get(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] IEnumerable<EntityUid> input,
[CommandArgument] ValueRef<string> name
)
public IEnumerable<SolutionRef> Get([PipedArgument] IEnumerable<EntityUid> input, string name)
{
return input.Select(x => Get(ctx, x, name)).Where(x => x is not null).Cast<SolutionRef>();
return input.Select(x => Get(x, name)).Where(x => x is not null).Cast<SolutionRef>();
}
[CommandImplementation("adjreagent")]
public SolutionRef AdjReagent(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] SolutionRef input,
[CommandArgument] Prototype<ReagentPrototype> name,
[CommandArgument] ValueRef<FixedPoint2> amountRef
ProtoId<ReagentPrototype> proto,
FixedPoint2 amount
)
{
_solutionContainer ??= GetSys<SharedSolutionContainerSystem>();
var amount = amountRef.Evaluate(ctx);
if (amount > 0)
{
_solutionContainer.TryAddReagent(input.Solution, name.Value.ID, amount, out _);
_solutionContainer.TryAddReagent(input.Solution, proto, amount, out _);
}
else if (amount < 0)
{
_solutionContainer.RemoveReagent(input.Solution, name.Value.ID, -amount);
_solutionContainer.RemoveReagent(input.Solution, proto, -amount);
}
return input;
@@ -66,12 +57,11 @@ public sealed class SolutionCommand : ToolshedCommand
[CommandImplementation("adjreagent")]
public IEnumerable<SolutionRef> AdjReagent(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] IEnumerable<SolutionRef> input,
[CommandArgument] Prototype<ReagentPrototype> name,
[CommandArgument] ValueRef<FixedPoint2> amountRef
ProtoId<ReagentPrototype> name,
FixedPoint2 amount
)
=> input.Select(x => AdjReagent(ctx, x, name, amountRef));
=> input.Select(x => AdjReagent(x, name, amount));
}
public readonly record struct SolutionRef(Entity<SolutionComponent> Solution)

View File

@@ -36,82 +36,50 @@ public sealed class TagCommand : ToolshedCommand
}
[CommandImplementation("add")]
public EntityUid Add(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] EntityUid input,
[CommandArgument] ValueRef<string, Prototype<TagPrototype>> @ref
)
public EntityUid Add([PipedArgument] EntityUid input, ProtoId<TagPrototype> tag)
{
_tag ??= GetSys<TagSystem>();
_tag.AddTag(input, @ref.Evaluate(ctx)!);
_tag.AddTag(input, tag);
return input;
}
[CommandImplementation("add")]
public IEnumerable<EntityUid> Add(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] IEnumerable<EntityUid> input,
[CommandArgument] ValueRef<string, Prototype<TagPrototype>> @ref
)
=> input.Select(x => Add(ctx, x, @ref));
public IEnumerable<EntityUid> Add([PipedArgument] IEnumerable<EntityUid> input, ProtoId<TagPrototype> tag)
=> input.Select(x => Add(x, tag));
[CommandImplementation("rm")]
public EntityUid Rm(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] EntityUid input,
[CommandArgument] ValueRef<string, Prototype<TagPrototype>> @ref
)
public EntityUid Rm([PipedArgument] EntityUid input, ProtoId<TagPrototype> tag)
{
_tag ??= GetSys<TagSystem>();
_tag.RemoveTag(input, @ref.Evaluate(ctx)!);
_tag.RemoveTag(input, tag);
return input;
}
[CommandImplementation("rm")]
public IEnumerable<EntityUid> Rm(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] IEnumerable<EntityUid> input,
[CommandArgument] ValueRef<string, Prototype<TagPrototype>> @ref
)
=> input.Select(x => Rm(ctx, x, @ref));
public IEnumerable<EntityUid> Rm([PipedArgument] IEnumerable<EntityUid> input, ProtoId<TagPrototype> tag)
=> input.Select(x => Rm(x, tag));
[CommandImplementation("addmany")]
public EntityUid AddMany(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] EntityUid input,
[CommandArgument] ValueRef<IEnumerable<string>, IEnumerable<string>> @ref
)
public EntityUid AddMany([PipedArgument] EntityUid input, IEnumerable<ProtoId<TagPrototype>> tags)
{
_tag ??= GetSys<TagSystem>();
_tag.AddTags(input, (IEnumerable<ProtoId<TagPrototype>>)@ref.Evaluate(ctx)!);
_tag.AddTags(input, tags);
return input;
}
[CommandImplementation("addmany")]
public IEnumerable<EntityUid> AddMany(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] IEnumerable<EntityUid> input,
[CommandArgument] ValueRef<IEnumerable<string>, IEnumerable<string>> @ref
)
=> input.Select(x => AddMany(ctx, x, @ref));
public IEnumerable<EntityUid> AddMany([PipedArgument] IEnumerable<EntityUid> input, IEnumerable<ProtoId<TagPrototype>> tags)
=> input.Select(x => AddMany(x, tags.ToArray()));
[CommandImplementation("rmmany")]
public EntityUid RmMany(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] EntityUid input,
[CommandArgument] ValueRef<IEnumerable<string>, IEnumerable<string>> @ref
)
public EntityUid RmMany([PipedArgument] EntityUid input, IEnumerable<ProtoId<TagPrototype>> tags)
{
_tag ??= GetSys<TagSystem>();
_tag.RemoveTags(input, (IEnumerable<ProtoId<TagPrototype>>)@ref.Evaluate(ctx)!);
_tag.RemoveTags(input, tags);
return input;
}
[CommandImplementation("rmmany")]
public IEnumerable<EntityUid> RmMany(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] IEnumerable<EntityUid> input,
[CommandArgument] ValueRef<IEnumerable<string>, IEnumerable<string>> @ref
)
=> input.Select(x => RmMany(ctx, x, @ref));
public IEnumerable<EntityUid> RmMany([PipedArgument] IEnumerable<EntityUid> input, IEnumerable<ProtoId<TagPrototype>> tags)
=> input.Select(x => RmMany(x, tags.ToArray()));
}

View File

@@ -169,11 +169,13 @@ public sealed class AmeNodeGroup : BaseNodeGroup
public float CalculatePower(int fuel, int cores)
{
// Balanced around a single core AME with injection level 2 producing 120KW.
// Overclocking yields diminishing returns until it evens out at around 360KW.
// Two core with four injection is 150kW. Two core with two injection is 90kW.
// The adjustment for cores make it so that a 1 core AME at 2 injections is better than a 2 core AME at 2 injections.
// However, for the relative amounts for each (1 core at 2 and 2 core at 4), more cores has more output.
return 200000f * MathF.Log10(fuel * fuel) * MathF.Pow(0.75f, cores - 1);
// Increasing core count creates diminishing returns, increasing injection amount increases
// Unlike the previous solution, increasing fuel and cores always leads to an increase in power, even if by very small amounts.
// Increasing core count without increasing fuel always leads to reduced power as well.
// At 18+ cores and 2 inject, the power produced is less than 0, the Max ensures the AME can never produce "negative" power.
return MathF.Max(200000f * MathF.Log10(2 * fuel * MathF.Pow(cores, (float)-0.5)), 0);
}
public int GetTotalStability()

View File

@@ -1,3 +1,4 @@
using Content.Server.Animals.Systems;
using Content.Shared.Storage;
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
@@ -9,44 +10,47 @@ namespace Content.Server.Animals.Components;
/// It also grants an action to players who are controlling these entities, allowing them to do it manually.
/// </summary>
[RegisterComponent]
[RegisterComponent, Access(typeof(EggLayerSystem)), AutoGenerateComponentPause]
public sealed partial class EggLayerComponent : Component
{
/// <summary>
/// The item that gets laid/spawned, retrieved from animal prototype.
/// </summary>
[DataField(required: true)]
public List<EntitySpawnEntry> EggSpawn = new();
/// <summary>
/// Player action.
/// </summary>
[DataField]
public EntProtoId EggLayAction = "ActionAnimalLayEgg";
/// <summary>
/// The amount of nutrient consumed on update.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float HungerUsage = 60f;
[DataField]
public SoundSpecifier EggLaySound = new SoundPathSpecifier("/Audio/Effects/pop.ogg");
/// <summary>
/// Minimum cooldown used for the automatic egg laying.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
[DataField]
public float EggLayCooldownMin = 60f;
/// <summary>
/// Maximum cooldown used for the automatic egg laying.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
[DataField]
public float EggLayCooldownMax = 120f;
/// <summary>
/// Set during component init.
/// The amount of nutrient consumed on update.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public float CurrentEggLayCooldown;
[DataField(required: true), ViewVariables(VVAccess.ReadWrite)]
public List<EntitySpawnEntry> EggSpawn = default!;
[DataField]
public SoundSpecifier EggLaySound = new SoundPathSpecifier("/Audio/Effects/pop.ogg");
[DataField]
public float AccumulatedFrametime;
public float HungerUsage = 60f;
[DataField] public EntityUid? Action;
/// <summary>
/// When to next try to produce.
/// </summary>
[DataField, AutoPausedField]
public TimeSpan NextGrowth = TimeSpan.Zero;
}

View File

@@ -1,59 +0,0 @@
using Content.Server.Animals.Systems;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Server.Animals.Components
/// <summary>
/// Lets an entity produce milk. Uses hunger if present.
/// </summary>
{
[RegisterComponent, Access(typeof(UdderSystem))]
internal sealed partial class UdderComponent : Component
{
/// <summary>
/// The reagent to produce.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadOnly)]
public ProtoId<ReagentPrototype> ReagentId = "Milk";
/// <summary>
/// The name of <see cref="Solution"/>.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadOnly)]
public string SolutionName = "udder";
/// <summary>
/// The solution to add reagent to.
/// </summary>
[DataField]
public Entity<SolutionComponent>? Solution = null;
/// <summary>
/// The amount of reagent to be generated on update.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadOnly)]
public FixedPoint2 QuantityPerUpdate = 25;
/// <summary>
/// The amount of nutrient consumed on update.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float HungerUsage = 10f;
/// <summary>
/// How long to wait before producing.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public TimeSpan GrowthDelay = TimeSpan.FromMinutes(1);
/// <summary>
/// When to next try to produce.
/// </summary>
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
public TimeSpan NextGrowth = TimeSpan.FromSeconds(0);
}
}

View File

@@ -7,15 +7,15 @@ using Content.Shared.Nutrition.Components;
using Content.Shared.Nutrition.EntitySystems;
using Content.Shared.Storage;
using Robust.Server.Audio;
using Robust.Server.GameObjects;
using Robust.Shared.Player;
using Robust.Shared.Random;
using Robust.Shared.Timing;
namespace Content.Server.Animals.Systems;
/// <summary>
/// Gives ability to produce eggs, produces endless if the
/// owner has no HungerComponent
/// Gives the ability to lay eggs/other things;
/// produces endlessly if the owner does not have a HungerComponent.
/// </summary>
public sealed class EggLayerSystem : EntitySystem
{
@@ -23,6 +23,7 @@ public sealed class EggLayerSystem : EntitySystem
[Dependency] private readonly ActionsSystem _actions = default!;
[Dependency] private readonly AudioSystem _audio = default!;
[Dependency] private readonly HungerSystem _hunger = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly MobStateSystem _mobState = default!;
@@ -37,7 +38,6 @@ public sealed class EggLayerSystem : EntitySystem
public override void Update(float frameTime)
{
base.Update(frameTime);
var query = EntityQueryEnumerator<EggLayerComponent>();
while (query.MoveNext(out var uid, out var eggLayer))
{
@@ -45,13 +45,17 @@ public sealed class EggLayerSystem : EntitySystem
if (HasComp<ActorComponent>(uid))
continue;
eggLayer.AccumulatedFrametime += frameTime;
if (eggLayer.AccumulatedFrametime < eggLayer.CurrentEggLayCooldown)
if (_timing.CurTime < eggLayer.NextGrowth)
continue;
eggLayer.AccumulatedFrametime -= eggLayer.CurrentEggLayCooldown;
eggLayer.CurrentEggLayCooldown = _random.NextFloat(eggLayer.EggLayCooldownMin, eggLayer.EggLayCooldownMax);
// Randomize next growth time for more organic egglaying.
eggLayer.NextGrowth += TimeSpan.FromSeconds(_random.NextFloat(eggLayer.EggLayCooldownMin, eggLayer.EggLayCooldownMax));
if (_mobState.IsDead(uid))
continue;
// Hungerlevel check/modification is done in TryLayEgg()
// so it's used for player controlled chickens as well.
TryLayEgg(uid, eggLayer);
}
@@ -60,11 +64,12 @@ public sealed class EggLayerSystem : EntitySystem
private void OnMapInit(EntityUid uid, EggLayerComponent component, MapInitEvent args)
{
_actions.AddAction(uid, ref component.Action, component.EggLayAction);
component.CurrentEggLayCooldown = _random.NextFloat(component.EggLayCooldownMin, component.EggLayCooldownMax);
component.NextGrowth = _timing.CurTime + TimeSpan.FromSeconds(_random.NextFloat(component.EggLayCooldownMin, component.EggLayCooldownMax));
}
private void OnEggLayAction(EntityUid uid, EggLayerComponent egglayer, EggLayInstantActionEvent args)
{
// Cooldown is handeled by ActionAnimalLayEgg in types.yml.
args.Handled = TryLayEgg(uid, egglayer);
}
@@ -76,10 +81,10 @@ public sealed class EggLayerSystem : EntitySystem
if (_mobState.IsDead(uid))
return false;
// Allow infinitely laying eggs if they can't get hungry
// Allow infinitely laying eggs if they can't get hungry.
if (TryComp<HungerComponent>(uid, out var hunger))
{
if (hunger.CurrentHunger < egglayer.HungerUsage)
if (_hunger.GetHunger(hunger) < egglayer.HungerUsage)
{
_popup.PopupEntity(Loc.GetString("action-popup-lay-egg-too-hungry"), uid, uid);
return false;

View File

@@ -186,6 +186,11 @@ public sealed class InnerBodyAnomalySystem : SharedInnerBodyAnomalySystem
if (args.NewMobState != MobState.Dead)
return;
var ev = new BeforeRemoveAnomalyOnDeathEvent();
RaiseLocalEvent(args.Target, ref ev);
if (ev.Cancelled)
return;
_anomaly.ChangeAnomalyHealth(ent, -2); //Shutdown it
}

View File

@@ -0,0 +1,542 @@
using Content.Server.Atmos.Components;
using Content.Server.Atmos.Piping.Components;
using Content.Server.DeviceNetwork.Components;
using Content.Server.NodeContainer;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.NodeGroups;
using Content.Server.NodeContainer.Nodes;
using Content.Server.Power.Components;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.Consoles;
using Content.Shared.Labels.Components;
using Content.Shared.Pinpointer;
using Robust.Server.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Timing;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
namespace Content.Server.Atmos.Consoles;
public sealed class AtmosMonitoringConsoleSystem : SharedAtmosMonitoringConsoleSystem
{
[Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!;
[Dependency] private readonly SharedMapSystem _sharedMapSystem = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
// Private variables
// Note: this data does not need to be saved
private Dictionary<EntityUid, Dictionary<Vector2i, AtmosPipeChunk>> _gridAtmosPipeChunks = new();
private float _updateTimer = 1.0f;
// Constants
private const float UpdateTime = 1.0f;
private const int ChunkSize = 4;
public override void Initialize()
{
base.Initialize();
// Console events
SubscribeLocalEvent<AtmosMonitoringConsoleComponent, ComponentInit>(OnConsoleInit);
SubscribeLocalEvent<AtmosMonitoringConsoleComponent, AnchorStateChangedEvent>(OnConsoleAnchorChanged);
SubscribeLocalEvent<AtmosMonitoringConsoleComponent, EntParentChangedMessage>(OnConsoleParentChanged);
// Tracked device events
SubscribeLocalEvent<AtmosMonitoringConsoleDeviceComponent, NodeGroupsRebuilt>(OnEntityNodeGroupsRebuilt);
SubscribeLocalEvent<AtmosMonitoringConsoleDeviceComponent, AtmosPipeColorChangedEvent>(OnEntityPipeColorChanged);
SubscribeLocalEvent<AtmosMonitoringConsoleDeviceComponent, EntityTerminatingEvent>(OnEntityShutdown);
// Grid events
SubscribeLocalEvent<GridSplitEvent>(OnGridSplit);
}
#region Event handling
private void OnConsoleInit(EntityUid uid, AtmosMonitoringConsoleComponent component, ComponentInit args)
{
InitializeAtmosMonitoringConsole(uid, component);
}
private void OnConsoleAnchorChanged(EntityUid uid, AtmosMonitoringConsoleComponent component, AnchorStateChangedEvent args)
{
InitializeAtmosMonitoringConsole(uid, component);
}
private void OnConsoleParentChanged(EntityUid uid, AtmosMonitoringConsoleComponent component, EntParentChangedMessage args)
{
component.ForceFullUpdate = true;
InitializeAtmosMonitoringConsole(uid, component);
}
private void OnEntityNodeGroupsRebuilt(EntityUid uid, AtmosMonitoringConsoleDeviceComponent component, NodeGroupsRebuilt args)
{
InitializeAtmosMonitoringDevice(uid, component);
}
private void OnEntityPipeColorChanged(EntityUid uid, AtmosMonitoringConsoleDeviceComponent component, AtmosPipeColorChangedEvent args)
{
InitializeAtmosMonitoringDevice(uid, component);
}
private void OnEntityShutdown(EntityUid uid, AtmosMonitoringConsoleDeviceComponent component, EntityTerminatingEvent args)
{
ShutDownAtmosMonitoringEntity(uid, component);
}
private void OnGridSplit(ref GridSplitEvent args)
{
// Collect grids
var allGrids = args.NewGrids.ToList();
if (!allGrids.Contains(args.Grid))
allGrids.Add(args.Grid);
// Rebuild the pipe networks on the affected grids
foreach (var ent in allGrids)
{
if (!TryComp<MapGridComponent>(ent, out var grid))
continue;
RebuildAtmosPipeGrid(ent, grid);
}
// Update atmos monitoring consoles that stand upon an updated grid
var query = AllEntityQuery<AtmosMonitoringConsoleComponent, TransformComponent>();
while (query.MoveNext(out var ent, out var entConsole, out var entXform))
{
if (entXform.GridUid == null)
continue;
if (!allGrids.Contains(entXform.GridUid.Value))
continue;
InitializeAtmosMonitoringConsole(ent, entConsole);
}
}
#endregion
#region UI updates
public override void Update(float frameTime)
{
base.Update(frameTime);
_updateTimer += frameTime;
if (_updateTimer >= UpdateTime)
{
_updateTimer -= UpdateTime;
var query = AllEntityQuery<AtmosMonitoringConsoleComponent, TransformComponent>();
while (query.MoveNext(out var ent, out var entConsole, out var entXform))
{
if (entXform?.GridUid == null)
continue;
UpdateUIState(ent, entConsole, entXform);
}
}
}
public void UpdateUIState
(EntityUid uid,
AtmosMonitoringConsoleComponent component,
TransformComponent xform)
{
if (!_userInterfaceSystem.IsUiOpen(uid, AtmosMonitoringConsoleUiKey.Key))
return;
var gridUid = xform.GridUid!.Value;
if (!TryComp<MapGridComponent>(gridUid, out var mapGrid))
return;
if (!TryComp<GridAtmosphereComponent>(gridUid, out var atmosphere))
return;
// The grid must have a NavMapComponent to visualize the map in the UI
EnsureComp<NavMapComponent>(gridUid);
// Gathering data to be send to the client
var atmosNetworks = new List<AtmosMonitoringConsoleEntry>();
var query = AllEntityQuery<GasPipeSensorComponent, TransformComponent>();
while (query.MoveNext(out var ent, out var entSensor, out var entXform))
{
if (entXform?.GridUid != xform.GridUid)
continue;
if (!entXform.Anchored)
continue;
var entry = CreateAtmosMonitoringConsoleEntry(ent, entXform);
if (entry != null)
atmosNetworks.Add(entry.Value);
}
// Set the UI state
_userInterfaceSystem.SetUiState(uid, AtmosMonitoringConsoleUiKey.Key,
new AtmosMonitoringConsoleBoundInterfaceState(atmosNetworks.ToArray()));
}
private AtmosMonitoringConsoleEntry? CreateAtmosMonitoringConsoleEntry(EntityUid uid, TransformComponent xform)
{
AtmosMonitoringConsoleEntry? entry = null;
var netEnt = GetNetEntity(uid);
var name = MetaData(uid).EntityName;
var address = string.Empty;
if (xform.GridUid == null)
return null;
if (!TryGettingFirstPipeNode(uid, out var pipeNode, out var netId) ||
pipeNode == null ||
netId == null)
return null;
var pipeColor = TryComp<AtmosPipeColorComponent>(uid, out var colorComponent) ? colorComponent.Color : Color.White;
// Name the entity based on its label, if available
if (TryComp<LabelComponent>(uid, out var label) && label.CurrentLabel != null)
name = label.CurrentLabel;
// Otherwise use its base name and network address
else if (TryComp<DeviceNetworkComponent>(uid, out var deviceNet))
address = deviceNet.Address;
// Entry for unpowered devices
if (TryComp<ApcPowerReceiverComponent>(uid, out var apcPowerReceiver) && !apcPowerReceiver.Powered)
{
entry = new AtmosMonitoringConsoleEntry(netEnt, GetNetCoordinates(xform.Coordinates), netId.Value, name, address)
{
IsPowered = false,
Color = pipeColor
};
return entry;
}
// Entry for powered devices
var gasData = new Dictionary<Gas, float>();
var isAirPresent = pipeNode.Air.TotalMoles > 0;
if (isAirPresent)
{
foreach (var gas in Enum.GetValues<Gas>())
{
if (pipeNode.Air[(int)gas] > 0)
gasData.Add(gas, pipeNode.Air[(int)gas] / pipeNode.Air.TotalMoles);
}
}
entry = new AtmosMonitoringConsoleEntry(netEnt, GetNetCoordinates(xform.Coordinates), netId.Value, name, address)
{
TemperatureData = isAirPresent ? pipeNode.Air.Temperature : 0f,
PressureData = pipeNode.Air.Pressure,
TotalMolData = pipeNode.Air.TotalMoles,
GasData = gasData,
Color = pipeColor
};
return entry;
}
private Dictionary<NetEntity, AtmosDeviceNavMapData> GetAllAtmosDeviceNavMapData(EntityUid gridUid)
{
var atmosDeviceNavMapData = new Dictionary<NetEntity, AtmosDeviceNavMapData>();
var query = AllEntityQuery<AtmosMonitoringConsoleDeviceComponent, TransformComponent>();
while (query.MoveNext(out var ent, out var entComponent, out var entXform))
{
if (TryGetAtmosDeviceNavMapData(ent, entComponent, entXform, gridUid, out var data))
atmosDeviceNavMapData.Add(data.Value.NetEntity, data.Value);
}
return atmosDeviceNavMapData;
}
private bool TryGetAtmosDeviceNavMapData
(EntityUid uid,
AtmosMonitoringConsoleDeviceComponent component,
TransformComponent xform,
EntityUid gridUid,
[NotNullWhen(true)] out AtmosDeviceNavMapData? device)
{
device = null;
if (component.NavMapBlip == null)
return false;
if (xform.GridUid != gridUid)
return false;
if (!xform.Anchored)
return false;
var direction = xform.LocalRotation.GetCardinalDir();
if (!TryGettingFirstPipeNode(uid, out var _, out var netId))
netId = -1;
var color = Color.White;
if (TryComp<AtmosPipeColorComponent>(uid, out var atmosPipeColor))
color = atmosPipeColor.Color;
device = new AtmosDeviceNavMapData(GetNetEntity(uid), GetNetCoordinates(xform.Coordinates), netId.Value, component.NavMapBlip.Value, direction, color);
return true;
}
#endregion
#region Pipe net functions
private void RebuildAtmosPipeGrid(EntityUid gridUid, MapGridComponent grid)
{
var allChunks = new Dictionary<Vector2i, AtmosPipeChunk>();
// Adds all atmos pipes to the nav map via bit mask chunks
var queryPipes = AllEntityQuery<AtmosPipeColorComponent, NodeContainerComponent, TransformComponent>();
while (queryPipes.MoveNext(out var ent, out var entAtmosPipeColor, out var entNodeContainer, out var entXform))
{
if (entXform.GridUid != gridUid)
continue;
if (!entXform.Anchored)
continue;
var tile = _sharedMapSystem.GetTileRef(gridUid, grid, entXform.Coordinates);
var chunkOrigin = SharedMapSystem.GetChunkIndices(tile.GridIndices, ChunkSize);
var relative = SharedMapSystem.GetChunkRelative(tile.GridIndices, ChunkSize);
if (!allChunks.TryGetValue(chunkOrigin, out var chunk))
{
chunk = new AtmosPipeChunk(chunkOrigin);
allChunks[chunkOrigin] = chunk;
}
UpdateAtmosPipeChunk(ent, entNodeContainer, entAtmosPipeColor, GetTileIndex(relative), ref chunk);
}
// Add or update the chunks on the associated grid
_gridAtmosPipeChunks[gridUid] = allChunks;
// Update the consoles that are on the same grid
var queryConsoles = AllEntityQuery<AtmosMonitoringConsoleComponent, TransformComponent>();
while (queryConsoles.MoveNext(out var ent, out var entConsole, out var entXform))
{
if (gridUid != entXform.GridUid)
continue;
entConsole.AtmosPipeChunks = allChunks;
Dirty(ent, entConsole);
}
}
private void RebuildSingleTileOfPipeNetwork(EntityUid gridUid, MapGridComponent grid, EntityCoordinates coords)
{
if (!_gridAtmosPipeChunks.TryGetValue(gridUid, out var allChunks))
allChunks = new Dictionary<Vector2i, AtmosPipeChunk>();
var tile = _sharedMapSystem.GetTileRef(gridUid, grid, coords);
var chunkOrigin = SharedMapSystem.GetChunkIndices(tile.GridIndices, ChunkSize);
var relative = SharedMapSystem.GetChunkRelative(tile.GridIndices, ChunkSize);
var tileIdx = GetTileIndex(relative);
if (!allChunks.TryGetValue(chunkOrigin, out var chunk))
chunk = new AtmosPipeChunk(chunkOrigin);
// Remove all stale values for the tile
foreach (var (index, atmosPipeData) in chunk.AtmosPipeData)
{
var mask = (ulong)SharedNavMapSystem.AllDirMask << tileIdx * SharedNavMapSystem.Directions;
chunk.AtmosPipeData[index] = atmosPipeData & ~mask;
}
// Rebuild the tile's pipe data
foreach (var ent in _sharedMapSystem.GetAnchoredEntities(gridUid, grid, coords))
{
if (!TryComp<AtmosPipeColorComponent>(ent, out var entAtmosPipeColor))
continue;
if (!TryComp<NodeContainerComponent>(ent, out var entNodeContainer))
continue;
UpdateAtmosPipeChunk(ent, entNodeContainer, entAtmosPipeColor, tileIdx, ref chunk);
}
// Add or update the chunk on the associated grid
// Only the modified chunk will be sent to the client
chunk.LastUpdate = _gameTiming.CurTick;
allChunks[chunkOrigin] = chunk;
_gridAtmosPipeChunks[gridUid] = allChunks;
// Update the components of the monitoring consoles that are attached to the same grid
var query = AllEntityQuery<AtmosMonitoringConsoleComponent, TransformComponent>();
while (query.MoveNext(out var ent, out var entConsole, out var entXform))
{
if (gridUid != entXform.GridUid)
continue;
entConsole.AtmosPipeChunks = allChunks;
Dirty(ent, entConsole);
}
}
private void UpdateAtmosPipeChunk(EntityUid uid, NodeContainerComponent nodeContainer, AtmosPipeColorComponent pipeColor, int tileIdx, ref AtmosPipeChunk chunk)
{
// Entities that are actively being deleted are not to be drawn
if (MetaData(uid).EntityLifeStage >= EntityLifeStage.Terminating)
return;
foreach ((var id, var node) in nodeContainer.Nodes)
{
if (node is not PipeNode)
continue;
var pipeNode = (PipeNode)node;
var netId = GetPipeNodeNetId(pipeNode);
var pipeDirection = pipeNode.CurrentPipeDirection;
chunk.AtmosPipeData.TryGetValue((netId, pipeColor.Color.ToHex()), out var atmosPipeData);
atmosPipeData |= (ulong)pipeDirection << tileIdx * SharedNavMapSystem.Directions;
chunk.AtmosPipeData[(netId, pipeColor.Color.ToHex())] = atmosPipeData;
}
}
private bool TryGettingFirstPipeNode(EntityUid uid, [NotNullWhen(true)] out PipeNode? pipeNode, [NotNullWhen(true)] out int? netId)
{
pipeNode = null;
netId = null;
if (!TryComp<NodeContainerComponent>(uid, out var nodeContainer))
return false;
foreach (var node in nodeContainer.Nodes.Values)
{
if (node is PipeNode)
{
pipeNode = (PipeNode)node;
netId = GetPipeNodeNetId(pipeNode);
return true;
}
}
return false;
}
private int GetPipeNodeNetId(PipeNode pipeNode)
{
if (pipeNode.NodeGroup is BaseNodeGroup)
{
var nodeGroup = (BaseNodeGroup)pipeNode.NodeGroup;
return nodeGroup.NetId;
}
return -1;
}
#endregion
#region Initialization functions
private void InitializeAtmosMonitoringConsole(EntityUid uid, AtmosMonitoringConsoleComponent component)
{
var xform = Transform(uid);
if (xform.GridUid == null)
return;
var grid = xform.GridUid.Value;
if (!TryComp<MapGridComponent>(grid, out var map))
return;
component.AtmosDevices = GetAllAtmosDeviceNavMapData(grid);
if (!_gridAtmosPipeChunks.TryGetValue(grid, out var chunks))
{
RebuildAtmosPipeGrid(grid, map);
}
else
{
component.AtmosPipeChunks = chunks;
Dirty(uid, component);
}
}
private void InitializeAtmosMonitoringDevice(EntityUid uid, AtmosMonitoringConsoleDeviceComponent component)
{
// Rebuild tile
var xform = Transform(uid);
var gridUid = xform.GridUid;
if (gridUid != null && TryComp<MapGridComponent>(gridUid, out var grid))
RebuildSingleTileOfPipeNetwork(gridUid.Value, grid, xform.Coordinates);
// Update blips on affected consoles
if (component.NavMapBlip == null)
return;
var netEntity = EntityManager.GetNetEntity(uid);
var query = AllEntityQuery<AtmosMonitoringConsoleComponent, TransformComponent>();
while (query.MoveNext(out var ent, out var entConsole, out var entXform))
{
var isDirty = entConsole.AtmosDevices.Remove(netEntity);
if (gridUid != null &&
gridUid == entXform.GridUid &&
xform.Anchored &&
TryGetAtmosDeviceNavMapData(uid, component, xform, gridUid.Value, out var data))
{
entConsole.AtmosDevices.Add(netEntity, data.Value);
isDirty = true;
}
if (isDirty)
Dirty(ent, entConsole);
}
}
private void ShutDownAtmosMonitoringEntity(EntityUid uid, AtmosMonitoringConsoleDeviceComponent component)
{
// Rebuild tile
var xform = Transform(uid);
var gridUid = xform.GridUid;
if (gridUid != null && TryComp<MapGridComponent>(gridUid, out var grid))
RebuildSingleTileOfPipeNetwork(gridUid.Value, grid, xform.Coordinates);
// Update blips on affected consoles
if (component.NavMapBlip == null)
return;
var netEntity = EntityManager.GetNetEntity(uid);
var query = AllEntityQuery<AtmosMonitoringConsoleComponent>();
while (query.MoveNext(out var ent, out var entConsole))
{
if (entConsole.AtmosDevices.Remove(netEntity))
Dirty(ent, entConsole);
}
}
#endregion
private int GetTileIndex(Vector2i relativeTile)
{
return relativeTile.X * ChunkSize + relativeTile.Y;
}
}

View File

@@ -11,6 +11,7 @@ using Content.Server.Power.Components;
using Content.Server.Power.EntitySystems;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Monitor;
using Content.Shared.Atmos.Piping.Components;
using Content.Shared.DeviceNetwork;
using Content.Shared.Power;
using Content.Shared.Tag;

View File

@@ -1,31 +0,0 @@
using Content.Shared.Atmos;
namespace Content.Server.Atmos.Piping.Binary.Components
{
[RegisterComponent]
public sealed partial class GasPressurePumpComponent : Component
{
[ViewVariables(VVAccess.ReadWrite)]
[DataField("enabled")]
public bool Enabled { get; set; } = true;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("inlet")]
public string InletName { get; set; } = "inlet";
[ViewVariables(VVAccess.ReadWrite)]
[DataField("outlet")]
public string OutletName { get; set; } = "outlet";
[ViewVariables(VVAccess.ReadWrite)]
[DataField("targetPressure")]
public float TargetPressure { get; set; } = Atmospherics.OneAtmosphere;
/// <summary>
/// Max pressure of the target gas (NOT relative to source).
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("maxTargetPressure")]
public float MaxTargetPressure = Atmospherics.MaxOutputPressure;
}
}

View File

@@ -1,169 +1,57 @@
using Content.Server.Administration.Logs;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos.Piping.Binary.Components;
using Content.Server.Atmos.Piping.Components;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
using Content.Server.Power.Components;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Piping;
using Content.Shared.Atmos.Piping.Binary.Components;
using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.EntitySystems;
using Content.Shared.Audio;
using Content.Shared.Database;
using Content.Shared.Examine;
using Content.Shared.Interaction;
using Content.Shared.Popups;
using Content.Shared.Power;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Player;
namespace Content.Server.Atmos.Piping.Binary.EntitySystems
namespace Content.Server.Atmos.Piping.Binary.EntitySystems;
[UsedImplicitly]
public sealed class GasPressurePumpSystem : SharedGasPressurePumpSystem
{
[UsedImplicitly]
public sealed class GasPressurePumpSystem : EntitySystem
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!;
[Dependency] private readonly NodeContainerSystem _nodeContainer = default!;
public override void Initialize()
{
[Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly NodeContainerSystem _nodeContainer = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
base.Initialize();
public override void Initialize()
SubscribeLocalEvent<GasPressurePumpComponent, AtmosDeviceUpdateEvent>(OnPumpUpdated);
}
private void OnPumpUpdated(EntityUid uid, GasPressurePumpComponent pump, ref AtmosDeviceUpdateEvent args)
{
if (!pump.Enabled
|| (TryComp<ApcPowerReceiverComponent>(uid, out var power) && !power.Powered)
|| !_nodeContainer.TryGetNodes(uid, pump.InletName, pump.OutletName, out PipeNode? inlet, out PipeNode? outlet))
{
base.Initialize();
SubscribeLocalEvent<GasPressurePumpComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<GasPressurePumpComponent, AtmosDeviceUpdateEvent>(OnPumpUpdated);
SubscribeLocalEvent<GasPressurePumpComponent, AtmosDeviceDisabledEvent>(OnPumpLeaveAtmosphere);
SubscribeLocalEvent<GasPressurePumpComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<GasPressurePumpComponent, ActivateInWorldEvent>(OnPumpActivate);
SubscribeLocalEvent<GasPressurePumpComponent, PowerChangedEvent>(OnPowerChanged);
// Bound UI subscriptions
SubscribeLocalEvent<GasPressurePumpComponent, GasPressurePumpChangeOutputPressureMessage>(OnOutputPressureChangeMessage);
SubscribeLocalEvent<GasPressurePumpComponent, GasPressurePumpToggleStatusMessage>(OnToggleStatusMessage);
_ambientSoundSystem.SetAmbience(uid, false);
return;
}
private void OnInit(EntityUid uid, GasPressurePumpComponent pump, ComponentInit args)
var outputStartingPressure = outlet.Air.Pressure;
if (outputStartingPressure >= pump.TargetPressure)
{
UpdateAppearance(uid, pump);
_ambientSoundSystem.SetAmbience(uid, false);
return; // No need to pump gas if target has been reached.
}
private void OnExamined(EntityUid uid, GasPressurePumpComponent pump, ExaminedEvent args)
if (inlet.Air.TotalMoles > 0 && inlet.Air.Temperature > 0)
{
if (!EntityManager.GetComponent<TransformComponent>(uid).Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status.
return;
// We calculate the necessary moles to transfer using our good ol' friend PV=nRT.
var pressureDelta = pump.TargetPressure - outputStartingPressure;
var transferMoles = (pressureDelta * outlet.Air.Volume) / (inlet.Air.Temperature * Atmospherics.R);
if (Loc.TryGetString("gas-pressure-pump-system-examined", out var str,
("statusColor", "lightblue"), // TODO: change with pressure?
("pressure", pump.TargetPressure)
))
{
args.PushMarkup(str);
}
}
private void OnPowerChanged(EntityUid uid, GasPressurePumpComponent component, ref PowerChangedEvent args)
{
UpdateAppearance(uid, component);
}
private void OnPumpUpdated(EntityUid uid, GasPressurePumpComponent pump, ref AtmosDeviceUpdateEvent args)
{
if (!pump.Enabled
|| (TryComp<ApcPowerReceiverComponent>(uid, out var power) && !power.Powered)
|| !_nodeContainer.TryGetNodes(uid, pump.InletName, pump.OutletName, out PipeNode? inlet, out PipeNode? outlet))
{
_ambientSoundSystem.SetAmbience(uid, false);
return;
}
var outputStartingPressure = outlet.Air.Pressure;
if (outputStartingPressure >= pump.TargetPressure)
{
_ambientSoundSystem.SetAmbience(uid, false);
return; // No need to pump gas if target has been reached.
}
if (inlet.Air.TotalMoles > 0 && inlet.Air.Temperature > 0)
{
// We calculate the necessary moles to transfer using our good ol' friend PV=nRT.
var pressureDelta = pump.TargetPressure - outputStartingPressure;
var transferMoles = (pressureDelta * outlet.Air.Volume) / (inlet.Air.Temperature * Atmospherics.R);
var removed = inlet.Air.Remove(transferMoles);
_atmosphereSystem.Merge(outlet.Air, removed);
_ambientSoundSystem.SetAmbience(uid, removed.TotalMoles > 0f);
}
}
private void OnPumpLeaveAtmosphere(EntityUid uid, GasPressurePumpComponent pump, ref AtmosDeviceDisabledEvent args)
{
pump.Enabled = false;
UpdateAppearance(uid, pump);
DirtyUI(uid, pump);
_userInterfaceSystem.CloseUi(uid, GasPressurePumpUiKey.Key);
}
private void OnPumpActivate(EntityUid uid, GasPressurePumpComponent pump, ActivateInWorldEvent args)
{
if (args.Handled || !args.Complex)
return;
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
return;
if (Transform(uid).Anchored)
{
_userInterfaceSystem.OpenUi(uid, GasPressurePumpUiKey.Key, actor.PlayerSession);
DirtyUI(uid, pump);
}
else
{
_popup.PopupCursor(Loc.GetString("comp-gas-pump-ui-needs-anchor"), args.User);
}
args.Handled = true;
}
private void OnToggleStatusMessage(EntityUid uid, GasPressurePumpComponent pump, GasPressurePumpToggleStatusMessage args)
{
pump.Enabled = args.Enabled;
_adminLogger.Add(LogType.AtmosPowerChanged, LogImpact.Medium,
$"{ToPrettyString(args.Actor):player} set the power on {ToPrettyString(uid):device} to {args.Enabled}");
DirtyUI(uid, pump);
UpdateAppearance(uid, pump);
}
private void OnOutputPressureChangeMessage(EntityUid uid, GasPressurePumpComponent pump, GasPressurePumpChangeOutputPressureMessage args)
{
pump.TargetPressure = Math.Clamp(args.Pressure, 0f, Atmospherics.MaxOutputPressure);
_adminLogger.Add(LogType.AtmosPressureChanged, LogImpact.Medium,
$"{ToPrettyString(args.Actor):player} set the pressure on {ToPrettyString(uid):device} to {args.Pressure}kPa");
DirtyUI(uid, pump);
}
private void DirtyUI(EntityUid uid, GasPressurePumpComponent? pump)
{
if (!Resolve(uid, ref pump))
return;
_userInterfaceSystem.SetUiState(uid, GasPressurePumpUiKey.Key,
new GasPressurePumpBoundUserInterfaceState(EntityManager.GetComponent<MetaDataComponent>(uid).EntityName, pump.TargetPressure, pump.Enabled));
}
private void UpdateAppearance(EntityUid uid, GasPressurePumpComponent? pump = null, AppearanceComponent? appearance = null)
{
if (!Resolve(uid, ref pump, ref appearance, false))
return;
bool pumpOn = pump.Enabled && (TryComp<ApcPowerReceiverComponent>(uid, out var power) && power.Powered);
_appearance.SetData(uid, PumpVisuals.Enabled, pumpOn, appearance);
var removed = inlet.Air.Remove(transferMoles);
_atmosphereSystem.Merge(outlet.Air, removed);
_ambientSoundSystem.SetAmbience(uid, removed.TotalMoles > 0f);
}
}
}

View File

@@ -6,6 +6,7 @@ using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Piping;
using Content.Shared.Atmos.Piping.Components;
using Content.Shared.Audio;
using Content.Shared.Examine;
using JetBrains.Annotations;

View File

@@ -10,6 +10,7 @@ using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
using Content.Server.Power.Components;
using Content.Shared.Atmos.Piping.Binary.Components;
using Content.Shared.Atmos.Piping.Components;
using Content.Shared.Atmos.Visuals;
using Content.Shared.Audio;
using Content.Shared.Database;

View File

@@ -67,15 +67,3 @@ public readonly struct AtmosDeviceUpdateEvent(float dt, Entity<GridAtmosphereCom
/// </summary>
public readonly Entity<MapAtmosphereComponent?>? Map = map;
}
/// <summary>
/// Raised directed on an atmos device when it is enabled.
/// </summary>
[ByRefEvent]
public record struct AtmosDeviceEnabledEvent;
/// <summary>
/// Raised directed on an atmos device when it is enabled.
/// </summary>
[ByRefEvent]
public record struct AtmosDeviceDisabledEvent;

View File

@@ -1,19 +1,24 @@
using Content.Server.Atmos.Piping.EntitySystems;
using JetBrains.Annotations;
namespace Content.Server.Atmos.Piping.Components
{
[RegisterComponent]
public sealed partial class AtmosPipeColorComponent : Component
{
[DataField("color")]
public Color Color { get; set; } = Color.White;
namespace Content.Server.Atmos.Piping.Components;
[ViewVariables(VVAccess.ReadWrite), UsedImplicitly]
public Color ColorVV
{
get => Color;
set => IoCManager.Resolve<IEntityManager>().System<AtmosPipeColorSystem>().SetColor(Owner, this, value);
}
[RegisterComponent]
public sealed partial class AtmosPipeColorComponent : Component
{
[DataField]
public Color Color { get; set; } = Color.White;
[ViewVariables(VVAccess.ReadWrite), UsedImplicitly]
public Color ColorVV
{
get => Color;
set => IoCManager.Resolve<IEntityManager>().System<AtmosPipeColorSystem>().SetColor(Owner, this, value);
}
}
[ByRefEvent]
public record struct AtmosPipeColorChangedEvent(Color color)
{
public Color Color = color;
}

View File

@@ -1,6 +1,7 @@
using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos.Piping.Components;
using Content.Shared.Atmos.Piping.Components;
using JetBrains.Annotations;
using Robust.Shared.Timing;
using Robust.Shared.Utility;

View File

@@ -40,6 +40,9 @@ namespace Content.Server.Atmos.Piping.EntitySystems
return;
_appearance.SetData(uid, PipeColorVisuals.Color, color, appearance);
var ev = new AtmosPipeColorChangedEvent(color);
RaiseLocalEvent(uid, ref ev);
}
}
}

View File

@@ -1,6 +1,7 @@
using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos.Piping.Components;
using Content.Server.NodeContainer;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
using Content.Server.Popups;
using Content.Shared.Atmos;
@@ -8,7 +9,6 @@ using Content.Shared.Construction.Components;
using Content.Shared.Destructible;
using Content.Shared.Popups;
using JetBrains.Annotations;
using Robust.Shared.Player;
namespace Content.Server.Atmos.Piping.EntitySystems
{
@@ -16,11 +16,12 @@ namespace Content.Server.Atmos.Piping.EntitySystems
public sealed class AtmosUnsafeUnanchorSystem : EntitySystem
{
[Dependency] private readonly AtmosphereSystem _atmosphere = default!;
[Dependency] private readonly NodeGroupSystem _group = default!;
[Dependency] private readonly PopupSystem _popup = default!;
public override void Initialize()
{
SubscribeLocalEvent<AtmosUnsafeUnanchorComponent, BeforeUnanchoredEvent>(OnBeforeUnanchored);
SubscribeLocalEvent<AtmosUnsafeUnanchorComponent, UserUnanchoredEvent>(OnUserUnanchored);
SubscribeLocalEvent<AtmosUnsafeUnanchorComponent, UnanchorAttemptEvent>(OnUnanchorAttempt);
SubscribeLocalEvent<AtmosUnsafeUnanchorComponent, BreakageEventArgs>(OnBreak);
}
@@ -48,15 +49,22 @@ namespace Content.Server.Atmos.Piping.EntitySystems
}
}
private void OnBeforeUnanchored(EntityUid uid, AtmosUnsafeUnanchorComponent component, BeforeUnanchoredEvent args)
// When unanchoring a pipe, leak the gas that was inside the pipe element.
// At this point the pipe has been scheduled to be removed from the group, but that won't happen until the next Update() call in NodeGroupSystem,
// so we have to force an update.
// This way the gas inside other connected pipes stays unchanged, while the removed pipe is completely emptied.
private void OnUserUnanchored(EntityUid uid, AtmosUnsafeUnanchorComponent component, UserUnanchoredEvent args)
{
if (component.Enabled)
{
_group.ForceUpdate();
LeakGas(uid);
}
}
private void OnBreak(EntityUid uid, AtmosUnsafeUnanchorComponent component, BreakageEventArgs args)
{
LeakGas(uid);
LeakGas(uid, false);
// Can't use DoActsBehavior["Destruction"] in the same trigger because that would prevent us
// from leaking. So we make up for this by queueing deletion here.
QueueDel(uid);
@@ -64,32 +72,17 @@ namespace Content.Server.Atmos.Piping.EntitySystems
/// <summary>
/// Leak gas from the uid's NodeContainer into the tile atmosphere.
/// Setting removeFromPipe to false will duplicate the gas inside the pipe intead of moving it.
/// This is needed to properly handle the gas in the pipe getting deleted with the pipe.
/// </summary>
public void LeakGas(EntityUid uid)
public void LeakGas(EntityUid uid, bool removeFromPipe = true)
{
if (!EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodes))
return;
if (_atmosphere.GetContainingMixture(uid, true, true) is not {} environment)
if (_atmosphere.GetContainingMixture(uid, true, true) is not { } environment)
environment = GasMixture.SpaceGas;
var lost = 0f;
var timesLost = 0;
foreach (var node in nodes.Nodes.Values)
{
if (node is not PipeNode pipe)
continue;
var difference = pipe.Air.Pressure - environment.Pressure;
lost += Math.Min(
pipe.Volume / pipe.Air.Volume * pipe.Air.TotalMoles,
difference * environment.Volume / (environment.Temperature * Atmospherics.R)
);
timesLost++;
}
var sharedLoss = lost / timesLost;
var buffer = new GasMixture();
foreach (var node in nodes.Nodes.Values)
@@ -97,7 +90,13 @@ namespace Content.Server.Atmos.Piping.EntitySystems
if (node is not PipeNode pipe)
continue;
_atmosphere.Merge(buffer, pipe.Air.Remove(sharedLoss));
if (removeFromPipe)
_atmosphere.Merge(buffer, pipe.Air.RemoveVolume(pipe.Volume));
else
{
var copy = new GasMixture(pipe.Air); //clone, then remove to keep the original untouched
_atmosphere.Merge(buffer, copy.RemoveVolume(pipe.Volume));
}
}
_atmosphere.Merge(environment, buffer);

View File

@@ -7,6 +7,7 @@ using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Piping;
using Content.Shared.Atmos.Piping.Components;
using Content.Shared.Atmos.Piping.Trinary.Components;
using Content.Shared.Audio;
using Content.Shared.Database;

View File

@@ -7,6 +7,7 @@ using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Piping;
using Content.Shared.Atmos.Piping.Components;
using Content.Shared.Atmos.Piping.Trinary.Components;
using Content.Shared.Audio;
using Content.Shared.Database;

View File

@@ -5,6 +5,7 @@ using Content.Server.NodeContainer;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
using Content.Shared.Atmos.Piping;
using Content.Shared.Atmos.Piping.Components;
using Content.Shared.Audio;
using JetBrains.Annotations;

View File

@@ -44,11 +44,6 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
return;
portableNode.ConnectionsEnabled = args.Anchored;
if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance))
{
_appearance.SetData(uid, GasPortableVisuals.ConnectedState, args.Anchored, appearance);
}
}
public bool FindGasPortIn(EntityUid? gridId, EntityCoordinates coordinates, [NotNullWhen(true)] out GasPortComponent? port)

View File

@@ -11,6 +11,7 @@ using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Monitor;
using Content.Shared.Atmos.Piping.Components;
using Content.Shared.Atmos.Piping.Unary;
using Content.Shared.Atmos.Piping.Unary.Components;
using Content.Shared.Atmos.Visuals;

Some files were not shown because too many files have changed in this diff Show More