Skip to content

Clamp setHull to 0-max, and set hull.current = max if max is set to < current#2780

Open
oznogon wants to merge 1 commit intodaid:masterfrom
oznogon:validate-sethull-api
Open

Clamp setHull to 0-max, and set hull.current = max if max is set to < current#2780
oznogon wants to merge 1 commit intodaid:masterfrom
oznogon:validate-sethull-api

Conversation

@oznogon
Copy link
Contributor

@oznogon oznogon commented Mar 11, 2026

Validate the value passed to Entity:setHull() as described for legacy: if negative, set the hull to 0. If set to a value greater than the hull max, set it to the max.

If Entity:setHullMax() is set to a value lower than the current hull value, reduce the current hull value to the max.

@oznogon oznogon marked this pull request as ready for review March 11, 2026 19:09
@oznogon
Copy link
Contributor Author

oznogon commented Mar 11, 2026

GM tweaks and direct component access can still set hull to negative values or > max.

The hull component itself either shouldn't allow out-of-range values. or should find a way to handle them.

EDIT: i.e. 29b18e1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant