Modularized doors and lightbridges

This commit is contained in:
Marco 2025-03-03 17:55:53 +01:00
commit 1a5bd1b6d8
27 changed files with 513 additions and 346 deletions

View file

@ -15,6 +15,8 @@ public partial class PlayerDamageReceiver : Area2D
private ActorResourceProvider _healthProvider;
[Export]
private ActorResourceProvider _shieldProvider;
[Export] public StringName AcidGroupName { get; private set; } = "Acid";
[Signal]
public delegate void HealthChangedEventHandler(float newValue, float maxValue);
@ -88,10 +90,23 @@ public partial class PlayerDamageReceiver : Area2D
{
if (!Enabled) return;
if (Invulnerable) return;
if (area.IsInGroup(AcidGroupName))
{
// Handle acid death
AcidDeath();
return;
}
if (area is not Bullet bullet || bullet.BulletOwner == BulletGroup) return;
this.Hit(bullet.Damage, bullet.DamageType);
bullet.RequestCollisionDestruction();
}
private void AcidDeath()
{
if (!Enabled) return;
GD.Print("Acid death");
_healthProvider.CurrentResource = 0;
}
public void Hit(float damage, DamageType type = DamageType.Neutral)
{