First Machine Age's Mods (Combined repo.)
Révision | 5dd86de17b17a8fecc3f42580b0c0525fb4f42a6 (tree) |
---|---|
l'heure | 2020-08-27 05:40:57 |
Auteur | melchior <melchior@user...> |
Commiter | melchior |
Working: Tempering, Timing for Carburization
@@ -58,7 +58,7 @@ namespace ElementalTools | ||
58 | 58 | //Seconds |
59 | 59 | get |
60 | 60 | { |
61 | - if (this.Attributes[steelTransitionTempKey].Exists) { return this.Attributes[steelTransitionTempKey].AsFloat( ); } | |
61 | + if (this.Attributes[steelTransitionTimeKey].Exists) { return this.Attributes[steelTransitionTimeKey].AsFloat( ); } | |
62 | 62 | |
63 | 63 | return 38f; |
64 | 64 | } |
@@ -185,7 +185,9 @@ namespace ElementalTools | ||
185 | 185 | public override float GetMeltingDuration(IWorldAccessor world, ISlotProvider cookingSlotsProvider, ItemSlot inputSlot) |
186 | 186 | {//TimeSpan - would have been far better a return type |
187 | 187 | var extraCookTime = GetExtraCookTime(inputSlot.Itemstack); |
188 | - | |
188 | + #if DEBUG | |
189 | + api.World.Logger.VerboseDebug("GetMeltingDuration::{0}", (SteelTransitionTime + extraCookTime)); | |
190 | + #endif | |
189 | 191 | return SteelTransitionTime + extraCookTime; |
190 | 192 | } |
191 | 193 |
@@ -283,16 +285,17 @@ namespace ElementalTools | ||
283 | 285 | outputSlot.Itemstack = outputStack.Clone(); |
284 | 286 | |
285 | 287 | temperature = Math.Min(temperature, maxInnerTemperature); |
286 | - contentStack.Collectible.SetTemperature(world, contentStack, temperature);//TODO: Temperature clamping inside contents of stack... | |
288 | + contentStack.Collectible.SetTemperature(world, contentStack, temperature); | |
287 | 289 | |
288 | 290 | ItemStack[ ] transmutedItems = new ItemStack[ ] { contentStack.Clone( ) }; |
289 | 291 | transmutedItems.First( ).StackSize = 1;//There can be only 1, per pack |
290 | 292 | SetContents(outputSlot.Itemstack, transmutedItems); |
291 | - | |
293 | + outputSlot.Itemstack.Collectible.SetTemperature(world, outputSlot.Itemstack, temperature); | |
294 | + | |
292 | 295 | inputSlot.Itemstack = null; |
293 | 296 | |
294 | 297 | #if DEBUG |
295 | - world.Logger.VerboseDebug("Contents of pack: {0}", contentStack); | |
298 | + world.Logger.VerboseDebug("Contents of pack: {0} @{1}C", contentStack,temperature); | |
296 | 299 | world.Logger.VerboseDebug("Finished: 'DoSmelt' " ); |
297 | 300 | #endif |
298 | 301 | } |
@@ -79,17 +79,18 @@ namespace ElementalTools | ||
79 | 79 | } |
80 | 80 | |
81 | 81 | /// <summary> |
82 | - /// The metals crystal state; changed only by tempering/quenching/annealing | |
82 | + /// The metals crystal state; changed only by normalizing/quenching/annealing | |
83 | 83 | /// </summary> |
84 | 84 | /// <remarks> |
85 | - /// Reduces wear - with a penalty of random catastrophic failure... | |
85 | + /// Reduces wear - with a penalty of random catastrophic failure...Metal's "Temper' | |
86 | 86 | /// </remarks> |
87 | 87 | public enum HardnessState : byte |
88 | 88 | { |
89 | 89 | Soft = 0, |
90 | - Medium = 1, | |
91 | - Hard = 2, | |
92 | - Brittle = 3, | |
90 | + Mild = 1, | |
91 | + Medium = 2, | |
92 | + Hard = 3, | |
93 | + Brittle = 4, | |
93 | 94 | } |
94 | 95 | |
95 | 96 | } |
@@ -297,13 +297,13 @@ namespace ElementalTools | ||
297 | 297 | /// <param name="entityItem">Entity item.</param> |
298 | 298 | public override void OnGroundIdle(EntityItem entityItem) |
299 | 299 | { |
300 | - | |
301 | - if (entityItem.Swimming || entityItem.FeetInLiquid) { | |
300 | + if (api.Side.IsServer() && (entityItem.Swimming || entityItem.FeetInLiquid)) { | |
301 | + | |
302 | 302 | if (!this.Hardenable) return; |
303 | 303 | |
304 | 304 | float temperature = entityItem.Itemstack.Collectible.GetTemperature(api.World, entityItem.Itemstack); |
305 | 305 | //Track first moment in liquid; |
306 | - this.SetTimestamp(entityItem);//BUG: NOT WORKING!? | |
306 | + this.SetTimestamp(entityItem);//Clear on pickup or...? | |
307 | 307 | |
308 | 308 | //Above 900C - What should happen in this range; different phase of iron? |
309 | 309 |
@@ -326,7 +326,7 @@ namespace ElementalTools | ||
326 | 326 | entityItem.Itemstack.Collectible.SetTemperature(api.World, entityItem.Itemstack, temperature - 17, false); |
327 | 327 | |
328 | 328 | #if DEBUG |
329 | - api.World.Logger.VerboseDebug("Quench process: {0}S elapsed @{1}C", elapsedTime.TotalSeconds, temperature); | |
329 | + api.World.Logger.VerboseDebug("Quench process: {0}S elapsed @{1}C H:{2} ~ QU#{3}", elapsedTime.TotalSeconds, temperature, this.Hardness(entityItem.Itemstack), quenchUnits ); | |
330 | 330 | #endif |
331 | 331 | } |
332 | 332 | } |
@@ -773,16 +773,17 @@ namespace ElementalTools | ||
773 | 773 | |
774 | 774 | internal void SetTimestamp(EntityItem entityItem) |
775 | 775 | { |
776 | - if (!entityItem.Itemstack.TempAttributes.HasAttribute(_timestampKey)) { | |
777 | - entityItem.Itemstack.TempAttributes.SetLong(_timestampKey, entityItem.itemSpawnedMilliseconds); | |
776 | + | |
777 | + if (!entityItem.Attributes.HasAttribute(_timestampKey)) { | |
778 | + entityItem.Attributes.SetLong(_timestampKey, DateTime.Now.Ticks); | |
778 | 779 | } |
779 | 780 | } |
780 | 781 | |
781 | 782 | internal TimeSpan GetTimestampElapsed(EntityItem entityItem) |
782 | 783 | { |
783 | - if (entityItem.Itemstack.TempAttributes.HasAttribute(_timestampKey)) { | |
784 | - var ts = TimeSpan.FromMilliseconds(entityItem.Itemstack.TempAttributes.GetLong(_timestampKey)); | |
785 | - return ts.Subtract(TimeSpan.FromMilliseconds(entityItem.itemSpawnedMilliseconds)).Negate(); | |
784 | + if (entityItem.Attributes.HasAttribute(_timestampKey)) { | |
785 | + var ts = TimeSpan.FromTicks(entityItem.Attributes.GetLong(_timestampKey)); | |
786 | + return ts.Subtract(TimeSpan.FromTicks(DateTime.Now.Ticks)).Negate(); | |
786 | 787 | } |
787 | 788 | return TimeSpan.Zero; |
788 | 789 | } |
@@ -42,7 +42,7 @@ | ||
42 | 42 | height: 3, |
43 | 43 | attributes: { |
44 | 44 | outputOverride: "cleaver-blister_steel", |
45 | - extraCookTime:10, | |
45 | + extraCookTime:1, | |
46 | 46 | }, |
47 | 47 | output: { type: "block", code: "pack_carburization-unfired" } |
48 | 48 | }, |
@@ -89,7 +89,7 @@ | ||
89 | 89 | height: 3, |
90 | 90 | attributes: { |
91 | 91 | outputOverride: "pickaxehead-blister_steel", |
92 | - extraCookTime:25, | |
92 | + extraCookTime:2, | |
93 | 93 | }, |
94 | 94 | output: { type: "block", code: "pack_carburization-unfired" } |
95 | 95 | }, |
@@ -145,7 +145,7 @@ | ||
145 | 145 | height: 3, |
146 | 146 | attributes: { |
147 | 147 | outputOverride: "prospectingpickhead-blister_steel", |
148 | - extraCookTime:15, | |
148 | + extraCookTime:10, | |
149 | 149 | }, |
150 | 150 | output: { type: "block", code: "pack_carburization-unfired" } |
151 | 151 | }, |
@@ -161,7 +161,7 @@ | ||
161 | 161 | height: 3, |
162 | 162 | attributes: { |
163 | 163 | outputOverride: "sawblade-blister_steel", |
164 | - extraCookTime:25, | |
164 | + extraCookTime:20, | |
165 | 165 | }, |
166 | 166 | output: { type: "block", code: "pack_carburization-unfired" } |
167 | 167 | }, |
@@ -177,7 +177,7 @@ | ||
177 | 177 | height: 3, |
178 | 178 | attributes: { |
179 | 179 | outputOverride: "scythehead-blister_steel", |
180 | - extraCookTime:20, | |
180 | + extraCookTime:25, | |
181 | 181 | }, |
182 | 182 | output: { type: "block", code: "pack_carburization-unfired" } |
183 | 183 | }, |
@@ -225,7 +225,7 @@ ingredientPattern: "CCC KXK CCC", | ||
225 | 225 | height: 3, |
226 | 226 | attributes: { |
227 | 227 | outputOverride: "axehead-blister_steel", |
228 | - extraCookTime:25, | |
228 | + extraCookTime:20, | |
229 | 229 | }, |
230 | 230 | output: { type: "block", code: "pack_carburization-unfired" } |
231 | 231 | } |