• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

First Machine Age's Mods (Combined repo.)


Commit MetaInfo

Révisionde1f838e17628ed460e688f23e26febb59549261 (tree)
l'heure2020-08-13 13:08:12
Auteurmelchior <melchior@user...>
Commitermelchior

Message de Log

W.I.P. More event processing, tool entries

Change Summary

Modification

--- a/ElementalTools/Assignments.cs
+++ b/ElementalTools/Assignments.cs
@@ -19,11 +19,14 @@ namespace ElementalTools
1919 internal const string malletItemKey = @"ItemMallet";
2020 internal const string sharpeningStoneItemKey = @"ItemSharpening_stone";
2121
22- internal const string genericSteelItemKey = @"Steel_Item";//Only for tool heads / blades...
23- internal const string genericSteelSwordKey = @"Steel_ItemSword";
24- internal const string genericSteelChiselKey = @"Steel_ItemChisel";
25- internal const string genericSteelAxeKey = @"Steel_ItemAxe";
26- internal const string genericSteelSpearKey = @"Steel_ItemSpear";
22+ internal const string genericSteelItemKey = @"Steel_Item";//Only for tool heads / blades...
23+ internal const string genericSteelSwordKey = @"Steel_ItemSword";
24+ internal const string genericSteelChiselKey = @"Steel_ItemChisel";
25+ internal const string genericSteelAxeKey = @"Steel_ItemAxe";
26+ internal const string genericSteelSpearKey = @"Steel_ItemSpear";
27+ internal const string genericSteelCleaverKey = @"Steel_ItemCleaver";
28+ internal const string genericSteelHammerKey= @"Steel_ItemHammer";
29+
2730
2831 internal const string pack_carburizationBlockKey = @"pack_carburization";
2932 internal const string pack_stateFired = @"fired";
@@ -57,7 +60,10 @@ namespace ElementalTools
5760 CoreAPI.RegisterItemClass(genericSteelChiselKey, typeof(SteelWrap<ItemChisel>));
5861 CoreAPI.RegisterItemClass(genericSteelAxeKey, typeof(SteelWrap<ItemAxe>));
5962 CoreAPI.RegisterItemClass(genericSteelSpearKey, typeof(SteelWrap<ItemSpear>));
60-
63+ CoreAPI.RegisterItemClass(genericSteelCleaverKey, typeof(SteelWrap<ItemCleaver>));
64+ CoreAPI.RegisterItemClass(genericSteelHammerKey, typeof(SteelWrap<ItemHammer>));
65+
66+
6167
6268 }
6369
--- a/ElementalTools/ElementalTools.csproj
+++ b/ElementalTools/ElementalTools.csproj
@@ -102,6 +102,7 @@
102102 <Folder Include="assets\fma\config\" />
103103 <Folder Include="assets\fma\config\handbook\" />
104104 <Folder Include="assets\fma\entities\" />
105+ <Folder Include="assets\fma\itemtypes\tools\heads\" />
105106 </ItemGroup>
106107 <ItemGroup>
107108 <None Include="modinfo.json">
@@ -193,8 +194,12 @@
193194 <None Include="assets\fma\itemtypes\tools\prospectingpick.json" />
194195 <None Include="assets\fma\itemtypes\tools\scythe.json" />
195196 <None Include="assets\fma\itemtypes\tools\saw.json" />
196- <None Include="assets\fma\itemtypes\tools\cleaver.json" />
197- <None Include="assets\fma\itemtypes\tools\hammer.json" />
197+ <None Include="assets\fma\itemtypes\tools\cleaver.json">
198+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
199+ </None>
200+ <None Include="assets\fma\itemtypes\tools\hammer.json">
201+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
202+ </None>
198203 <None Include="assets\fma\itemtypes\tools\shears.json" />
199204 <None Include="assets\fma\itemtypes\tools\hoe.json" />
200205 <None Include="assets\fma\itemtypes\arms\spear.json">
@@ -206,6 +211,7 @@
206211 <None Include="assets\fma\entities\spears.json">
207212 <CopyToOutputDirectory>Always</CopyToOutputDirectory>
208213 </None>
214+ <None Include="assets\fma\itemtypes\tools\heads\hammer_head.json" />
209215 </ItemGroup>
210216 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
211217 </Project>
\ No newline at end of file
--- a/ElementalTools/General/IAmSteel.cs
+++ b/ElementalTools/General/IAmSteel.cs
@@ -34,7 +34,13 @@ namespace ElementalTools
3434 SharpnessState Sharpen(IItemStack someStack);
3535
3636 /// <summary>
37- /// Read Harness
37+ /// Reduce the sharpness.
38+ /// </summary>
39+ /// <param name="someStack">Some stack.</param>
40+ SharpnessState Dull(IItemStack someStack);
41+
42+ /// <summary>
43+ /// Read Hardness
3844 /// </summary>
3945 /// <param name="someStack">Some stack.</param>
4046 HardnessState Hardness(IItemStack someStack);
@@ -46,6 +52,7 @@ namespace ElementalTools
4652 /// <param name="set">Value.</param>
4753 void Hardness(IItemStack someStack, HardnessState set);//Apply harden - Perhaps translate these to brinell units...
4854
55+
4956 /// <summary>
5057 /// Perpetuate Steely attributes from donor to recipient
5158 /// </summary>
--- a/ElementalTools/Items/SteelItem.cs
+++ b/ElementalTools/Items/SteelItem.cs
@@ -21,6 +21,7 @@ namespace ElementalTools
2121 private const float quench_min_temperature = 450f;//Celcius
2222
2323 private Item WrappedItem;//Special placeholder replica - for calling ancestor class
24+
2425 internal const string hardenableKeyword = @"hardenable";
2526 internal const string sharpenableKeyword = @"sharpenable";
2627 internal const string metalNameKeyword = @"metalName";
@@ -181,6 +182,23 @@ namespace ElementalTools
181182 someStack.Attributes.SetBytes(sharpnessKeyword, bytes);
182183 }
183184
185+ public virtual SharpnessState Dull(IItemStack someStack)
186+ {
187+ if (someStack.Attributes != null && someStack.Attributes.HasAttribute(sharpnessKeyword)) {
188+ byte[ ] bytes = new byte[1];
189+ bytes = someStack.Attributes.GetBytes(sharpnessKeyword, bytes);
190+ var state = ( SharpnessState )bytes[0];
191+
192+ if (state > SharpnessState.Rough) state--;
193+
194+ bytes[0] = ( byte )state;
195+ someStack.Attributes.SetBytes(sharpnessKeyword, bytes);
196+
197+ return state;
198+ }
199+ return SharpnessState.Rough;
200+ }
201+
184202 public virtual HardnessState Hardness(IItemStack someStack)
185203 {
186204 if (someStack.Attributes != null && someStack.Attributes.HasAttribute(hardnessKeyword)) {
@@ -338,9 +356,9 @@ namespace ElementalTools
338356 public override void OnAttackingWith(IWorldAccessor world, Entity byEntity, Entity attackedEntity, ItemSlot itemslot)
339357 {
340358 bool edged = this.Tool.EdgedImpliment( );
341- bool weapon = this.Tool.Weapons( );
359+ bool weapon = this.Tool.Weapons( );
342360 float targetArmorFactor = 0.0f;
343-
361+
344362 /*DETERMINE:
345363 * Usage - Edged weapon attack Vs. creature Sc.#1 [What about armored players?]
346364 * Non-edged weapon vs. creature Sc. #2 [What about armored players?]
@@ -362,7 +380,7 @@ namespace ElementalTools
362380 }
363381 */
364382
365- WrappedItem.OnAttackingWith(world, byEntity, attackedEntity, itemslot);
383+ //WrappedItem.OnAttackingWith(world, byEntity, attackedEntity, itemslot);
366384 }
367385
368386
@@ -374,50 +392,72 @@ namespace ElementalTools
374392 var targetBlock = api.World.BlockAccessor.GetBlock(blockSel.Position);
375393 int targetTier = targetBlock.ToolTier;
376394 float targetResistance = targetBlock.Resistance;
395+ bool recomendedUsage = this.MiningSpeed.ContainsKey(targetBlock.BlockMaterial);
377396
378397 //Only called for attacks on BLOCKS / Envrionment. Scen# 5 - 6 here.
379-
398+
380399 //Weapon & Tool applicability: Is rate > 1 ? then - its sorta OK...ish.
381400
382401 //Harndess Vs. Block-Resistance...
402+ //Tool Specific special damage reduction rate: e.g. scythe, hoe, knife, here...
403+ //By MiningSpeed
404+
383405
384406 api.World.Logger.VerboseDebug($"OnBlockBrokenWith:: (Weap:{weapon},Edge:{edged}) {byEntity.Code} -> {targetBlock.Code}");
385407
386408
387409
388410 return WrappedItem.OnBlockBrokenWith(world, byEntity, itemslot, blockSel);
411+ //Post Damage reduction? or Increase??
412+
389413 }
390414
391-
415+ //This Method signature leaves _ALOT_ to be ascertained about the _ACUTAL_ Scenario / REASON of damage...
416+ //Tool/Weapon Vs. What?
392417 public override void DamageItem(IWorldAccessor world, Entity byEntity, ItemSlot itemslot, int amount = 1)
393418 {
394- //TODO: too sharp edges...wear down EDGE randomly (extra for 'abuse' )
419+ //ItemAxe: just repeatedly calls DamageItem....instead of accrued count...lame.
420+
421+ bool byPlayer = byEntity is EntityPlayer;
422+ bool catasptrophicFailure = false, edgeBlunting = false;
423+
424+ float resistance = 0.0f;
395425
396- //Tool Specific special damage reduction rate: e.g. scythe, hoe, knife, here...?
397- //By MiningSpeed ?
398426 if (!itemslot.Empty)
399427 {
400428 var hardness = this.Hardness(itemslot.Itemstack);
401429 switch (hardness)
402430 {
403431 case HardnessState.Soft:
404-
432+ resistance = 0.3f;
433+ edgeBlunting = world.Rand.Next(1, 100) >= 99;
405434 break;
406435 case HardnessState.Medium:
407-
436+ resistance = -0.1f;
437+ edgeBlunting = world.Rand.Next(1, 200) >= 199;
408438 break;
409439 case HardnessState.Hard:
410-
440+ resistance = -0.25f;
441+ edgeBlunting = world.Rand.Next(1, 300) >= 299;
411442 break;
412443 case HardnessState.Brittle:
413-
414- break;
415- default:
444+ resistance = -0.3f;
445+ edgeBlunting = world.Rand.Next(1, 400) >= 399;
446+ catasptrophicFailure = world.Rand.Next(1, 1000) >= 999;
416447 break;
417448 }
418449 }
419450
420- WrappedItem.DamageItem(world, byEntity, itemslot, amount);
451+ amount = amount < 1 ? 1 : amount;//Zero or negative damange, possible but WHY?
452+
453+ float amountFractional = (resistance * amount);
454+ var dmgRandomizer = NatFloat.createUniform(amount, amountFractional);
455+ var actualAmount = ( int )dmgRandomizer.nextFloat( );
456+
457+ if (edgeBlunting) this.Dull(itemslot.Itemstack);
458+ if (catasptrophicFailure) actualAmount += 1200;
459+
460+ base.DamageItem(world, byEntity, itemslot, actualAmount);
421461 }
422462
423463
@@ -685,6 +725,8 @@ namespace ElementalTools
685725 {
686726 return recipient.Attributes.GetInt(durabilityKeyword, recipient.Item.Durability);
687727 }
728+
729+
688730 }
689731 }
690732
--- a/ElementalTools/assets/fma/itemtypes/tools/axe.json
+++ b/ElementalTools/assets/fma/itemtypes/tools/axe.json
@@ -1,16 +1,6 @@
11 {
22 code: "axe",
3- class: "Steel_ItemAxe",
4- attributes: {
5- handbook: {
6- groupBy: ["axe-*"]
7- },
8- toolrackTransform: {
9- rotation: { y: 1, z: -1 },
10- translation: { x: -0.3, y: 0.6 },
11- scale: 1.25,
12- }
13- },
3+ class: "Steel_ItemAxe",
144 variantgroups: [
155 { code: "metal", states: ["blister_steel", "shear_steel" ] },
166 ],
@@ -56,7 +46,17 @@
5646 metalName:"Shear Steel",
5747 sharpenable: true,
5848 hardenable: true,
59- }
49+ },
50+ "*": {
51+ handbook: {
52+ groupBy: ["axe-*"]
53+ },
54+ toolrackTransform: {
55+ rotation: { y: 1, z: -1 },
56+ translation: { x: -0.3, y: 0.6 },
57+ scale: 1.25,
58+ }
59+ },
6060 },
6161 creativeinventory: { "general": ["*"], "items": ["*"], "tools": ["*"] },
6262
--- a/ElementalTools/assets/fma/itemtypes/tools/cleaver.json
+++ b/ElementalTools/assets/fma/itemtypes/tools/cleaver.json
@@ -1 +1,71 @@
1-
1+{
2+ code: "cleaver",
3+ damagedby: ["blockbreaking", "attacking"],
4+ class: "Steel_ItemCleaver",
5+ variantgroups: [
6+ { code: "metal", states: ["blister_steel", "shear_steel" ] },
7+ ],
8+ shape: { base: "game:item/tool/cleaver" },
9+ heldTpHitAnimation: "breaktool",
10+ textures: {
11+ "metal": { base:"fma:metal/{metal}"},
12+ "toolhandle": {
13+ base: "fma:metal/{metal}",
14+ overlays: [ "game:item/tool/cleaver-overlay" ]
15+ }
16+ },
17+ durabilitybytype: {
18+ "*-blister_steel": 1100,
19+ "*-shear_steel": 1200,
20+ },
21+ attackpowerbytype: {
22+ "*-blister_steel": 2.75,
23+ "*-shear_steel": 3.0,
24+ },
25+ attributesByType: {
26+ "*-blister_steel": {
27+ metalName:"Blister Steel",
28+ sharpenable: true,
29+ hardenable: true,
30+ },
31+ "*-shear_steel": {
32+ metalName:"Shear Steel",
33+ sharpenable: true,
34+ hardenable: true,
35+ },
36+ "*": {
37+ handbook: {
38+ groupBy: ["cleaver-*"]
39+ },
40+ rackable: true,
41+ toolrackTransform: {
42+ rotation: { x: 90 },
43+ translation: { x: -0.35 },
44+ scale: 1.25,
45+ },
46+ }
47+ },
48+ creativeinventory: { "general": ["*"], "items": ["*"], "tools": ["*"] },
49+ fpHandTransform: {
50+ translation: { x: -0.34, y: 0, z: 0.4 },
51+ rotation: { x: -17, y: -93, z: -75 },
52+ scale: 2.5
53+ },
54+ guiTransform: {
55+ translation: { x: 0, y: 0, z: 0 },
56+ rotation: { x: 0, y: 26, z: 140 },
57+ origin: { x: 0.55, y: 0.52, z: 0.5 },
58+ scale: 2.53
59+ },
60+ groundTransform: {
61+ translation: { x: 0, y: 0, z: 0 },
62+ rotation: { x: -90, y: 0, z: 0 },
63+ origin: { x: 0.5, y: 0.5, z: 0.45 },
64+ scale: 3.6
65+ },
66+ tpHandTransform: {
67+ translation: { x: -0.78, y: -0.44, z: -0.5 },
68+ rotation: { x: 0, y: 180, z: -10 },
69+ scale: 1
70+ }
71+}
\ No newline at end of file
--- a/ElementalTools/assets/fma/itemtypes/tools/hammer.json
+++ b/ElementalTools/assets/fma/itemtypes/tools/hammer.json
@@ -1 +1,73 @@
1-
1+{
2+ code: "hammer",
3+ class: "Steel_ItemHammer",
4+ variantgroups: [
5+ { code: "metal", states: ["blister_steel", "shear_steel" ] },
6+ ],
7+ tool: "hammer",
8+ heldTpHitAnimation: "smithing",
9+ shape: { base: "game:item/tool/hammer" },
10+ textures: {
11+ "metal": { base:"fma:metal/{metal}"},
12+ "wood": { base: "game:item/tool/material/wood" }
13+ },
14+ tooltierbytype: {
15+ "*-blister_steel": 5,
16+ "*-shear_steel": 5,
17+ },
18+ durabilitybytype: {
19+ "*-blister_steel": 2500,
20+ "*-shear_steel": 2600,
21+ },
22+ attackpowerbytype: {
23+ "*-blister_steel": 2.5,
24+ "*-shear_steel": 2.5,
25+ },
26+ attributesByType: {
27+ "*-blister_steel": {
28+ metalName:"Blister Steel",
29+ sharpenable: false,
30+ hardenable: true,
31+ },
32+ "*-shear_steel": {
33+ metalName:"Shear Steel",
34+ sharpenable: false,
35+ hardenable: true,
36+ },
37+ "*":
38+ {
39+ handbook: {
40+ groupBy: ["hammer-*"]
41+ },
42+ toolrackTransform: {
43+ rotation: { y: 1, z: -1 },
44+ translation: { x: -0.2 },
45+ scale: 1.5,
46+ }
47+ }
48+ },
49+ creativeinventory: { "general": ["*"], "items": ["*"], "tools": ["*"] },
50+ fpHandTransform: {
51+ translation: { x: 0.0468, y: -0.2, z: 0 },
52+ rotation: { x: 15, y: 15, z: 90 },
53+ scale: 2.5
54+ },
55+ guiTransform: {
56+ rotate: false,
57+ translation: { x: 0, y: 5, z: 0 },
58+ rotation: { x: -77, y: -135, z: 160 },
59+ origin: { x: 0.54, y: 0.5, z: 0.48 },
60+ scale: 2.6
61+ },
62+ groundTransform: {
63+ translation: { x: 0, y: 0, z: 0 },
64+ rotation: { x: 0, y: 0, z: 0 },
65+ origin: { x: 0.5, y: 0.45, z: 0.5 },
66+ scale: 4.5
67+ },
68+ tpHandTransform: {
69+ translation: { x: -0.75, y: -0.48, z: -0.52 },
70+ rotation: { x: 90, y: 1, z: 0 },
71+ scale: 1
72+ }
73+}
--- /dev/null
+++ b/ElementalTools/assets/fma/itemtypes/tools/heads/hammer_head.json
@@ -0,0 +1,35 @@
1+{
2+ code: "hammerhead",
3+ variantgroups: [
4+ { code: "metal", states: ["blister_steel", "shear_steel" ] },
5+ ],
6+ shape: { base: "game:item/tool/hammer" },
7+ textures: {
8+ "metal": { base:"fma:metal/{metal}"},
9+ "wood": { base: "game:block/transparent" },
10+ },
11+ creativeinventory: { "general": ["*"], "items": ["*"] },
12+ fpHandTransform: {
13+ translation: { x: 0.3, y: -0.4, z: 0 },
14+ rotation: { x: 15, y: 15, z: 90 },
15+ scale: 2.5
16+ },
17+ guiTransform: {
18+ rotate: false,
19+ translation: { x: 4, y: 1, z: 190 },
20+ rotation: { x: -52, y: -131, z: -180 },
21+ origin: { x: 0.37, y: 1.25, z: 0.1 },
22+ scale: 3.5
23+ },
24+ groundTransform: {
25+ translation: { x: 0, y: 0, z: 0 },
26+ rotation: { x: 0, y: 0, z: 0 },
27+ origin: { x: 0.8, y: 0.44, z: 0.5 },
28+ scale: 4.5
29+ },
30+ tpHandTransform: {
31+ translation: { x: -0.3, y: -0.8, z: -0.6 },
32+ rotation: { x: 109, y: -30, z: 5 },
33+ scale: 1
34+ }
35+}
\ No newline at end of file