• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqtwindows誰得cocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

First Machine Age's Mods (Combined repo.)


Commit MetaInfo

Revisionb0c6c8ef6b4707bd5565eafb2c8a61516429da49 (tree)
Time2022-07-09 07:31:37
Authormelchior <melchior@user...>
Commitermelchior

Log Message

More WIP behavior stuff

Change Summary

Incremental Difference

--- a/AnvilMetalRecovery/CollectableBehaviors/DirectSprayCooler_Behavior.cs
+++ b/AnvilMetalRecovery/CollectableBehaviors/DirectSprayCooler_Behavior.cs
@@ -1,6 +1,7 @@
11 using System;
22
33 using Vintagestory.API.Common;
4+using Vintagestory.API.Datastructures;
45 using Vintagestory.API.MathTools;
56 using Vintagestory.GameContent;
67 using Vintagestory.Server;
@@ -14,41 +15,55 @@ namespace AnvilMetalRecovery
1415 /// <remarks>*TSSSSS!*</remarks>
1516 public class DirectSprayCooler_Behavior : BlockBehavior
1617 {
17- public const string ClassName = @"directspraycooler_behavior";
18- private const float coolRate = 0.5f;
18+ public const string ClassName = @"directspraycooler";
19+ private const string coolRateKey = @"coolRate";
20+ private const float coolRateDefault = 0.5f;
1921 private BlockWateringCan WateringCan;
2022 protected ICoreAPI CoreAPI { get; set; }
23+ public float CoolRate { get; private set;}
2124
2225 public DirectSprayCooler_Behavior(Block block) : base(block)
2326 {
2427
2528 }
2629
30+ public override void OnLoaded(ICoreAPI api)
31+ {
32+ #if DEBUG
33+ api.Logger.VerboseDebug("DirectSprayCooler_Behavior::OnLoaded...");
34+ #endif
35+ base.OnLoaded(api);
36+ CoreAPI = api;
2737
28- internal void coolContents(ItemStack itemStack)
38+ WateringCan = block as BlockWateringCan;
39+ if (WateringCan == null) { throw new InvalidOperationException(string.Format("Block with code '{0}' does not inherit from BlockWateringCan, which is required", block.Code)); }
40+
41+ }
42+
43+
44+ public override void Initialize(JsonObject properties)
2945 {
30- var temperature = itemStack.Collectible.GetTemperature(CoreAPI.World, itemStack);
31- if (temperature > 25f)//TODO: USE local AMBIENT Temp
32- itemStack.Collectible.SetTemperature(CoreAPI.World, itemStack, (temperature - coolRate), false);
3346 #if DEBUG
34- CoreAPI.Logger.VerboseDebug("Reduced Molten metal temp: {0:F1} ", temperature);
47+ CoreAPI.Logger.VerboseDebug("DirectSprayCooler_Behavior::Initialize...");
3548 #endif
49+
50+ CoolRate = properties[coolRateKey].AsFloat(coolRateDefault);
51+
52+ base.Initialize(properties);
3653 }
3754
38- public override void OnLoaded(ICoreAPI api)
55+
56+ internal void coolContents(ItemStack itemStack)
3957 {
58+ var temperature = itemStack.Collectible.GetTemperature(CoreAPI.World, itemStack);
59+ if (temperature > 25f)//TODO: USE local AMBIENT Temp
60+ itemStack.Collectible.SetTemperature(CoreAPI.World, itemStack, (temperature - CoolRate), false);
4061 #if DEBUG
41- api.Logger.VerboseDebug("DirectSprayCooler_Behavior::OnLoaded...");
62+ CoreAPI.Logger.VerboseDebug("Reduced Molten metal temp: {0:F1} ", temperature);
4263 #endif
43- base.OnLoaded(api);
44- CoreAPI = api;
45- /*
46- WateringCan = block as BlockWateringCan;
47- if (WateringCan == null)
48- { throw new InvalidOperationException(string.Format("Block with code '{0}' does not inherit from BlockWateringCan, which is required", block.Code)); }
49- */
5064 }
5165
66+
5267 public override bool OnHeldInteractStep(float secondsUsed, ItemSlot slot, EntityAgent byEntity, BlockSelection blockSel, EntitySelection entitySel, ref EnumHandling handling)
5368 {
5469 #if DEBUG
--- a/AnvilMetalRecovery/assets/fma/patches/wateringcan_behavior.json
+++ b/AnvilMetalRecovery/assets/fma/patches/wateringcan_behavior.json
@@ -4,7 +4,7 @@
44 "path": "/behaviorsByType/*-burned",
55 "value": [
66 {
7- "name": "directspraycooler_behavior"
7+ name: "directspraycooler", properties: { coolRate: 1.0 }
88 }
99 ],
1010 "file": "game:blocktypes/clay/wateringcan.json"
--- a/AnvilMetalRecovery/modinfo.json
+++ b/AnvilMetalRecovery/modinfo.json
@@ -1,12 +1,12 @@
11 {
22 "type": "code",
33 "name": "Anvil Metal Recovery+",
4- "description" : "Get back lost scrap and smithing discards. Plus more.",
4+ "description" : "Get back smithing discards and broken tool scrap! Plus lots more.",
55 "authors": ["Melchior"],
66 "ModID":"metalrecovery",
7- "version": "0.1.17",
7+ "version": "0.1.18-pre.0",
88 "dependencies": {
9- "game": "1.16.4",
9+ "game": "1.16.5",
1010 "survival": ""
1111 },
1212 "website": "http://nowebsite.nope"