From 99a7aceee2213d0c8f0ecd38b6c5ebb3919aed16 Mon Sep 17 00:00:00 2001 From: AlessandroCH Date: Thu, 7 Aug 2025 01:45:49 +0200 Subject: [PATCH] some factory components (not finished) --- .../Factory/Components/FComponentBattle.cs | 23 ++++++++++++ .../Factory/Components/FComponentCache.cs | 21 +++++++++++ .../Components/FComponentFormulaMan.cs | 20 +++++++++++ .../Components/FComponentPortManager.cs | 13 ++++++- .../Factory/Components/FComponentProducer.cs | 20 +++++++++++ Campofinale/Game/Factory/FactoryManager.cs | 35 ++++++++++++++++--- 6 files changed, 126 insertions(+), 6 deletions(-) create mode 100644 Campofinale/Game/Factory/Components/FComponentBattle.cs create mode 100644 Campofinale/Game/Factory/Components/FComponentCache.cs create mode 100644 Campofinale/Game/Factory/Components/FComponentFormulaMan.cs create mode 100644 Campofinale/Game/Factory/Components/FComponentProducer.cs diff --git a/Campofinale/Game/Factory/Components/FComponentBattle.cs b/Campofinale/Game/Factory/Components/FComponentBattle.cs new file mode 100644 index 0000000..82d44e8 --- /dev/null +++ b/Campofinale/Game/Factory/Components/FComponentBattle.cs @@ -0,0 +1,23 @@ +using Campofinale.Resource; +using static Campofinale.Game.Factory.FactoryNode; + +namespace Campofinale.Game.Factory.Components +{ + public class FComponentBattle : FComponent + { + public int EnergyCurrent=100; + public FComponentBattle(uint id) : base(id, FCComponentType.Battle) + { + } + + public override void SetComponentInfo(ScdFacCom proto) + { + proto.Battle = new() + { + EnergyCurrent=100, + EnergyMax=100, + InOverloading=false + }; + } + } +} diff --git a/Campofinale/Game/Factory/Components/FComponentCache.cs b/Campofinale/Game/Factory/Components/FComponentCache.cs new file mode 100644 index 0000000..a88b7ca --- /dev/null +++ b/Campofinale/Game/Factory/Components/FComponentCache.cs @@ -0,0 +1,21 @@ +using Campofinale.Resource; +using static Campofinale.Game.Factory.FactoryNode; + +namespace Campofinale.Game.Factory.Components +{ + public class FComponentCache : FComponent + { + + public FComponentCache(uint id) : base(id, FCComponentType.Cache) + { + } + + public override void SetComponentInfo(ScdFacCom proto) + { + proto.Cache = new() + { + + }; + } + } +} diff --git a/Campofinale/Game/Factory/Components/FComponentFormulaMan.cs b/Campofinale/Game/Factory/Components/FComponentFormulaMan.cs new file mode 100644 index 0000000..e4ecbbc --- /dev/null +++ b/Campofinale/Game/Factory/Components/FComponentFormulaMan.cs @@ -0,0 +1,20 @@ +using Campofinale.Resource; +using static Campofinale.Game.Factory.FactoryNode; + +namespace Campofinale.Game.Factory.Components +{ + public class FComponentFormulaMan : FComponent + { + public FComponentFormulaMan(uint id) : base(id, FCComponentType.FormulaMan) + { + } + + public override void SetComponentInfo(ScdFacCom proto) + { + proto.FormulaMan = new() + { + + }; + } + } +} diff --git a/Campofinale/Game/Factory/Components/FComponentPortManager.cs b/Campofinale/Game/Factory/Components/FComponentPortManager.cs index 43e473d..615605b 100644 --- a/Campofinale/Game/Factory/Components/FComponentPortManager.cs +++ b/Campofinale/Game/Factory/Components/FComponentPortManager.cs @@ -35,7 +35,18 @@ namespace Campofinale.Game.Factory.Components }); } } - + public FComponentPortManager(uint id, int size) : base(id, FCComponentType.PortManager) + { + for (int i = 0; i < size; i++) + { + ports.Add(new FPort() + { + index = i, + ownerComId = 0, + touchComId = 0 + }); + } + } public override void SetComponentInfo(ScdFacCom proto) { proto.PortManager = new(); diff --git a/Campofinale/Game/Factory/Components/FComponentProducer.cs b/Campofinale/Game/Factory/Components/FComponentProducer.cs new file mode 100644 index 0000000..d8ac236 --- /dev/null +++ b/Campofinale/Game/Factory/Components/FComponentProducer.cs @@ -0,0 +1,20 @@ +using Campofinale.Resource; +using static Campofinale.Game.Factory.FactoryNode; + +namespace Campofinale.Game.Factory.Components +{ + public class FComponentProducer : FComponent + { + public FComponentProducer(uint id) : base(id, FCComponentType.Producer) + { + } + + public override void SetComponentInfo(ScdFacCom proto) + { + proto.Producer = new() + { + + }; + } + } +} diff --git a/Campofinale/Game/Factory/FactoryManager.cs b/Campofinale/Game/Factory/FactoryManager.cs index d62ae5d..d9fe989 100644 --- a/Campofinale/Game/Factory/FactoryManager.cs +++ b/Campofinale/Game/Factory/FactoryManager.cs @@ -721,6 +721,19 @@ namespace Campofinale.Game.Factory case FCNodeType.PowerDiffuser: components.Add(new FComponentPowerPole(chapter.nextCompV()).Init()); break; + case FCNodeType.Battle: + components.Add(new FComponentBattle(chapter.nextCompV()).Init()); + break; + case FCNodeType.Producer: + + components.Add(new FComponentPortManager(chapter.nextCompV(), 3).Init()); + components.Add(new FComponentPortManager(chapter.nextCompV(), 3).Init()); + components.Add(new FComponentProducer(chapter.nextCompV()).Init()); + components.Add(new FComponentFormulaMan(chapter.nextCompV()).Init()); + components.Add(new FComponentCache(chapter.nextCompV()).Init()); + components.Add(new FComponentCache(chapter.nextCompV()).Init()); + components.Add(new FComponentCache(chapter.nextCompV()).Init()); + break; case FCNodeType.TravelPole: components.Add(new FComponentTravelPole(chapter.nextCompV()).Init()); break; @@ -783,12 +796,16 @@ namespace Campofinale.Game.Factory } else { - EntityInteractive e = new(interactiveFacWrapperTable[templateId].interactiveTemplateId, player.roleId, worldPosition, direction, sceneNumId, guid); - e.InitDefaultProperties(); - e.SetPropValue(nodeId, "factory_inst_id"); + if (interactiveFacWrapperTable.ContainsKey(templateId)) + { + EntityInteractive e = new(interactiveFacWrapperTable[templateId].interactiveTemplateId, player.roleId, worldPosition, direction, sceneNumId, guid); + e.InitDefaultProperties(); + e.SetPropValue(nodeId, "factory_inst_id"); - player.sceneManager.GetCurScene().entities.Add(e); - player.sceneManager.GetCurScene().SpawnEntity(e); + player.sceneManager.GetCurScene().entities.Add(e); + player.sceneManager.GetCurScene().SpawnEntity(e); + } + } } @@ -829,6 +846,14 @@ namespace Campofinale.Game.Factory { case FCComponentType.PowerPole: return FCComponentPos.PowerPole; + case FCComponentType.TravelPole: + return FCComponentPos.TravelPole; + case FCComponentType.Battle: + return FCComponentPos.Battle1; + case FCComponentType.Producer: + return FCComponentPos.Producer; + case FCComponentType.FormulaMan: + return FCComponentPos.FormulaMan; } return FCComponentPos.Invalid; }