Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] Fixes Dead Lingering Ghost-Control Mobs #615

Merged
merged 1 commit into from
Nov 14, 2023

Conversation

Steals-The-PRs
Copy link
Collaborator

Mirrored on Skyrat: Skyrat-SS13/Skyrat-tg#24987
Original PR: tgstation/tgstation#79615

About The Pull Request

Fixes #79008

This is the same method bots use (though a bit more extravagant)- the component is meant to delete itself when a user assumes control but it had no cases for deleting itself on the user's death. This component already has so many args that I don't particularly feel like adding another one for qdel_ourselves_on_mob_death or whatever so let's just repeat the pattern we already have going on for the time being.

Why It's Good For The Game

Fixes bug.

Changelog

🆑 san7890
fix: Gorillas and Regal Rats will no longer show up in the ghost-control menu if they died without anyone ever taking control of them.
/:cl:

* Fixes Dead Lingering Ghost-Control Mobs (#79615)

## About The Pull Request

Fixes #79008

This is the same method bots use (though a bit more extravagant)- the
component is meant to delete itself when a user assumes control but it
had no cases for deleting itself on the user's death. This component
already has so many args that I don't particularly feel like adding
another one for `qdel_ourselves_on_mob_death` or whatever so let's just
repeat the pattern we already have going on for the time being.
## Why It's Good For The Game

Fixes bug.
## Changelog
:cl:
fix: Gorillas and Regal Rats will no longer show up in the ghost-control
menu if they died without anyone ever taking control of them.
/:cl:

* Fixes Dead Lingering Ghost-Control Mobs

---------

Co-authored-by: san7890 <[email protected]>
@ReezeBL ReezeBL merged commit fd611ed into master Nov 14, 2023
24 checks passed
@ReezeBL ReezeBL deleted the upstream-mirror-24987 branch November 14, 2023 08:02
AnywayFarus added a commit that referenced this pull request Nov 14, 2023
Iajret pushed a commit that referenced this pull request Jan 25, 2024
* Improves upon setting custom materials for printed items (#81015)

## About The Pull Request
This is an improvement on #80839 regarding how custom materials are set
on items, it's based on the following findings.

1. `set_custom_materials()` proc already comes with an prebuilt
`multiplier` var

https://github.com/tgstation/tgstation/blob/1e8d511946d194f92f744f5f957a7c41683d84a6/code/game/atom/atom_materials.dm#L11
This means we can pass the machine's cost coefficiency directly to this
proc rather than creating our own list of materials with their values
scaled by the factor like so

https://github.com/tgstation/tgstation/blob/1e8d511946d194f92f744f5f957a7c41683d84a6/code/game/machinery/autolathe.dm#L192-L193
We can instead just do `set_custom_materials(design.materials,
material_cost_coefficient)` without ever needing this list, thus making
code cleaner, with that the changes propogate to how `has_materials()` &
`use_materials()` procs are also used as we can now use their
`coefficiency` param rather than seeing it go to waste

2. All items custom materials will now always be integer values. With
this `SSmaterials.FindOrCreateMaterialCombo` now has better performance
because when computing the key for caching values like `1.5` or `1.7` it
will become just `1` and will point to the same cache thus reducing
memory usage

3. Materials are now uniformly split among all the contents of a printed
item from techfab or autolathe. What this means is items like the foam
ammo box printed from autolathe will have both the ammo case and their
40 bullets each set with custom materials such that their final sum
becomes equal to the design cost. For info on how that's done see the
documentation of `split_materials_uniformly` proc.

One downside of this proc is when items have a very small amount of
`custom_materials`(less than 2). In that case values like `0.8` or `1.5`
or `1.7` ends up getting rounded to 1 which means you end up getting
less materials when recycling than what you used for printing that item.
In this case You get 0.48 iron from both the box & it's ammo instead of
0.79 iron used for printing in tier1 autolathe(Or 0.50 for tier4
autolathe).
    
This shouldn't be an issue as you still can't make any profits from this
but at least everything in the box is now recyclable.

## Changelog
:cl:
fix: items that contain recursive contents inside them (like foam dart
boxes from autolathes) now have their custom materials set to match with
its design cost rather than being nullified, meaning they are now
recyclable.
code: all custom materials are now integer values. Improved code for how
materials are used in techfab & auto lathe for printing
/:cl:

* Improves upon setting custom materials for printed items

---------

Co-authored-by: SyncIt21 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants