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

simplifying materials code #212

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

BatElite
Copy link
Collaborator

@BatElite BatElite commented Oct 13, 2023

About the PR

In an effort to reduce the complexity of materials code, now that materials are largely shared:

-getProperty can no longer mass the max/min of the property instead of the current value, because nothing ever used it (why would they)

-Removed default, min and max values from material properties. The first was unused and the latter weren't ever anything other than 1 and 100, so those values have been baked into setProperty

-The material properties cache is now associative by id (["hard"] = /datum/material_property/hardness)

-The properties var on material datums is now and associative list of id and value (["hard"] = value), no more material_property datums in there

-removed unused value var from materials (ore pricing is done through commodities and not mats themselves)

Why's this needed?

Much of this code is set up for mutable materials, which we're not supporting so we may as well reduce it

Although AFAIK materials getters/setters aren't a bottleneck, there's a bunch less looping involved now.

Getting stats out of a material was weirdly involved too. It should be more straightforward.

material_property datums are singletons so there's not really a point in materials keeping references to them (and certainly not in the confusing way they did)

The new code will probably break if you misspell any property id though

Changelog

(u)BatElite
(*)TBD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant