some factory components (not finished)

This commit is contained in:
AlessandroCH 2025-08-07 01:45:49 +02:00
parent f9af58687c
commit 99a7aceee2
6 changed files with 126 additions and 6 deletions

View File

@ -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
};
}
}
}

View File

@ -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()
{
};
}
}
}

View File

@ -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()
{
};
}
}
}

View File

@ -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) public override void SetComponentInfo(ScdFacCom proto)
{ {
proto.PortManager = new(); proto.PortManager = new();

View File

@ -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()
{
};
}
}
}

View File

@ -721,6 +721,19 @@ namespace Campofinale.Game.Factory
case FCNodeType.PowerDiffuser: case FCNodeType.PowerDiffuser:
components.Add(new FComponentPowerPole(chapter.nextCompV()).Init()); components.Add(new FComponentPowerPole(chapter.nextCompV()).Init());
break; 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: case FCNodeType.TravelPole:
components.Add(new FComponentTravelPole(chapter.nextCompV()).Init()); components.Add(new FComponentTravelPole(chapter.nextCompV()).Init());
break; break;
@ -782,6 +795,8 @@ namespace Campofinale.Game.Factory
player.Send(ScMsgId.ScMoveObjectMove, move); player.Send(ScMsgId.ScMoveObjectMove, move);
} }
else else
{
if (interactiveFacWrapperTable.ContainsKey(templateId))
{ {
EntityInteractive e = new(interactiveFacWrapperTable[templateId].interactiveTemplateId, player.roleId, worldPosition, direction, sceneNumId, guid); EntityInteractive e = new(interactiveFacWrapperTable[templateId].interactiveTemplateId, player.roleId, worldPosition, direction, sceneNumId, guid);
e.InitDefaultProperties(); e.InitDefaultProperties();
@ -793,6 +808,8 @@ namespace Campofinale.Game.Factory
} }
}
[BsonDiscriminator(Required = true)] [BsonDiscriminator(Required = true)]
[BsonKnownTypes(typeof(FComponentSelector))] [BsonKnownTypes(typeof(FComponentSelector))]
@ -829,6 +846,14 @@ namespace Campofinale.Game.Factory
{ {
case FCComponentType.PowerPole: case FCComponentType.PowerPole:
return FCComponentPos.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; return FCComponentPos.Invalid;
} }