First Machine Age's Mods (Combined repo.)
修订版 | 1f65f75ca5890e969fed72656ff44ab551e83486 (tree) |
---|---|
时间 | 2022-07-25 09:41:19 |
作者 | melchior <melchior@user...> |
Commiter | melchior |
W.I.P. extra Effects II: Almost...
@@ -86,7 +86,7 @@ | ||
86 | 86 | <Compile Include="Harmony\GenericItemMortalityDetector.cs" /> |
87 | 87 | <Compile Include="Data\AMR_Config.cs" /> |
88 | 88 | <Compile Include="Data\RecoveryEntryTable.cs" /> |
89 | - <Compile Include="CollectableBehaviors\DirectSprayCooler_Behavior.cs" /> | |
89 | + <Compile Include="Blocks\BlockWateringCanPlus.cs" /> | |
90 | 90 | </ItemGroup> |
91 | 91 | <ItemGroup> |
92 | 92 | <None Include="modinfo.json"> |
@@ -127,7 +127,6 @@ | ||
127 | 127 | <CopyToOutputDirectory>Always</CopyToOutputDirectory> |
128 | 128 | </None> |
129 | 129 | <None Include="assets\fma\patches\wateringcan_behavior.json"> |
130 | - <CopyToOutputDirectory>Always</CopyToOutputDirectory> | |
131 | 130 | </None> |
132 | 131 | </ItemGroup> |
133 | 132 | <ItemGroup> |
@@ -151,6 +150,9 @@ | ||
151 | 150 | <Folder Include="Items\" /> |
152 | 151 | <Folder Include="Harmony\" /> |
153 | 152 | <Folder Include="CollectableBehaviors\" /> |
153 | + <Folder Include="Blocks\" /> | |
154 | + <Folder Include="assets\fma\sounds\" /> | |
155 | + <Folder Include="assets\fma\sounds\sfx\" /> | |
154 | 156 | </ItemGroup> |
155 | 157 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> |
156 | 158 | </Project> |
\ No newline at end of file |
@@ -0,0 +1,124 @@ | ||
1 | +using System; | |
2 | +using System.Text; | |
3 | + | |
4 | +using Vintagestory.API.Client; | |
5 | +using Vintagestory.API.Common; | |
6 | +using Vintagestory.API.Common.Entities; | |
7 | +using Vintagestory.API.Config; | |
8 | +using Vintagestory.API.MathTools; | |
9 | +using Vintagestory.API.Server; | |
10 | +using Vintagestory.GameContent; | |
11 | + | |
12 | +namespace AnvilMetalRecovery | |
13 | +{ | |
14 | + public class BlockWateringCanPlus : BlockWateringCan | |
15 | + { | |
16 | + private const float coolRateDefault = 5.0f; | |
17 | + | |
18 | + protected ICoreAPI CoreAPI { get { return this.api; } } | |
19 | + protected ICoreServerAPI ServerAPI { get { return this.api as ICoreServerAPI; } } | |
20 | + protected ICoreClientAPI ClientAPI { get { return this.api as ICoreClientAPI; } } | |
21 | + | |
22 | + public readonly AssetLocation CoolSoundEffect = new AssetLocation(@"game", @"sounds/sizzle"); | |
23 | + public static readonly string BlockClassName = @"BlockWateringCan"; | |
24 | + public static readonly AssetLocation TargetCode = new AssetLocation(@"game", @"wateringcan-burned"); | |
25 | + | |
26 | + /// <summary> | |
27 | + /// DO OnHeldInteractStep | |
28 | + /// </summary> | |
29 | + /// <returns>The held interact step.</returns> | |
30 | + /// <param name="secondsUsed">Seconds used.</param> | |
31 | + /// <param name="slot">Slot.</param> | |
32 | + /// <param name="byEntity">By entity.</param> | |
33 | + /// <param name="blockSel">Block sel.</param> | |
34 | + /// <param name="entitySel">Entity sel.</param> | |
35 | + /// <remarks> | |
36 | + /// Had to do it this way the base class _NEVER_ invokes the block-behavior virtual... | |
37 | + /// </remarks> | |
38 | + public override bool OnHeldInteractStep(float secondsUsed, ItemSlot slot, EntityAgent byEntity, BlockSelection blockSel, EntitySelection entitySel) | |
39 | + { | |
40 | + this.api.Logger.VerboseDebug("BlockWateringCanPlus::OnHeldInteractStep"); | |
41 | + var result = base.OnHeldInteractStep(secondsUsed, slot, byEntity, blockSel, entitySel); | |
42 | + | |
43 | + PerformBlockCooling(secondsUsed, slot, byEntity, blockSel, entitySel); | |
44 | + | |
45 | + return result; | |
46 | + } | |
47 | + | |
48 | + private void PerformBlockCooling(float secondsUsed, ItemSlot slot, EntityAgent byEntity, BlockSelection blockSel, EntitySelection entitySel) | |
49 | + { | |
50 | + if (blockSel == null) return; | |
51 | + if (byEntity.Controls.Sneak) return; | |
52 | + | |
53 | + BlockPos targetPos = blockSel.Position; | |
54 | + | |
55 | + if (this.GetRemainingWateringSeconds(slot.Itemstack) >= 0.1f) | |
56 | + { | |
57 | + var server = (CoreAPI.World.Side.IsServer()); | |
58 | + | |
59 | + var someBlock = CoreAPI.World.BlockAccessor.GetBlock(targetPos); | |
60 | + | |
61 | + if (someBlock != null | |
62 | + && someBlock.BlockMaterial == EnumBlockMaterial.Ceramic | |
63 | + && (someBlock.Class == @"BlockIngotMold" || someBlock.Class == @"BlockToolMold")) | |
64 | + { | |
65 | + var someBlockEntity = CoreAPI.World.BlockAccessor.GetBlockEntity(targetPos); | |
66 | + | |
67 | + if (someBlockEntity is BlockEntityIngotMold) { | |
68 | + var ingotMold = someBlockEntity as BlockEntityIngotMold; | |
69 | + if (ingotMold.fillSide && ingotMold.fillLevelRight > 0 && ingotMold.IsLiquidRight) { | |
70 | + if (server) CoolContents(ingotMold.contentsRight); else GenerateSpecialEffects(blockSel.HitPosition); | |
71 | + } | |
72 | + else if (ingotMold.fillLevelLeft > 0 && ingotMold.IsLiquidLeft) { | |
73 | + if (server) CoolContents(ingotMold.contentsLeft); else GenerateSpecialEffects(blockSel.HitPosition); | |
74 | + } | |
75 | + return; | |
76 | + } | |
77 | + | |
78 | + if (someBlockEntity is BlockEntityToolMold) { | |
79 | + var toolMold = someBlockEntity as BlockEntityToolMold; | |
80 | + if (toolMold.fillLevel > 0 && toolMold.IsLiquid) { | |
81 | + if (server) CoolContents(toolMold.metalContent); else GenerateSpecialEffects(blockSel.HitPosition); | |
82 | + } | |
83 | + return; | |
84 | + } | |
85 | + } | |
86 | + } | |
87 | + } | |
88 | + | |
89 | + internal void GenerateSpecialEffects(Vec3d here) | |
90 | + { | |
91 | + var steamParticles = new SimpleParticleProperties { | |
92 | + MinPos = here, | |
93 | + AddPos = here.AddCopy(0.1,0.1,0.1), | |
94 | + MinQuantity = 8, | |
95 | + AddQuantity = 24, | |
96 | + Color = ColorUtil.ToRgba(100, 225, 225, 225), | |
97 | + GravityEffect = -0.015f, | |
98 | + WithTerrainCollision = true, | |
99 | + ParticleModel = EnumParticleModel.Quad, | |
100 | + LifeLength = 2.0f, | |
101 | + MinVelocity = new Vec3f(-0.25f, 0.1f, -0.25f), | |
102 | + AddVelocity = new Vec3f(0.25f, 0.1f, 0.25f), | |
103 | + MinSize = 0.075f, | |
104 | + MaxSize = 0.1f, | |
105 | + //VertexFlags = 32 | |
106 | + }; | |
107 | + ClientAPI.World.SpawnParticles(steamParticles ); | |
108 | + ClientAPI.World.PlaySoundAt(CoolSoundEffect, here.X,here.Y,here.Z, null, false, 16 ); | |
109 | + } | |
110 | + | |
111 | + internal void CoolContents(ItemStack itemStack) | |
112 | + { | |
113 | + var temperature = itemStack.Collectible.GetTemperature(CoreAPI.World, itemStack); | |
114 | + if (temperature > 25f)//TODO: USE local AMBIENT Temp | |
115 | + itemStack.Collectible.SetTemperature(CoreAPI.World, itemStack, (temperature - coolRateDefault), false); | |
116 | + #if DEBUG | |
117 | + CoreAPI.Logger.VerboseDebug("Reduced Molten metal temp: {0:F1} ", temperature); | |
118 | + #endif | |
119 | + } | |
120 | + | |
121 | + | |
122 | + } | |
123 | +} | |
124 | + |
@@ -1,8 +1,10 @@ | ||
1 | 1 | using System; |
2 | 2 | |
3 | 3 | using Vintagestory.API.Common; |
4 | +using Vintagestory.API.Config; | |
4 | 5 | using Vintagestory.API.Datastructures; |
5 | 6 | using Vintagestory.API.MathTools; |
7 | +using Vintagestory.API.Server; | |
6 | 8 | using Vintagestory.GameContent; |
7 | 9 | using Vintagestory.Server; |
8 | 10 |
@@ -13,77 +15,90 @@ namespace AnvilMetalRecovery | ||
13 | 15 | /// Direct spray cooler collectable behavior. |
14 | 16 | /// </summary> |
15 | 17 | /// <remarks>*TSSSSS!*</remarks> |
16 | - public class DirectSprayCooler_Behavior : BlockBehavior | |
18 | + public class DirectSprayCooler_Behavior : CollectibleBehavior | |
17 | 19 | { |
18 | - public const string ClassName = @"directspraycooler"; | |
19 | 20 | private const string coolRateKey = @"coolRate"; |
20 | 21 | private const float coolRateDefault = 0.5f; |
21 | 22 | private BlockWateringCan WateringCan; |
22 | - protected ICoreAPI CoreAPI { get; set; } | |
23 | + protected ICoreAPI CoreAPI { get; private set;} | |
24 | + protected ICoreServerAPI ServerAPI { get; private set;} | |
25 | + | |
26 | + public const string ClassName = @"directspraycooler"; | |
23 | 27 | public float CoolRate { get; private set;} |
24 | 28 | |
25 | - public DirectSprayCooler_Behavior(Block block) : base(block) | |
26 | - { | |
27 | - | |
29 | + public DirectSprayCooler_Behavior(CollectibleObject collecta) : base(collecta) | |
30 | + { | |
31 | + } | |
32 | + | |
33 | + public override void Initialize(JsonObject properties) | |
34 | + { | |
35 | + base.Initialize(properties); | |
36 | + | |
37 | + CoolRate = properties[coolRateKey].AsFloat(coolRateDefault); | |
28 | 38 | } |
29 | 39 | |
30 | 40 | public override void OnLoaded(ICoreAPI api) |
31 | 41 | { |
42 | + base.OnLoaded(api); | |
43 | + CoreAPI = api; | |
44 | + | |
32 | 45 | #if DEBUG |
33 | 46 | api.Logger.VerboseDebug("DirectSprayCooler_Behavior::OnLoaded..."); |
34 | 47 | #endif |
35 | - base.OnLoaded(api); | |
36 | - CoreAPI = api; | |
48 | + | |
49 | + WateringCan = this.collObj as BlockWateringCan; | |
50 | + if (WateringCan == null) { throw new InvalidOperationException(string.Format("Block with code '{0}' does not inherit from BlockWateringCan, which is required", collObj.Code)); } | |
37 | 51 | |
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)); } | |
52 | + } | |
40 | 53 | |
54 | + public override void GetHeldItemInfo(ItemSlot inSlot, System.Text.StringBuilder dsc, IWorldAccessor world, bool withDebugInfo) | |
55 | + { | |
56 | + dsc.Append(Lang.Get("fma:spray_cooler_text")); | |
41 | 57 | } |
42 | 58 | |
43 | 59 | |
44 | - public override void Initialize(JsonObject properties) | |
60 | + | |
61 | + public override void OnHeldInteractStart(ItemSlot slot, EntityAgent byEntity, BlockSelection blockSel, EntitySelection entitySel, bool firstEvent, ref EnumHandHandling handHandling, ref EnumHandling handling) | |
45 | 62 | { |
46 | 63 | #if DEBUG |
47 | - CoreAPI.Logger.VerboseDebug("DirectSprayCooler_Behavior::Initialize..."); | |
64 | + byEntity.World.Logger.VerboseDebug("DirectSprayCooler_Behavior::OnHeldInteractStart..."); | |
48 | 65 | #endif |
49 | 66 | |
50 | - CoolRate = properties[coolRateKey].AsFloat(coolRateDefault); | |
51 | - | |
52 | - base.Initialize(properties); | |
67 | + handHandling = EnumHandHandling.PreventDefault; | |
68 | + handling = EnumHandling.PassThrough; //EnumHandling.PreventDefault; | |
53 | 69 | } |
54 | 70 | |
55 | - | |
56 | - internal void coolContents(ItemStack itemStack) | |
71 | + public override void OnHeldInteractStop(float secondsUsed, ItemSlot slot, EntityAgent byEntity, BlockSelection blockSel, EntitySelection entitySel, ref EnumHandling handling) | |
57 | 72 | { |
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); | |
61 | 73 | #if DEBUG |
62 | - CoreAPI.Logger.VerboseDebug("Reduced Molten metal temp: {0:F1} ", temperature); | |
74 | + byEntity.World.Logger.VerboseDebug("DirectSprayCooler_Behavior::OnHeldInteractStop..."); | |
63 | 75 | #endif |
76 | + handling = EnumHandling.PassThrough; | |
77 | + | |
64 | 78 | } |
65 | 79 | |
66 | - | |
67 | 80 | public override bool OnHeldInteractStep(float secondsUsed, ItemSlot slot, EntityAgent byEntity, BlockSelection blockSel, EntitySelection entitySel, ref EnumHandling handling) |
68 | 81 | { |
69 | 82 | #if DEBUG |
70 | - CoreAPI.Logger.VerboseDebug("DirectSprayCooler_Behavior::OnHeldInteractStep..."); | |
83 | + byEntity.World.Logger.VerboseDebug("DirectSprayCooler_Behavior::OnHeldInteractStep..."); | |
71 | 84 | #endif |
72 | - | |
73 | - handling = EnumHandling.PassThrough; | |
85 | + CoreAPI = byEntity.World.Api; | |
86 | + | |
74 | 87 | if (blockSel == null) return false; |
88 | + if (byEntity.Controls.Sneak) return false; | |
75 | 89 | |
76 | 90 | if (CoreAPI.World.Side.IsServer( )) |
77 | - { | |
91 | + { | |
92 | + ServerAPI = byEntity.World.Api as ICoreServerAPI;; | |
78 | 93 | if (WateringCan.GetRemainingWateringSeconds(slot.Itemstack) >= 0.5f) { |
79 | 94 | BlockPos targetPos = blockSel.Position; |
80 | - var someBlock = CoreAPI.World.BlockAccessor.GetBlock(targetPos); | |
95 | + var someBlock = ServerAPI.World.BlockAccessor.GetBlock(targetPos); | |
81 | 96 | |
82 | 97 | if (someBlock != null |
83 | 98 | && someBlock.BlockMaterial == EnumBlockMaterial.Ceramic |
84 | 99 | && (someBlock.Class == @"BlockIngotMold" || someBlock.Class == @"BlockToolMold")) |
85 | 100 | { |
86 | - BlockEntityIngotMold ingotBE = CoreAPI.World.BlockAccessor.GetBlockEntity(targetPos) as BlockEntityIngotMold; | |
101 | + BlockEntityIngotMold ingotBE = ServerAPI.World.BlockAccessor.GetBlockEntity(targetPos) as BlockEntityIngotMold; | |
87 | 102 | |
88 | 103 | if (ingotBE != null) |
89 | 104 | { |
@@ -91,11 +106,11 @@ namespace AnvilMetalRecovery | ||
91 | 106 | { coolContents(ingotBE.contentsRight); } |
92 | 107 | else if (ingotBE.IsLiquidLeft) |
93 | 108 | { coolContents(ingotBE.contentsLeft); } |
94 | - | |
95 | - return false; | |
109 | + handling = EnumHandling.PreventDefault;//? | |
110 | + return true; | |
96 | 111 | } |
97 | 112 | |
98 | - BlockEntityToolMold toolBE = CoreAPI.World.BlockAccessor.GetBlockEntity(targetPos) as BlockEntityToolMold; | |
113 | + BlockEntityToolMold toolBE = ServerAPI.World.BlockAccessor.GetBlockEntity(targetPos) as BlockEntityToolMold; | |
99 | 114 | if (toolBE != null) |
100 | 115 | { |
101 | 116 | if (toolBE.IsLiquid) { coolContents(toolBE.metalContent); } |
@@ -104,13 +119,24 @@ namespace AnvilMetalRecovery | ||
104 | 119 | } |
105 | 120 | } |
106 | 121 | } |
107 | - | |
108 | 122 | } |
109 | - | |
123 | + | |
124 | + handling = EnumHandling.PassThrough; | |
110 | 125 | return false; |
111 | 126 | } |
112 | 127 | |
113 | 128 | |
129 | + internal void coolContents(ItemStack itemStack) | |
130 | + { | |
131 | + | |
132 | + var temperature = itemStack.Collectible.GetTemperature(CoreAPI.World, itemStack); | |
133 | + if (temperature > 25f)//TODO: USE local AMBIENT Temp | |
134 | + itemStack.Collectible.SetTemperature(CoreAPI.World, itemStack, (temperature - CoolRate), false); | |
135 | + #if DEBUG | |
136 | + CoreAPI.Logger.VerboseDebug("Reduced Molten metal temp: {0:F1} ", temperature); | |
137 | + #endif | |
138 | + } | |
139 | + | |
114 | 140 | |
115 | 141 | } |
116 | 142 | } |
@@ -4,6 +4,7 @@ using System.Linq; | ||
4 | 4 | using Vintagestory.API.Common; |
5 | 5 | using Vintagestory.API.Common.Entities; |
6 | 6 | using Vintagestory.API.Server; |
7 | +using Vintagestory.API.Util; | |
7 | 8 | using Vintagestory.Common; |
8 | 9 | using Vintagestory.Server; |
9 | 10 |
@@ -11,6 +12,39 @@ namespace AnvilMetalRecovery | ||
11 | 12 | { |
12 | 13 | internal static class Helpers |
13 | 14 | { |
15 | + internal static void AddBlockBehavior(this ICoreAPI coreAPI, AssetLocation assetName, string behaviorCode, Type blockBehaviorType) | |
16 | + { | |
17 | + if (assetName.Valid && assetName.IsWildCard == false) | |
18 | + { | |
19 | + var targetBlock = coreAPI.World.GetBlock(assetName); | |
20 | + var newBlockBehavior = coreAPI.ClassRegistry.CreateBlockBehavior(targetBlock, behaviorCode); | |
21 | + | |
22 | + if (targetBlock != null && newBlockBehavior != null) | |
23 | + { | |
24 | + targetBlock.BlockBehaviors = targetBlock.BlockBehaviors.Append(newBlockBehavior); | |
25 | + targetBlock.CollectibleBehaviors = targetBlock.CollectibleBehaviors.Append(newBlockBehavior); | |
26 | + } | |
27 | + else { | |
28 | + coreAPI.Logger.Warning($"Could not append new BLOCK BEHAVIOR ({blockBehaviorType.Name}): '{behaviorCode}' to block [{assetName}]!"); | |
29 | + } | |
30 | + } | |
31 | + } | |
32 | + | |
33 | + internal static void AddCollectableBehavior(this ICoreAPI coreAPI, AssetLocation assetName, string behaviorCode, Type blockBehaviorType) | |
34 | + { | |
35 | + if (assetName.Valid && assetName.IsWildCard == false) { | |
36 | + var targetBlock = coreAPI.World.GetBlock(assetName); | |
37 | + var newCollectableBehavior = coreAPI.ClassRegistry.CreateCollectibleBehavior(targetBlock, behaviorCode); | |
38 | + | |
39 | + if (targetBlock != null && newCollectableBehavior != null) { | |
40 | + targetBlock.CollectibleBehaviors = targetBlock.CollectibleBehaviors.Append(newCollectableBehavior); | |
41 | + } | |
42 | + else { | |
43 | + coreAPI.Logger.Warning($"Could not append new COLLECTABLE BEHAVIOR ({blockBehaviorType.Name}): '{behaviorCode}' to something [{assetName}]!"); | |
44 | + } | |
45 | + } | |
46 | + } | |
47 | + | |
14 | 48 | internal static void ReplaceBlockEntityType(this ClassRegistry registry, string className, Type blockentity) |
15 | 49 | { |
16 | 50 | if (registry.blockEntityClassnameToTypeMapping.ContainsKey(className)) { |
@@ -28,6 +62,14 @@ namespace AnvilMetalRecovery | ||
28 | 62 | } |
29 | 63 | } |
30 | 64 | |
65 | + internal static void ReplaceBlockClassType(this ClassRegistry registry, string className, Type replacer) | |
66 | + { | |
67 | + if (registry.BlockClassToTypeMapping.ContainsKey(className)) { | |
68 | + //replace it | |
69 | + registry.BlockClassToTypeMapping[className] = replacer; | |
70 | + } | |
71 | + } | |
72 | + | |
31 | 73 | internal static int? Hitpoints(this ItemStack itemStack) |
32 | 74 | { |
33 | 75 | if (itemStack == null || itemStack.Attributes == null) return null; |
@@ -30,8 +30,6 @@ namespace AnvilMetalRecovery | ||
30 | 30 | public const float IngotVoxelDefault = 2.38f; |
31 | 31 | public const string ItemDamageChannelName = @"ItemDamageEvents"; |
32 | 32 | |
33 | - | |
34 | - | |
35 | 33 | internal IServerNetworkChannel _ConfigDownlink; |
36 | 34 | internal IClientNetworkChannel _ConfigUplink; |
37 | 35 |
@@ -110,7 +108,8 @@ namespace AnvilMetalRecovery | ||
110 | 108 | this.CoreAPI = api; |
111 | 109 | |
112 | 110 | RegisterItemMappings( ); |
113 | - RegisterBlockBehaviors( ); | |
111 | + //RegisterBlockBehaviors( ); | |
112 | + | |
114 | 113 | |
115 | 114 | #if DEBUG |
116 | 115 | //Harmony.DEBUG = true; |
@@ -137,10 +136,11 @@ namespace AnvilMetalRecovery | ||
137 | 136 | PrepareDownlinkChannel( ); |
138 | 137 | ServerAPI.Event.PlayerJoin += SendClientConfigMessage; |
139 | 138 | ServerAPI.Event.ServerRunPhase(EnumServerRunPhase.Shutdown, PersistServersideConfig); |
140 | - ServerAPI.Event.ServerRunPhase(EnumServerRunPhase.GameReady, MaterialDataGathering); | |
141 | - ServerAPI.Event.ServerRunPhase(EnumServerRunPhase.RunGame, CacheRecoveryDataTable); | |
139 | + ServerAPI.Event.ServerRunPhase(EnumServerRunPhase.GameReady, MaterialDataGathering); | |
140 | + PerformBlockClassSwaps(); | |
141 | + ServerAPI.Event.ServerRunPhase(EnumServerRunPhase.RunGame, CacheRecoveryDataTable); | |
142 | 142 | |
143 | - SetupGeneralObservers( ); | |
143 | + SetupGeneralObservers( ); | |
144 | 144 | |
145 | 145 | Mod.Logger.VerboseDebug("Anvil Metal Recovery - should be installed..."); |
146 | 146 |
@@ -163,6 +163,9 @@ namespace AnvilMetalRecovery | ||
163 | 163 | } |
164 | 164 | |
165 | 165 | ListenForServerConfigMessage( ); |
166 | + //ClientCore.Event.RegisterCallback(PerformBlockClassSwaps, 0); | |
167 | + PerformBlockClassSwaps(); | |
168 | + | |
166 | 169 | Mod.Logger.VerboseDebug("Anvil Metal Recovery - should be installed..."); |
167 | 170 | } |
168 | 171 |
@@ -178,7 +181,21 @@ namespace AnvilMetalRecovery | ||
178 | 181 | #if DEBUG |
179 | 182 | Mod.Logger.Debug("RegisterBlockBehaviors"); |
180 | 183 | #endif |
181 | - this.CoreAPI.RegisterBlockBehaviorClass(DirectSprayCooler_Behavior.ClassName, typeof(DirectSprayCooler_Behavior)); | |
184 | + //this.CoreAPI.RegisterBlockBehaviorClass(DirectSprayCooler_Behavior.ClassName, typeof(DirectSprayCooler_Behavior)); | |
185 | + //this.CoreAPI.RegisterCollectibleBehaviorClass(DirectSprayCooler_Behavior.ClassName, typeof(DirectSprayCooler_Behavior)); | |
186 | + } | |
187 | + | |
188 | + private void PerformBlockClassSwaps(float delta = 0.0f) | |
189 | + { | |
190 | + PerformBlockClassSwaps( ); | |
191 | + } | |
192 | + | |
193 | + private void PerformBlockClassSwaps() | |
194 | + { | |
195 | + if (CoreAPI.Side == EnumAppSide.Server) | |
196 | + this.ServerCore.ClassRegistryNative.ReplaceBlockClassType(BlockWateringCanPlus.BlockClassName, typeof(BlockWateringCanPlus)); | |
197 | + else | |
198 | + this.ClientCore.ClassRegistryNative.ReplaceBlockClassType(BlockWateringCanPlus.BlockClassName, typeof(BlockWateringCanPlus)); | |
182 | 199 | } |
183 | 200 | |
184 | 201 | private void SetupGeneralObservers( ){ |
@@ -247,7 +264,7 @@ namespace AnvilMetalRecovery | ||
247 | 264 | #endif |
248 | 265 | |
249 | 266 | if (networkMessage != null) { |
250 | - Mod.Logger.Debug("Message value; Recover Broken Tools:{0}, VoxelEquiv#{1:F2}, Blacklist #{2}", networkMessage.ToolFragmentRecovery, networkMessage.VoxelEquivalentValue, networkMessage.BlackList.Count); | |
267 | + Mod.Logger.Debug("Message value; Recover Broken Tools:{0}, VoxelEquiv:{1:F2}, Tool Recovery {3:P0}, Blacklisted:{2}", networkMessage.ToolFragmentRecovery, networkMessage.VoxelEquivalentValue, networkMessage.BlackList.Count, networkMessage.ToolRecoveryRate); | |
251 | 268 | this.CachedConfiguration = networkMessage; |
252 | 269 | } |
253 | 270 | } |
@@ -127,7 +127,7 @@ namespace AnvilMetalRecovery | ||
127 | 127 | |
128 | 128 | RecoveryEntry rec = itemToVoxelLookup[hotbarData.ItemCode]; |
129 | 129 | #if DEBUG |
130 | - Mod.Logger.VerboseDebug("broken-item {0} WORTH: {1:F1}*{2} units", hotbarData.ItemCode.ToString( ), (rec.Quantity * CachedConfiguration.VoxelEquivalentValue), rec.IngotCode.ToShortString( )); | |
130 | + Mod.Logger.VerboseDebug("broken-item {0} abs. WORTH: {1:F1}*{2} units", hotbarData.ItemCode.ToString( ), (rec.Quantity * CachedConfiguration.VoxelEquivalentValue), rec.IngotCode.ToShortString( )); | |
131 | 131 | #endif |
132 | 132 | |
133 | 133 | if (String.IsNullOrEmpty(hotbarData.PlayerUID) || String.IsNullOrEmpty(hotbarData.InventoryID)) return; |
@@ -26,4 +26,5 @@ | ||
26 | 26 | "fma:item-metal_fragments":"Broken metal fragments.", |
27 | 27 | "fma:itemdesc-item-metal_fragments": "Try, chopping it apart with a Chisel...", |
28 | 28 | "fma:metal_worth":"Worth {0} units of {1}.", |
29 | + "fma:spray_cooler_text":"\n...mabey it can cool off hot things, too?", | |
29 | 30 | } |
\ No newline at end of file |
@@ -4,7 +4,7 @@ | ||
4 | 4 | "path": "/behaviorsByType/*-burned", |
5 | 5 | "value": [ |
6 | 6 | { |
7 | - name: "directspraycooler", properties: { coolRate: 1.0 } | |
7 | + name: "directspraycooler", properties: { "coolRate": 1.0 } | |
8 | 8 | } |
9 | 9 | ], |
10 | 10 | "file": "game:blocktypes/clay/wateringcan.json" |