WIP New features
This commit is contained in:
parent
a58f942c90
commit
298c75d5f4
6 changed files with 38 additions and 13 deletions
|
|
@ -86,6 +86,7 @@
|
|||
<Compile Include="Harmony\GenericItemMortalityDetector.cs" />
|
||||
<Compile Include="Data\AMR_Config.cs" />
|
||||
<Compile Include="Data\RecoveryEntryTable.cs" />
|
||||
<Compile Include="CollectableBehaviors\DirectSprayCooler_Behavior.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="modinfo.json">
|
||||
|
|
@ -125,6 +126,9 @@
|
|||
<None Include="assets\fma\lang\ru.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="assets\fma\patches\wateringcan_behavior.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="assets\" />
|
||||
|
|
@ -146,6 +150,7 @@
|
|||
<Folder Include="Data\" />
|
||||
<Folder Include="Items\" />
|
||||
<Folder Include="Harmony\" />
|
||||
<Folder Include="CollectableBehaviors\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
|
|
@ -13,13 +13,15 @@ namespace AnvilMetalRecovery
|
|||
public AMRConfig( )
|
||||
{
|
||||
ToolFragmentRecovery = true;
|
||||
VoxelEquivalentValue = MetalRecoverySystem.IngotVoxelDefault;
|
||||
VoxelEquivalentValue = MetalRecoverySystem.IngotVoxelDefault;
|
||||
ToolRecoveryRate = 1.0f;
|
||||
}
|
||||
|
||||
public AMRConfig(bool setDefaultBL)
|
||||
public AMRConfig(bool setDefaultBL)
|
||||
{
|
||||
ToolFragmentRecovery = true;
|
||||
VoxelEquivalentValue = MetalRecoverySystem.IngotVoxelDefault;
|
||||
ToolRecoveryRate = 1.0f;
|
||||
if (setDefaultBL) {
|
||||
BlackList = new List<AssetLocation> {
|
||||
new AssetLocation(@"game:metalplate"),
|
||||
|
|
@ -42,13 +44,16 @@ namespace AnvilMetalRecovery
|
|||
[ProtoMember(3)]
|
||||
public List<AssetLocation> BlackList;
|
||||
|
||||
|
||||
[ProtoMember(4)]
|
||||
public float ToolRecoveryRate;
|
||||
|
||||
|
||||
[ProtoAfterDeserialization]
|
||||
private void ClampRange( )
|
||||
{
|
||||
VoxelEquivalentValue = Math.Max(1f, Math.Min(VoxelEquivalentValue, MetalRecoverySystem.IngotVoxelDefault));
|
||||
ToolRecoveryRate = Math.Min(1f, ToolRecoveryRate);
|
||||
ToolRecoveryRate = Math.Max(0.1f, ToolRecoveryRate);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -101,9 +101,9 @@ namespace AnvilMetalRecovery
|
|||
//virtual bool CanBePlacedInto(ItemStack stack, ItemSlot slot) //?
|
||||
//virtual void OnModifiedInInventorySlot //Only for new-Inserts (?)
|
||||
|
||||
public void ApplyMetalProperties(RecoveryEntry recoveryData, ref ItemStack contStack)
|
||||
public void ApplyMetalProperties(RecoveryEntry recoveryData, ref ItemStack contStack, float percentAdjust = 1.0f)
|
||||
{
|
||||
contStack.Attributes.SetInt(metalQuantityKey, ( int )recoveryData.Quantity);
|
||||
contStack.Attributes.SetInt(metalQuantityKey, ( int )(recoveryData.Quantity * percentAdjust));
|
||||
contStack.Attributes.SetString(metalIngotCodeKey, recoveryData.IngotCode.ToString( ));
|
||||
|
||||
RegenerateCombustablePropsFromStack(contStack);
|
||||
|
|
|
|||
|
|
@ -7,10 +7,16 @@ using HarmonyLib;
|
|||
using Vintagestory.API.Client;
|
||||
using Vintagestory.API.Common;
|
||||
using Vintagestory.API.Server;
|
||||
using Vintagestory.API.Util;
|
||||
using Vintagestory.Client.NoObf;
|
||||
using Vintagestory.GameContent;
|
||||
using Vintagestory.Server;
|
||||
|
||||
/* IDEAS / ISSUES
|
||||
* # Watering Can (molten-metal state) Ingot Cooling *Tssss*
|
||||
* # Ingot breaks -> Metal fragments / bits (or a blob?)
|
||||
* # Tool-break configurable ratio
|
||||
*/
|
||||
namespace AnvilMetalRecovery
|
||||
{
|
||||
public partial class MetalRecoverySystem : ModSystem
|
||||
|
|
@ -20,9 +26,12 @@ namespace AnvilMetalRecovery
|
|||
internal const string metalFragmentsCode = @"fma:metal_fragments";
|
||||
internal const string metalShavingsCode = @"metal_shaving";
|
||||
internal const string itemFilterListCacheKey = @"AMR_ItemFilters";
|
||||
|
||||
public const float IngotVoxelDefault = 2.38f;
|
||||
public const string ItemDamageChannelName = @"ItemDamageEvents";
|
||||
|
||||
|
||||
|
||||
internal IServerNetworkChannel _ConfigDownlink;
|
||||
internal IClientNetworkChannel _ConfigUplink;
|
||||
|
||||
|
|
@ -101,6 +110,7 @@ namespace AnvilMetalRecovery
|
|||
this.CoreAPI = api;
|
||||
|
||||
RegisterItemMappings( );
|
||||
RegisterBlockBehaviors( );
|
||||
|
||||
#if DEBUG
|
||||
//Harmony.DEBUG = true;
|
||||
|
|
@ -127,9 +137,8 @@ namespace AnvilMetalRecovery
|
|||
PrepareDownlinkChannel( );
|
||||
ServerAPI.Event.PlayerJoin += SendClientConfigMessage;
|
||||
ServerAPI.Event.ServerRunPhase(EnumServerRunPhase.Shutdown, PersistServersideConfig);
|
||||
ServerAPI.Event.ServerRunPhase(EnumServerRunPhase.GameReady, MaterialDataGathering);
|
||||
//ServerAPI.Event.ServerRunPhase(EnumServerRunPhase.WorldReady, CacheRecoveryDataTable);//This does not appear to work?!
|
||||
ServerAPI.Event.ServerRunPhase(EnumServerRunPhase.RunGame, CacheRecoveryDataTable);
|
||||
ServerAPI.Event.ServerRunPhase(EnumServerRunPhase.GameReady, MaterialDataGathering);
|
||||
ServerAPI.Event.ServerRunPhase(EnumServerRunPhase.RunGame, CacheRecoveryDataTable);
|
||||
|
||||
SetupGeneralObservers( );
|
||||
|
||||
|
|
@ -152,7 +161,7 @@ namespace AnvilMetalRecovery
|
|||
Mod.Logger.Error("Cannot access 'ClientCoreAPI' class: API (implimentation) has changed, Contact Developer!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ListenForServerConfigMessage( );
|
||||
Mod.Logger.VerboseDebug("Anvil Metal Recovery - should be installed...");
|
||||
}
|
||||
|
|
@ -164,7 +173,13 @@ namespace AnvilMetalRecovery
|
|||
this.CoreAPI.RegisterItemClass(@"SmartSmeltableItem", typeof(SmartSmeltableItem));
|
||||
}
|
||||
|
||||
|
||||
private void RegisterBlockBehaviors()
|
||||
{
|
||||
#if DEBUG
|
||||
Mod.Logger.Debug("RegisterBlockBehaviors");
|
||||
#endif
|
||||
this.CoreAPI.RegisterBlockBehaviorClass(DirectSprayCooler_Behavior.ClassName, typeof(DirectSprayCooler_Behavior));
|
||||
}
|
||||
|
||||
private void SetupGeneralObservers( ){
|
||||
ServerCore.Event.RegisterEventBusListener(Item_DamageEventReciever, 1.0f, ItemDamageChannelName);
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ namespace AnvilMetalRecovery
|
|||
|
||||
VariableMetalItem variableMetal = ServerAPI.World.GetItem(new AssetLocation(metalFragmentsCode)) as VariableMetalItem;
|
||||
ItemStack metalFragmentsStack = new ItemStack(variableMetal, 1);
|
||||
variableMetal.ApplyMetalProperties(rec, ref metalFragmentsStack);
|
||||
variableMetal.ApplyMetalProperties(rec, ref metalFragmentsStack, CachedConfiguration.ToolRecoveryRate);
|
||||
hotSlot.Itemstack = metalFragmentsStack;
|
||||
hotSlot.Itemstack.ResolveBlockOrItem(ServerAPI.World);
|
||||
hotSlot.MarkDirty( );
|
||||
|
|
@ -160,7 +160,7 @@ namespace AnvilMetalRecovery
|
|||
|
||||
VariableMetalItem variableMetal = ServerAPI.World.GetItem(new AssetLocation(metalFragmentsCode)) as VariableMetalItem;
|
||||
ItemStack metalFragmentsStack = new ItemStack(variableMetal, 1);
|
||||
variableMetal.ApplyMetalProperties(rec, ref metalFragmentsStack);
|
||||
variableMetal.ApplyMetalProperties(rec, ref metalFragmentsStack, CachedConfiguration.ToolRecoveryRate);
|
||||
if (spim.TryGiveItemstack(metalFragmentsStack, true) == false)
|
||||
{
|
||||
//Player with full Inv.
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
"textureSizes": {
|
||||
},
|
||||
"textures": {
|
||||
"metal": "block/metal/ingot/lead"
|
||||
"metal": "game:block/metal/ingot/lead"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue