Improvements to save and loading
Improvements to Chinthe animation logic Fix broken Godot Tool system and just use a more manual approach to setting map nodes Remove ItemDatabase from individual room scenes
This commit is contained in:
@@ -10,7 +10,7 @@ using Zennysoft.Ma.Adapter.Entity;
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class Player : CharacterBody3D, IPlayer, IProvide<ISaveChunk<PlayerData>>
|
||||
public partial class Player : CharacterBody3D, IPlayer
|
||||
{
|
||||
#region Dependency Injection
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
@@ -20,10 +20,6 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<ISaveChunk<Play
|
||||
[Dependency] private IGameRepo _gameRepo => this.DependOn<IGameRepo>(() => new GameRepo());
|
||||
#endregion
|
||||
|
||||
#region Save
|
||||
public ISaveChunk<PlayerData> PlayerChunk { get; set; } = default!;
|
||||
#endregion
|
||||
|
||||
public IHealthComponent HealthComponent { get; private set; }
|
||||
|
||||
public IVTComponent VTComponent { get; private set; }
|
||||
@@ -52,11 +48,6 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<ISaveChunk<Play
|
||||
#region Dependencies
|
||||
[Dependency]
|
||||
public IGame Game => this.DependOn<IGame>();
|
||||
|
||||
[Dependency]
|
||||
public ISaveChunk<GameData> GameChunk => this.DependOn<ISaveChunk<GameData>>();
|
||||
|
||||
ISaveChunk<PlayerData> IProvide<ISaveChunk<PlayerData>>.Value() => PlayerChunk;
|
||||
#endregion
|
||||
|
||||
#region Exports
|
||||
@@ -136,19 +127,6 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<ISaveChunk<Play
|
||||
{
|
||||
Settings = new PlayerLogic.Settings() { RotationSpeed = RotationSpeed, MoveSpeed = MoveSpeed, Acceleration = Acceleration };
|
||||
|
||||
PlayerChunk = new SaveChunk<PlayerData>(
|
||||
onSave: (chunk) => new PlayerData()
|
||||
{
|
||||
Inventory = (Inventory)Inventory,
|
||||
HealthComponent = (HealthComponent)HealthComponent
|
||||
},
|
||||
onLoad: (chunk, data) =>
|
||||
{
|
||||
Inventory = data.Inventory;
|
||||
HealthComponent = data.HealthComponent;
|
||||
}
|
||||
);
|
||||
|
||||
PlayerBinding = PlayerLogic.Bind();
|
||||
|
||||
PlayerBinding
|
||||
@@ -160,8 +138,6 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<ISaveChunk<Play
|
||||
Move(output.delta);
|
||||
});
|
||||
|
||||
GameChunk.AddChunk(PlayerChunk);
|
||||
|
||||
PlayerLogic.Start();
|
||||
this.Provide();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user