Skip to content

Commit

Permalink
Make tool stats directly handle stat building
Browse files Browse the repository at this point in the history
Was notcing that all tool stat providers follow pretty consistent patterns: for each material stat type, either average or sum all instances of the type
Averaging is pretty easy to recreate with just a multiplier in most cases, so as a result we can save a lot of effort by just directly querying stats from the material stats instane
In addition to saving effort, this relaxes the restrictions on combining different stat types; now a tool can combine any registered material stat type!

Notable API changes for the new system:
* Material stat providers are gone
* IMaterialStats now has a new abstract method to add its stats to the builder. The scale parameter should be multiplied by the relevant stats (or used as a power for multipliers)
* For stat multipliers, migrated most to a percentage system instead. This means instead of 100% being the default value, its +0%, e.g. so 85% is represented as -15%. Percentages are summed like how we processed bow limbs
* The percentage system also works for stat boost modifiers, though currently none use it. Worth considering for the future
* In tool definitions, instead of weights parts now have scales. Notably they are not normalized to sum to 1, which means if you were expecting average of multiple parts of the same type you need to include the scaling weights now.

Adjusted a few tool weights given this new system
  • Loading branch information
KnightMiner committed May 7, 2024
1 parent 1f9f3bf commit 95e3590
Show file tree
Hide file tree
Showing 92 changed files with 867 additions and 1,073 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"stats": {
"tconstruct:grip": {
"accuracy": 0.15,
"durability": 0.85,
"durability": -0.15,
"melee_damage": 2.0
},
"tconstruct:limb": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"tconstruct:binding": {},
"tconstruct:grip": {
"accuracy": 0.1,
"durability": 1.0,
"durability": 0.0,
"melee_damage": 1.5
},
"tconstruct:handle": {
"durability": 1.0,
"melee_damage": 1.0,
"melee_speed": 1.05,
"mining_speed": 1.1
"durability": 0.0,
"melee_damage": 0.0,
"melee_speed": 0.05,
"mining_speed": 0.1
},
"tconstruct:head": {
"durability": 720,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"stats": {
"tconstruct:grip": {
"accuracy": 0.05,
"durability": 0.95,
"durability": -0.05,
"melee_damage": 0.75
},
"tconstruct:limb": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"tconstruct:binding": {},
"tconstruct:grip": {
"accuracy": -0.1,
"durability": 0.85,
"durability": -0.15,
"melee_damage": 3.0
},
"tconstruct:handle": {
"durability": 0.85,
"melee_damage": 1.05,
"melee_speed": 1.2,
"mining_speed": 1.0
"durability": -0.15,
"melee_damage": 0.05,
"melee_speed": 0.2,
"mining_speed": 0.0
},
"tconstruct:head": {
"durability": 530,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"tconstruct:binding": {},
"tconstruct:grip": {
"accuracy": 0.05,
"durability": 0.75,
"durability": -0.25,
"melee_damage": 1.25
},
"tconstruct:handle": {
"durability": 0.75,
"melee_damage": 1.0,
"melee_speed": 1.1,
"mining_speed": 1.0
"durability": -0.25,
"melee_damage": 0.0,
"melee_speed": 0.1,
"mining_speed": 0.0
},
"tconstruct:head": {
"durability": 100,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"tconstruct:binding": {},
"tconstruct:grip": {
"accuracy": 0.0,
"durability": 1.1,
"durability": 0.1,
"melee_damage": 2.25
},
"tconstruct:handle": {
"durability": 1.1,
"melee_damage": 1.0,
"melee_speed": 1.0,
"mining_speed": 1.05
"durability": 0.1,
"melee_damage": 0.0,
"melee_speed": 0.0,
"mining_speed": 0.05
},
"tconstruct:head": {
"durability": 760,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"tconstruct:binding": {},
"tconstruct:grip": {
"accuracy": -0.1,
"durability": 1.1,
"durability": 0.1,
"melee_damage": 1.0
},
"tconstruct:handle": {
"durability": 1.1,
"melee_damage": 1.0,
"melee_speed": 0.9,
"mining_speed": 0.95
"durability": 0.1,
"melee_damage": 0.0,
"melee_speed": -0.1,
"mining_speed": -0.05
},
"tconstruct:head": {
"durability": 180,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"tconstruct:binding": {},
"tconstruct:grip": {
"accuracy": 0.05,
"durability": 1.05,
"durability": 0.05,
"melee_damage": 2.25
},
"tconstruct:handle": {
"durability": 1.05,
"melee_damage": 1.0,
"melee_speed": 1.05,
"mining_speed": 1.05
"durability": 0.05,
"melee_damage": 0.0,
"melee_speed": 0.05,
"mining_speed": 0.05
},
"tconstruct:head": {
"durability": 800,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"tconstruct:binding": {},
"tconstruct:grip": {
"accuracy": 0.1,
"durability": 0.95,
"durability": -0.05,
"melee_damage": 1.75
},
"tconstruct:handle": {
"durability": 0.95,
"melee_damage": 1.0,
"melee_speed": 1.0,
"mining_speed": 1.15
"durability": -0.05,
"melee_damage": 0.0,
"melee_speed": 0.0,
"mining_speed": 0.15
},
"tconstruct:head": {
"durability": 675,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"tconstruct:binding": {},
"tconstruct:grip": {
"accuracy": 0.0,
"durability": 0.8,
"durability": -0.2,
"melee_damage": 0.5
},
"tconstruct:handle": {
"durability": 0.8,
"melee_damage": 1.05,
"melee_speed": 1.0,
"mining_speed": 1.1
"durability": -0.2,
"melee_damage": 0.05,
"melee_speed": 0.0,
"mining_speed": 0.1
},
"tconstruct:head": {
"durability": 210,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"tconstruct:binding": {},
"tconstruct:grip": {
"accuracy": 0.2,
"durability": 0.8,
"durability": -0.2,
"melee_damage": 1.5
},
"tconstruct:handle": {
"durability": 0.8,
"melee_damage": 1.0,
"melee_speed": 1.15,
"mining_speed": 1.15
"durability": -0.2,
"melee_damage": 0.0,
"melee_speed": 0.15,
"mining_speed": 0.15
},
"tconstruct:head": {
"durability": 225,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"stats": {
"tconstruct:binding": {},
"tconstruct:handle": {
"durability": 0.85,
"melee_damage": 1.1,
"melee_speed": 1.0,
"mining_speed": 1.0
"durability": -0.15,
"melee_damage": 0.1,
"melee_speed": 0.0,
"mining_speed": 0.0
},
"tconstruct:head": {
"durability": 85,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"tconstruct:binding": {},
"tconstruct:grip": {
"accuracy": 0.15,
"durability": 1.1,
"durability": 0.1,
"melee_damage": 2.5
},
"tconstruct:handle": {
"durability": 1.1,
"melee_damage": 0.9,
"melee_speed": 1.0,
"mining_speed": 1.2
"durability": 0.1,
"melee_damage": -0.1,
"melee_speed": 0.0,
"mining_speed": 0.2
},
"tconstruct:head": {
"durability": 975,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"tconstruct:binding": {},
"tconstruct:grip": {
"accuracy": 0.05,
"durability": 1.0,
"durability": 0.0,
"melee_damage": 2.5
},
"tconstruct:handle": {
"durability": 1.0,
"melee_damage": 1.2,
"melee_speed": 1.0,
"mining_speed": 0.9
"durability": 0.0,
"melee_damage": 0.2,
"melee_speed": 0.0,
"mining_speed": -0.1
},
"tconstruct:head": {
"durability": 630,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"tconstruct:binding": {},
"tconstruct:grip": {
"accuracy": 0.0,
"durability": 1.1,
"durability": 0.1,
"melee_damage": 2.0
},
"tconstruct:handle": {
"durability": 1.1,
"melee_damage": 1.0,
"melee_speed": 1.0,
"mining_speed": 1.0
"durability": 0.1,
"melee_damage": 0.0,
"melee_speed": 0.0,
"mining_speed": 0.0
},
"tconstruct:head": {
"durability": 250,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"tconstruct:binding": {},
"tconstruct:grip": {
"accuracy": -0.1,
"durability": 0.9,
"durability": -0.1,
"melee_damage": 2.5
},
"tconstruct:handle": {
"durability": 0.9,
"melee_damage": 1.2,
"melee_speed": 0.9,
"mining_speed": 1.0
"durability": -0.1,
"melee_damage": 0.2,
"melee_speed": -0.1,
"mining_speed": 0.0
},
"tconstruct:head": {
"durability": 200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"tconstruct:binding": {},
"tconstruct:grip": {
"accuracy": -0.2,
"durability": 1.1,
"durability": 0.1,
"melee_damage": 3.5
},
"tconstruct:handle": {
"durability": 1.1,
"melee_damage": 1.25,
"melee_speed": 0.95,
"mining_speed": 0.9
"durability": 0.1,
"melee_damage": 0.25,
"melee_speed": -0.05,
"mining_speed": -0.1
},
"tconstruct:head": {
"durability": 1250,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"tconstruct:binding": {},
"tconstruct:grip": {
"accuracy": -0.15,
"durability": 0.9,
"durability": -0.1,
"melee_damage": 3.0
},
"tconstruct:handle": {
"durability": 0.9,
"melee_damage": 1.3,
"melee_speed": 0.9,
"mining_speed": 1.0
"durability": -0.1,
"melee_damage": 0.3,
"melee_speed": -0.1,
"mining_speed": 0.0
},
"tconstruct:head": {
"durability": 350,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"tconstruct:binding": {},
"tconstruct:grip": {
"accuracy": 0.15,
"durability": 0.8,
"durability": -0.2,
"melee_damage": 2.75
},
"tconstruct:handle": {
"durability": 0.8,
"melee_damage": 1.1,
"melee_speed": 1.15,
"mining_speed": 1.0
"durability": -0.2,
"melee_damage": 0.1,
"melee_speed": 0.15,
"mining_speed": 0.0
},
"tconstruct:head": {
"durability": 357,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"tconstruct:binding": {},
"tconstruct:grip": {
"accuracy": 0.1,
"durability": 0.7,
"durability": -0.3,
"melee_damage": 2.25
},
"tconstruct:handle": {
"durability": 0.7,
"melee_damage": 1.05,
"melee_speed": 1.15,
"mining_speed": 1.0
"durability": -0.3,
"melee_damage": 0.05,
"melee_speed": 0.15,
"mining_speed": 0.0
},
"tconstruct:head": {
"durability": 125,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"stats": {
"tconstruct:binding": {},
"tconstruct:handle": {
"durability": 1.2,
"melee_damage": 1.0,
"melee_speed": 0.9,
"mining_speed": 0.9
"durability": 0.2,
"melee_damage": 0.0,
"melee_speed": -0.1,
"mining_speed": -0.1
},
"tconstruct:head": {
"durability": 500,
Expand Down
Loading

0 comments on commit 95e3590

Please sign in to comment.