Commit Graph

16 Commits

Author SHA1 Message Date
Bloop acaae89cf6 Removes some cargo culty global lists that don't need to be global lists (#94531)
## About The Pull Request

Not really sure why these were there storing the lists in memory
permanently, when these just get consumed anyway. People copy paste them
all over it seems so I'm going to put a stop to that.

## Why It's Good For The Game

Cleans up like 7 years of cargo cult.

## Changelog

Not player-facing
2025-12-19 10:14:57 -05:00
Tim f27682c7e4 Add admin debug goggles to show area blueprints (#91879)
## About The Pull Request
This adds an admin version of meson goggles that lets someone see the
area overlays.


![dreamseeker_yUcjxWEcM8](https://github.com/user-attachments/assets/39f237ea-5d40-4799-a827-7c3b2b9d9eaf)

It has also been added to the admin debug tools.

## Why It's Good For The Game
Useful for construction projects.

## Changelog
🆑
admin: Add admin debug goggles that lets you see area overlays which is
useful for construction projects.
image: Add icons for admin debug goggles (which is just a reskinned
color version of mesons)
code: Improve meson code to be more robust
/🆑
2025-10-05 12:44:15 -07:00
Tim 70463dcb59 Add GPS debug tool to admin debug box (#92925)
## About The Pull Request
This adds the existing GPS debug tool to the admin debug box that
displays x, y, z coordinates on a turf that is somewhat useful when
testing z-level boundaries.

<img width="1920" height="1080" alt="dreamseeker_NyC1iJ4SPK"
src="https://github.com/user-attachments/assets/a7153fa5-5195-4500-8aa7-57584d19fe85"
/>

## Why It's Good For The Game
Easier debug tools for testing.

## Changelog
🆑
qol: The GPS debug tool will now spawn with the admin outfit apart of
the debug tools
admin: Add GPS debug tool to admin debug box
/🆑
2025-09-10 19:53:53 -07:00
SyncIt21 9bd45e2f3a Part 3: Storage Improvements (#90476)
Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com>
Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com>
2025-04-20 12:02:29 +00:00
SmArtKar 6b83a91956 Revert "Refactor for storage initialization & organization (#89543)" (#90332)
## About The Pull Request

Reverts the storage initialization refactor and all subsequent related
PRs.
The original PR is below our standards both for code quality and
testing, and is majorly flawed at its core. This has been discussed with
other maintainers and headcoder(s?) over on discord. A lot of changes
from the PR could be brought over later, but in its current state it
should not have been merged.

- Closes #90322
- Closes #90313
- Closes #90315
- Closes #90320
- Closes #90312
- Closes #90344

## Why It's Good For The Game

This PR causes a series of major issues which cannot be resolved without
either completely rewriting a lot of the original PR, or bad code.
Not matching our standards is grounds for not merging a PR, and the fact
that a PR should not have been merged is a reason for a revert.

## Changelog
🆑
fix: Fixed a series of storage-related bugs caused by a refactor PR.
/🆑
2025-03-30 21:30:31 +00:00
SyncIt21 0f57a23830 Refactor for storage initialization & organization (#89543)
## About The Pull Request
A Huge chunk of changes just comes from moving existing storage code
into new files & seperating `atom_storage` code into its own subtype
under the already existing `storage/subtypes` folder.

With that the changes in this PR can be organized into 3 categories.

**1. Refactors how `/obj/item/storage/PopulateContents()` initializes
storages**
- Fixes #88747 and every other storage item that has a similar variant
of this problem

The problem with `PopulateContents()` is that it allows you to create
atoms directly inside the storage via `new(src)` thus bypassing all the
access restrictions enforced by `/datum/storage/can_insert()` resulting
in storages holding stuff they shouldn't be able to hold.

Now how this proc works has been changed. It must now only return a list
of items(each item in the list can either be a typepath or a solid atom
or a mix of them in any order) that should be inserted into the storage.
Each item is then passed into `can_insert()` to check if it can fit in
the storage.

If your list contains solid atoms they must be first moved
to/Initialized in nullspace so `can_insert()` won't count it as already
inserted. `can_insert()` has now also been refactored to throw stack
traces but explaining exactly why the item could not fit in the storage
thus giving you more debugging details to fix your stuff.

A large majority of changes is refactoring `PopulateContents()` to
return a list instead of simply creating the item in place so simple 1
line changes & with that we have fixed all broken storages(medical
toolbox. electrical toolbox, cruisader armor boxes & many more) that
hold more items they can handle

**2. Organizes initialization of `atom_storage` for storage subtypes.**
All subtypes of `/obj/item/storage` should(not enforced) create their
own `/datum/storage/` subtype under the folder `storage/subtypes` if the
default values are not sufficient. This is the 2nd change done across
all existing storages

Not only does this bring code cleanliness & organization (separating
storage code from item code like how `/datum/wire` code is separated
into its own sub folder) but it also makes storage initialization
slightly faster (because you are not modifying default values after
`atom_storage` is initialized but you are directly setting the default
value in place).

You now cannot & should not modify `atom_storage` values inside
`PopulateContents()`. This will make that proc as pure as possible so
less side effects. Of course this principle is not enforced and you can
still modify the storage value after `Initialize()` but this should not
be encouraged in the future

**3. Adds support for automatic storage computations**
Most people don't understand how `atom_storage` values work. The comment
here clearly states that

https://github.com/tgstation/tgstation/blob/55bbfef0da70d87455ca8d6fd5c95107eb8dbefb/code/game/objects/items/storage/toolbox.dm#L327-L329
Because of that the linked issue occurs not just for medical toolbox but
for a lot of other items as well.

Which is why if you do not know what you doing, `PopulateContents()` now
comes with a new storage parameter i.e. `/datum/storage_config`

This datum allows you to compute storage values that will perfectly fit
with the initial contents of your storage. It allows you to do stuff
like computing `max_slots`, `max_item_weight`, `max_total_weight` etc
based on your storage initial contents so that all the contents can fit
perfectly leaving no space for excess.

## Changelog
🆑
fix: storages are no longer initialized with items that can't be put
back in after taking them out
refactor: storage initialization has been refactored. Please report bugs
on github
/🆑
2025-03-23 22:20:23 +01:00
Wallem 07af87e47e Swaps box/material for a bag (#89393)
## About The Pull Request
Removes `box/material`, and instead turns it into `bag/debug`. Replaces
the box in the debug toolkit box, and places a bag in the little science
room of runtimestation.
## Why It's Good For The Game
Manually putting sheets into runtimestation's ore silo--or having to
spawn in a sheet snatcher to do it for me--is really annoying, Now
instead we can just pick up the bag and shove it in and be done with it.
## Changelog
Not player facing
2025-02-10 18:22:31 -07:00
Tim 78ff108529 Sound Optimizations and Debug Tools (#88517)
## About The Pull Request
I was digging through sound code trying to add a few misc `.ogg`'s when
I noticed a horrifying revelation. Sound calculations are broken as
fuck. At first I didn't think it was a big deal until I remembered this
comment in another PR:


![chrome_6rspeYVig1](https://github.com/user-attachments/assets/04c3fa79-c267-43ae-a77f-85b0e8d3108f)

I asked for the profile logs:

```
                                                           Profile results (total time)
Proc Name                                                                                          Self CPU    Total CPU    Real Time     Overtime        Calls
----------------------------------------------------------------------------------------------    ---------    ---------    ---------    ---------    ---------
/proc/playsound                                                                                       4.771       26.841       26.902        0.347       153938
/mob/proc/playsound_local                                                                             9.511       15.689       15.891        0.724       429391

/mob/living/say                                                                                       0.125       19.064       19.945        0.000         2550
/mob/living/carbon/updatehealth                                                                       0.878        8.305        8.341        0.013        49847
/mob/living/carbon/proc/handle_organs                                                                 1.486        9.263        9.300        0.000        70977
/obj/item/organ/internal/on_life                                                                      0.415        0.455        0.561        0.000       340312
/mob/living/carbon/Life                                                                               0.758       30.085       30.123        0.000        71933
/mob/living/proc/Life                                                                                 5.509       39.404       39.512        0.000       401951
```


Yeah, that is _really_ bad. Especially since it is a hot proc that is
used half a million times. Optimizing this would help a decent amount.
So now you are probably wondering, what exactly is the problem?! Let's
take a look.

https://www.desmos.com/calculator/sqdfl8ipgf

Sounds are being broadcast on a large radius which is typically about
~17 tiles. Since the volume of a sound is reduced by distance, the
further away the sound is, the quieter it becomes. You would think, hey
that's fine! Sounds become inaudible at the 17 tile distance limit
right? Except no, they generally become inaudible about 2/3rds of the
way there. (~10 tile range) Sound volume is between 1-100. When the
sound volume is lower than 3, it becomes (pretty much) inaudible.

This means most of the sounds that are being spammed in game everywhere,
you can't even hear!!!

To fix this we used two major optimizations:

1. Add a `SOUND_AUDIBLE_VOLUME_MIN` to ignore any sound lower than this
volume and calculate an audible distance
2. Use the new audible distance to drastically shorten the tile range of
mob listeners using `get_hearers_in_view()`

To give you an idea of how much better this is:

Sounds that had a range of 17x17 (289 turfs) are now 12x12 (144 turfs).
There is also large range machinery like the SM that has a 40x40 (1600
turfs) that is now 30x30 (900 turfs).

It's quite an improvement.

I also went and added a debugging tool to the admin/debug equipment set
that can be found in the debug box. It is a pair of earmuffs that when
worn has any sounds sent to the mob via a `to_chat` message displaying
the sounds max range, distance from player, volume, and sound name. It
is highly recommend to walk while wearing the earmuffs since walking
stops your mob from emitting footstep sounds.

## Why It's Good For The Game
The speed of sound is now faster than ever. Please don't break the sound
barrier.

## Changelog
🆑
refactor: Sound has been heavily optimized and will now ignore low
volume sounds from far away.
admin: Add debugging sound earmuffs to admin equipment inside the debug
box. Wear them to determine a sounds max range, distance, volume, and
sound name. Highly recommended to walk otherwise you will get spammed
with footstep sounds.
/🆑
2024-12-27 18:42:51 -08:00
lessthanthree d1a37bd047 Sticker packs/Chief Engineer sticker (#86154)
## About The Pull Request

- Changes sticker container from a generic box to a specialised 'sticker
pack' with label
- Adds a Chief Engineer seal of approval sticker


![image](https://github.com/user-attachments/assets/7b1d8789-6a06-46ec-a2a3-be4272eb5268)

## Why It's Good For The Game

The CE can now quell crew concerns about machinery they find in the
hallway

Before:


![ce_sticker_1](https://github.com/user-attachments/assets/0e7c1752-743f-4b6a-8e5c-8627a3f11d82)

After:


![ce_sticker_2](https://github.com/user-attachments/assets/82f74a09-f007-45ad-8dcd-f70840681ba6)

## Changelog

🆑 LT3
add: Added Chief Engineer SEAL OF APPROVAL sticker
code: Stickers now come in sticker packs, not boxes
code: Stickers can now add examine text to whatever they're stuck on
/🆑
2024-09-04 12:22:47 +02:00
VexingRaven 55a5a05d7b Fix the materials box dropping its contents on creation (#82892)
## About The Pull Request
This fixes the materials box (part of the debug box/admin outfit)
dropping its contents everywhere. The issue is that these stacks will
merge during `PopulateContents` as part of the parent call to
`/obj/item/storage/Initialize` before
`/obj/item/storage/box/material/Initialize` has a chance to change the
size of the box.
## Why It's Good For The Game
Fixes #82705
## Changelog
🆑 VexingRaven
fix: The debug box no longer spills its contents everywhere
/🆑
2024-04-28 22:13:42 +02:00
Helg2 2a02cb536c Increases throwing weapons box storage to fit reinforced bolas and stuff it spawns with. (#76482)
## About The Pull Request

- Increased box with throwing weapons storage to fit the things it
spawns with, such as reinforced bolas.
- Increased debug boxes to fit other boxes and the items it spawns with
too.
## Why It's Good For The Game
Less bluespace magic.
## Changelog
🆑
qol: Box with throwing weapons now can hold the items it spawns with.
Incredible!
admin: Boxex of materials, debugtools and stabilized extracts now 99 of
total storage because they are meant to be debug.
/🆑
2023-07-02 20:12:18 +02:00
ArcaneMusic f2fd69a49a Minerals have been refactored so costs and minerals in items are now in terms of mineral defines. (#75052)
Ladies, Gentlemen, Gamers. You're probably wondering why I've called you
all here (through the automatic reviewer request system). So, mineral
balance! Mineral balance is less a balance and more of a nervous white
dude juggling spinning plates on a high-wire on his first day. The fact
it hasn't failed after going on this long is a miracle in and of itself.

This PR does not change mineral balance. What this does is moves over
every individual cost, both in crafting recipes attached to an object
over to a define based system. We have 3 defines:

`sheet_material_amount=2000` . Stock standard mineral sheet. This being
our central mineral unit, this is used for all costs 2000+.
`half_sheet_material_amount=1000` . Same as above, but using iron rods
as our inbetween for costs of 1000-1999.
`small_material_amount=100` . This hits 1-999. This covers... a
startlingly large amount of the codebase. It's feast or famine out here
in terms of mineral costs as a result, items are either sheets upon
sheets, or some fraction of small mats.

Shout out to riot darts for being the worst material cost in the game. I
will not elaborate.

Regardless, this has no functional change, but it sets the groundwork
for making future changes to material costs much, MUCH easier, and moves
over to a single, standardized set of units to help enforce coding
standards on new items, and will bring up lots of uncomfortable balance
questions down the line.

For now though, this serves as some rough boundaries on how items costs
are related, and will make adjusting these values easier going forward.

Except for foam darts.

I did round up foam darts.

Adjusting mineral balance on the macro scale will be as simple as
changing the aforementioned mineral defines, where the alternative is a
rats nest of magic number defines. ~~No seriously, 11.25 iron for a foam
dart are you kidding me what is the POINT WHY NOT JUST MAKE IT 11~~

Items individual numbers have not been adjusted yet, but we can
standardize how the conversation can be held and actually GET SOMEWHERE
on material balance as opposed to throwing our hands up or ignoring it
for another 10 years.
2023-05-03 14:44:51 +00:00
Jack Edge 5a3875dacc Fix fancy boxes to fold like regular boxes (#73406)
🆑 coiax
fix: Folding a "fancy box" like donut or candles will now put cardboard
in your hand, rather than on the floor.
fix: You can always see how many pickles are in a jar of pickles, or
rolling papers there are in a pack of rolling papers, since it's not
possible to close them.
/🆑

Currently, folding a "fancy box", one where the contents are visible in
the icon, like a donut or candle box, the cardboard will drop on the
floor.

The `attack_self()` proc between the two types of boxes have been
unified.

In addition, the `is_open` for fancy boxes has been expanded to include
the "always open" option, where the contents of the box are always
countable on examine, and the box does not have a closed appearance.
Candle boxes previously special cased the `attack_self()` proc, and with
this addition, no longer need to.

## Why It's Good For The Game

Consistency in box interaction. Cardboard in hand. Always can count
pickles.
2023-02-18 13:44:17 -07:00
John Willard 2425531eb2 Removes tablets (not PDAs) entirely. (#71507)
## About The Pull Request

**Comes with an UpdatePaths!**

Removes the tablet subtype, PDAs now replaces them entirely.

Nukie and Silicon tablets are now subtypes of the PDA instead, while
contractor ones were removed entirely as they didn't do anything and
were unused (though it wouldn't be hard to re-add).

Nukie PDAs are now the only type of PDA that uses modular_tablets.dmi,
which is just larger icons of modular_pda. Each application requires an
icon state in both of these, for 2 different sizes, which makes it
annoying to make new applications, especially if it can also run on
computers/laptops.

### Icons

Because Silicon tablets are now a subtype of PDA, they use PDA icons
instead of tablet ones. Luckily for us, they already exist in code.

![image](https://user-images.githubusercontent.com/53777086/203876575-56eb1593-774c-47c6-8e7d-491a7805f28c.png)

AI's don't use a tablet icon though, so they aren't affected.

## Why It's Good For The Game

There's very little difference between tablets and PDAs, PDAs overshadow
them in every single way, so at this point I don't see why we should
have both of these, and if you compare the two in usefulness and actual
in-game use by players, it's a no-brainer than the item all players get
roundstart and comes with a messenger should be the one we go with.

Also as said in the about section, when making an app you would need to
make icon states for the program running for all hardware it can run on,
which is Computer, Laptop, PDA, and Tablet.

Laptop is just a smaller computer icon
PDA is just a smaller tablet icon

However, you can't simply shrink the size of the icon, instead you have
to completely resprite the same app icon FOUR TIMES for it to not
bluescreen on all these different devices.

<details>
<summary>
Here's examples of it
</summary>
Computer (NOTE: *They share the same icon file as regular computers*)
<img
src="https://user-images.githubusercontent.com/53777086/203876801-486a8054-489a-4983-bdad-a2599b4dc379.png"/>
Laptop
<img
src="https://user-images.githubusercontent.com/53777086/203876333-58e5d135-f4c6-4a02-8948-1df771e294a4.png"/>
Tablet
<img
src="https://user-images.githubusercontent.com/53777086/203876352-816c7fb1-c681-40b9-99e0-052f49632c7f.png"/>
PDA
<img
src="https://user-images.githubusercontent.com/53777086/203876358-1cf7253d-3c6a-456a-8133-ebf7f0351637.png"/>
</details>

If we wish to help in simplifying this, we should remove tablet icons
entirely, which means 1 less icon to worry about. To do this, we'd need
to resprite nukie PDAs, however I am very much not a spriter and never
tried GAGS, so I'll leave it to someone else to do.

## Changelog

🆑
del: Tablets are now removed, PDAs are now the base 'tablet'. Silicon
and nukie tablets are now PDAs.
/🆑
2022-12-02 00:15:14 -08:00
John Willard ca229574f6 Removes AI and Charge parts from tablets, adds support for more later. (#70012)
* Removes recharger tablet parts

Removes 'advanced' tablet subtypes that we used before PDAs were added, in some jobs.
Replaces Roboticist's advanced tablet mail with a laptop
Moves the notepad's note var from the tablet, to the note app
Moves modular computer's defines into their own file

Machine computers now directly use power from the machine they're in, while the rest uses power cells.
Silicon tablets don't use power at all.

Co-authored-by: san7890 <the@san7890.com>
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
2022-09-22 20:58:20 -07:00
san7890 42ec99a1b4 Preset Boxes File De-concatenation (#69753)
* Preset Boxes File De-concatenation

Hey there,

We had one file that was like eighteen-hundred (1800) lines full of just... box presets. There was no rhyme or reason to where anything was in the list, it just sorta got to the point where new features were found near the bottom with zero grouping. So, let's de-concatenate this massive file and give it some proper grouping.

While I was in the area, I did some file cleanup, using `snake_case` instead of whatever the fuck some vars were, alphabetizing and cleaning up lists to have trailing commas, that sorta stuff. Let me know if I broke something somewhere.

* documentations, var improvement

* adds some documentation, clears up some variables
2022-09-08 09:15:58 -04:00