Teardown-Issue-Tracker-Maintainers / Teardown-Issue-Tracker

A public repo for the community to track issues/bugs/feature requests in Teardown.
11 stars 6 forks source link

[Feature] Flag specific tags to be inheritable #548

Open YuLun-bili opened 2 months ago

YuLun-bili commented 2 months ago

Is your feature request related to a problem (if not, explain why you think this feature should be added)? Please describe.

The undocumented tag inherittags would allow shape and body type entities' tag being inherited by child shapes/bodies created upon breaking apart (e.g.: structure collapses). The tag itself works perfectly fine but if several scripts all want to use tag inheritance for different objectives at the same time, outcome would be very likely unexpected: one may remove inherittags while another trying to add, or one may choose some bodies to add while another adds to all.

Describe the solution you'd like

Add a flag for "inheritability" to tags and a 4th parameter to function SetTag()

---@param handle [number] = Entity handle
---@param tag [string] = Tag name
---@param value [string] = Tag value [optional]
---@param inherit [boolean] = Tag is inheritable [optional]
function SetTag(handle, tag, [value], [inherit]) end

This change would directly make each individual tag able to be flagged as inheritable rather than making all tags on an entity inheritable, therefore solving the problem.

Flag value would be default to false (not inheritable, normal behaviour) therefore guarantees backwards compatibility.

Undocumented tag inherittags could remain undocumented, or just remove once said changes got implemented to minimise confusion.

Describe alternatives you've considered

Either add extra functions to handle other scripts using inherittags or tweak own logic to achieve overall better outcome when other scripts presents. Neither is easy to maintain and the problem remains.

Additional context

No response

bingleboy commented 2 months ago

Another potential fix could be to allow inherittags to be set to multiple names of tags separated by commas (e.g inherittags=special,otherTag, as this would keep compatability while also helping with the aforementioned problems. This could still cause confusion if multiple scripts are trying to cause tags to be inherited on the same object, but I personally feel like a scripting workflow like that seems unlikely and prone to having more issues.

Gregory-Gregory commented 2 months ago

@YuLun-bili @bingleboy hi!

Thank you for mentioning this. I have updated the team's feature list with your request.