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

Make HitInfo and HurtInfo read/init only #4151

Open
wants to merge 1 commit into
base: 1.4.4
Choose a base branch
from

Conversation

Chicken-Bones
Copy link
Member

What is the new feature?

NPC.HitInfo and Player.HurtInfo are now readonly and have get; init properties.

Why should this be part of tModLoader?

I see people trying to do
hit.Crit = false, which compiles but doesn't do anything

Are there alternative designs?

Make the hook parameters in instead. This would be just as breaking, and not carry through to user's own non-hook methods. The dotnet guidelines also recommend making a struct readonly if it's going to be used with in where possible (though this is a performance detail that isn't too relevant to us).

Sample usage for the new feature

image

ExampleMod updates

None required

@Chicken-Bones Chicken-Bones added this to the 1.4.5 milestone Apr 4, 2024
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.

None yet

1 participant