This commit is contained in:
Pal
2026-01-12 22:06:57 -08:00
5 changed files with 264 additions and 213 deletions

View File

@@ -46,6 +46,8 @@ public interface IPlayer : IKillable, ICharacterBody3D
public void PlayTestAnimation();
public void SetHealthTimerStatus(bool isActive);
public event Action PlayerDied;
public delegate InventoryItem RerollItem(InventoryItem item);

View File

@@ -7,8 +7,11 @@
</PropertyGroup>
<ItemGroup>
<Compile Remove="Actions\**" />
<Compile Remove="Game\state\states\**" />
<EmbeddedResource Remove="Actions\**" />
<EmbeddedResource Remove="Game\state\states\**" />
<None Remove="Actions\**" />
<None Remove="Game\state\states\**" />
</ItemGroup>
@@ -28,8 +31,4 @@
<ProjectReference Include="..\Zennysoft.Game.Godot.Implementation\Zennysoft.Game.Implementation.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Actions\" />
</ItemGroup>
</Project>

View File

@@ -12,24 +12,62 @@ public partial class Overworld : Node3D, IDungeonFloor
[Dependency] protected IGame Game => this.DependOn<IGame>();
[Dependency] protected IPlayer Player => this.DependOn<IPlayer>();
[Node] public Marker3D PlayerSpawnPoint { get; set; } = default!;
[Node] private Area3D Exit { get; set; } = default!;
[Node] private RescuedItems RescuedItems { get; set; } = default!;
[Node] private Area3D RestoreArea { get; set; } = default!;
public ImmutableList<IDungeonRoom> Rooms => [];
public bool FloorIsLoaded { get; set; }
private Timer RestoreTimer { get; set; }
public void InitializeDungeon()
{
Show();
Exit.AreaEntered += Exit_AreaEntered;
RescuedItems.SpawnRescuedItems();
RestoreArea.AreaEntered += RestoreArea_AreaEntered;
RestoreArea.AreaExited += RestoreArea_AreaExited;
RestoreTimer = new Timer();
RestoreTimer.WaitTime = 0.3f;
RestoreTimer.Timeout += RestoreTimer_Timeout;
AddChild(RestoreTimer);
FloorIsLoaded = true;
}
private void RestoreTimer_Timeout()
{
if (!Player.HealthComponent.AtFullHealth)
Player.HealthComponent.Heal(1);
if (!Player.VTComponent.AtFullVT)
Player.VTComponent.Restore(1);
}
private void RestoreArea_AreaExited(Area3D area)
{
if (area.GetOwner() is IPlayer)
{
RestoreTimer.Stop();
Player.SetHealthTimerStatus(true);
}
}
private void RestoreArea_AreaEntered(Area3D area)
{
if (area.GetOwner() is IPlayer)
{
RestoreTimer.Start();
Player.SetHealthTimerStatus(false);
}
}
private void Exit_AreaEntered(Area3D area)
{
if (area.GetOwner() is IPlayer)

View File

@@ -1,10 +1,10 @@
[gd_scene load_steps=522 format=4 uid="uid://dvnc26rebk6o0"]
[gd_scene load_steps=523 format=4 uid="uid://dvnc26rebk6o0"]
[ext_resource type="Script" uid="uid://cuhfkyh3d7noa" path="res://src/map/dungeon/code/Overworld.cs" id="1_5hmt3"]
[ext_resource type="Texture2D" uid="uid://co6h8vyi11sl2" path="res://src/map/overworld/Models/Overworld_CLOUD_RINGS_INNER_63.png" id="2_g6b7b"]
[ext_resource type="AudioStream" uid="uid://ym4ur8a2qxhp" path="res://src/audio/amb/amb_perlin.wav" id="2_wbbo3"]
[ext_resource type="AudioStream" uid="uid://b7wxddjx3qw5o" path="res://src/audio/amb/amb_white_noise.wav" id="3_c2gp5"]
[ext_resource type="AudioStream" uid="uid://ddii3pi8x75xc" path="res://src/audio/amb/amb_beach.wav" id="3_pvi8n"]
[ext_resource type="AudioStream" uid="uid://dqmsaok6fyhe7" path="res://src/audio/amb/amb_perlin.wav" id="2_wbbo3"]
[ext_resource type="AudioStream" uid="uid://dl07vg00se7hd" path="res://src/audio/amb/amb_white_noise.wav" id="3_c2gp5"]
[ext_resource type="AudioStream" uid="uid://boypvgaweep8a" path="res://src/audio/amb/amb_beach.wav" id="3_pvi8n"]
[ext_resource type="Texture2D" uid="uid://w33fr6exryiy" path="res://src/map/overworld/Models/Overworld_CLOUD_RINGS_INNER_37.png" id="3_uyygh"]
[ext_resource type="Texture2D" uid="uid://dv10yaqvp3mub" path="res://src/map/overworld/Models/Overworld_CLOUD_RINGS_INNER_71.png" id="4_r8r3k"]
[ext_resource type="Shader" uid="uid://brhf7s3riyag5" path="res://src/map/map shaders/Metal.gdshader" id="5_d1qcb"]
@@ -10008,6 +10008,9 @@ shadow_mesh = SubResource("ArrayMesh_2djfl")
[sub_resource type="BoxShape3D" id="BoxShape3D_b53dq"]
size = Vector3(32.7888, 2.34912, 7.88136)
[sub_resource type="CylinderShape3D" id="CylinderShape3D_yksd7"]
radius = 6.19775
[node name="Overworld" type="Node3D"]
script = ExtResource("1_5hmt3")
@@ -10728,5 +10731,14 @@ collision_mask = 256
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.28978, -2.1779, 7.74164)
shape = SubResource("BoxShape3D_b53dq")
[node name="RestoreArea" type="Area3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -293.713, 3.30221, 45.5386)
collision_layer = 256
collision_mask = 256
[node name="CollisionShape3D" type="CollisionShape3D" parent="RestoreArea"]
shape = SubResource("CylinderShape3D_yksd7")
[editable path="Node3D/Actors/Clalo"]
[editable path="Node3D/Actors/Caretaker of Saints"]

View File

@@ -102,7 +102,7 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
private float _healthTimerWaitTime = 3.0f;
private bool reduceOnTick = true;
private bool _healthTimerActive = true;
private float _knockbackStrength = 0.0f;
private Vector3 _knockbackDirection = Vector3.Zero;
@@ -193,7 +193,7 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
public void LookUp() => CameraAnimations.Play("look_up");
private void SetHealthTimerStatus(bool isActive)
public void SetHealthTimerStatus(bool isActive)
{
if (isActive)
HealthTimer.Start();
@@ -374,11 +374,11 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
if (VTComponent.CurrentVT.Value > 0)
{
if (((Accessory)EquipmentComponent.EquippedAccessory.Value).AccessoryTag == AccessoryTag.HalfVTConsumption)
reduceOnTick = !reduceOnTick;
_healthTimerActive = !_healthTimerActive;
HealthComponent.Heal(1);
if (reduceOnTick)
if (_healthTimerActive)
VTComponent.Reduce(1);
}
else