-
Notifications
You must be signed in to change notification settings - Fork 21
Reinforced block (target block, not reinforcing block) strength multipliers #38
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
base: master
Are you sure you want to change the base?
Conversation
…type, so glass for instance can be given a 5x multiplier, and it will get 5x the reinforcement strength from any reinforcer versus default. Allows decorative blocks to become more secure options, don't need to use obby for EVERYTHING.
|
Looks like a reasonable start. Please try to adhere somewhat to https://github.com/DevotedMC/style-guide -- the only big problem atm is tabs vs. spaces -- convert to tabs to be compliant with the style guide / rest of the code. I am not opposed to the rationale employed here of physically encoding the multiplier into the stored health; however, I'd encourage considering applying the multiplier "at point of use" -- this way, admins could rebalance during the life of the server without needing to be a SQL guru. I could see this feature as massively useful, but also super easy to screw up the first time through... |
| scheduleSave(); | ||
| } | ||
|
|
||
| public double getMatMultiplier(Material mat){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this method can be rewritten as
public double getMatMultiplier(Material mat) {
return matMultipliers.getOrDefault(mat, 1.0);
}|
How would one go about employing it "At point of use"? The server recreates reinforcement objects every restart from the database, so if I put this, for example, in the reinforcement object constructor instead, then every time you restart the server (or possibly even unload and reload the chunk?), and somebody interacts with that block each time, it would multiply the strength of the reinforcement 10x higher over and over. I thought of that but couldn't figure out an elegant way to do it without adding parameters all over the entire plugin to get passed around awkwardly keeping track of whether this is the first time it's being constructed, blah blah. (If the hitpoints were higher than what maximum should be, then you could infer that multiplier has been downgraded, but if they're lower than maximum, you can't know what happened if anything without passing tracking parameters. E.g. if 500 was the max, before, and a block was whittled down to 40/500, then the multiplier is removed and the max is now 50, the block will read as 40/50. Without passing info around, how does it know if it was always at 50 and is at 80% strength, versus that it should be changed to 4/50?) |
|
You'd do it the same way decay is handled. It's computed as a multiplier at point-of-damage. Basically here: https://github.com/DevotedMC/Citadel/blob/master/src/vg/civcraft/mc/citadel/Utility.java#L384 |
|
Yes that would work well, and would be useful for people screwing up. Is falling down my list of priorities though, since this currently works for my intended use case, but I will see if I can get back to it. Regarding the style guide: is there just a normal, human readable version anywhere...? Because I don't use eclipse and would have to just program into the settings manually, but the style guide is all in confusing code version only it looks like? (and thanks for the neat trick goeppes) Another thing that would help admins not screw up would be if there were a readme or some such with what the multipliers would be for every single block type in order for them to have equal break times as one another with best tools (say, without a beacon). Which is work I may do anyway, and if I do I'll send it over to you. So if you wanted to make everything half as good as obsidian, just divide them all by 2, without dumb mistakes. |
|
That place I linked is the only place damage is computed. The other places that damage / health is displayed you already found. Ngl, your initial PR did it the hard way :3 Uh, tbh the only important thing atm is just tabs instead of spaces. Spaces in json and xml, tabs in java for indentation, spaces for alignment (if you care to, I don't). Concerning your edit, yeah, that'd be great. I usually just reference the minecraft wiki, they have a nice listing. |
See commit comment / config notes