Fix annoying issue with LookAt

Add jump scare
This commit is contained in:
2026-02-05 20:10:41 -08:00
parent c6fbc9f553
commit da8c4209d7
18 changed files with 197 additions and 273 deletions

View File

@@ -42,4 +42,36 @@ public partial class DungeonFloorNode : FloorNode
public float ShieldOfHeaven { get; set; }
[Export]
public float GoldSproingy { get; set; }
[ExportGroup("True Route Spawn Rates")]
[Export]
public float TrueSproingy { get; set; }
[Export]
public float TrueMichael { get; set; }
[Export]
public float TrueFilthEater { get; set; }
[Export]
public float TrueSara { get; set; }
[Export]
public float TrueBallos { get; set; }
[Export]
public float TrueChariot { get; set; }
[Export]
public float TrueChinthe { get; set; }
[Export]
public float TrueGreenAmbassador { get; set; }
[Export]
public float TrueRedAmbassador { get; set; }
[Export]
public float TrueSteelAmbassador { get; set; }
[Export]
public float TrueAgniDemon { get; set; }
[Export]
public float TrueAqueosDemon { get; set; }
[Export]
public float TruePalan { get; set; }
[Export]
public float TrueShieldOfHeaven { get; set; }
[Export]
public float TrueGoldSproingy { get; set; }
}

View File

@@ -87,141 +87,50 @@ FloorName = 1
script = ExtResource("2_00xd7")
FolderName = "Floor01"
FloorOdds = Array[float]([0.33, 0.33, 0.33])
Sproingy = null
Michael = 1.0
FilthEater = null
Sara = null
Ballos = null
Chariot = null
Chinthe = null
GreenAmbassador = null
RedAmbassador = null
SteelAmbassador = null
AgniDemon = null
AqueosDemon = null
Palan = null
ShieldOfHeaven = null
GoldSproingy = null
Sproingy = 0.5
Michael = 0.5
[node name="Floor02" type="Node" parent="MapOrder"]
script = ExtResource("2_00xd7")
FolderName = "Floor02"
FloorOdds = Array[float]([0.5, 0.5])
Sproingy = 1.0
Michael = null
FilthEater = null
Sara = null
Ballos = null
Chariot = null
Chinthe = null
GreenAmbassador = null
RedAmbassador = null
SteelAmbassador = null
AgniDemon = null
AqueosDemon = null
Palan = null
ShieldOfHeaven = null
GoldSproingy = null
Sproingy = 0.5
Michael = 0.5
GoldSproingy = 0.05
TrueRedAmbassador = 0.3
[node name="Floor03" type="Node" parent="MapOrder"]
script = ExtResource("2_00xd7")
FolderName = "Floor03"
FloorOdds = Array[float]([1.0])
Sproingy = 1.0
Michael = null
FilthEater = null
Sara = null
Ballos = null
Chariot = null
Chinthe = null
GreenAmbassador = null
RedAmbassador = null
SteelAmbassador = null
AgniDemon = null
AqueosDemon = null
Palan = null
ShieldOfHeaven = null
GoldSproingy = null
Sproingy = 0.25
Michael = 0.5
FilthEater = 0.5
TrueRedAmbassador = 0.3
[node name="Floor04" type="Node" parent="MapOrder"]
script = ExtResource("2_00xd7")
FolderName = "Floor04"
FloorOdds = Array[float]([1.0])
Sproingy = 1.0
Michael = null
FilthEater = null
Sara = null
Ballos = null
Chariot = null
Chinthe = null
GreenAmbassador = null
RedAmbassador = null
SteelAmbassador = null
AgniDemon = null
AqueosDemon = null
Palan = null
ShieldOfHeaven = null
GoldSproingy = null
[node name="Floor05" type="Node" parent="MapOrder"]
script = ExtResource("2_00xd7")
FolderName = "Floor05"
FloorOdds = Array[float]([1.0])
Sproingy = 1.0
Michael = null
FilthEater = null
Sara = null
Ballos = null
Chariot = null
Chinthe = null
GreenAmbassador = null
RedAmbassador = null
SteelAmbassador = null
AgniDemon = null
AqueosDemon = null
Palan = null
ShieldOfHeaven = null
GoldSproingy = null
[node name="Floor06" type="Node" parent="MapOrder"]
script = ExtResource("2_00xd7")
FolderName = "Floor06"
FloorOdds = Array[float]([0.2, 0.8, 0.5, 0.1])
Sproingy = 1.0
Michael = null
FilthEater = null
Sara = null
Ballos = null
Chariot = null
Chinthe = null
GreenAmbassador = null
RedAmbassador = null
SteelAmbassador = null
AgniDemon = null
AqueosDemon = null
Palan = null
ShieldOfHeaven = null
GoldSproingy = null
[node name="Floor07" type="Node" parent="MapOrder"]
script = ExtResource("2_00xd7")
FolderName = "Floor07"
FloorOdds = Array[float]([1.0])
Sproingy = 1.0
Michael = null
FilthEater = null
Sara = null
Ballos = null
Chariot = null
Chinthe = null
GreenAmbassador = null
RedAmbassador = null
SteelAmbassador = null
AgniDemon = null
AqueosDemon = null
Palan = null
ShieldOfHeaven = null
GoldSproingy = null
[node name="Boss Floor 1" type="Node" parent="MapOrder"]
script = ExtResource("3_v14r0")
@@ -232,120 +141,36 @@ script = ExtResource("2_00xd7")
FolderName = "Floor09"
FloorOdds = Array[float]([1.0])
Sproingy = 1.0
Michael = null
FilthEater = null
Sara = null
Ballos = null
Chariot = null
Chinthe = null
GreenAmbassador = null
RedAmbassador = null
SteelAmbassador = null
AgniDemon = null
AqueosDemon = null
Palan = null
ShieldOfHeaven = null
GoldSproingy = null
[node name="Floor11" type="Node" parent="MapOrder"]
script = ExtResource("2_00xd7")
FolderName = "Floor11"
FloorOdds = Array[float]([1.0])
Sproingy = 1.0
Michael = null
FilthEater = null
Sara = null
Ballos = null
Chariot = null
Chinthe = null
GreenAmbassador = null
RedAmbassador = null
SteelAmbassador = null
AgniDemon = null
AqueosDemon = null
Palan = null
ShieldOfHeaven = null
GoldSproingy = null
[node name="Floor12" type="Node" parent="MapOrder"]
script = ExtResource("2_00xd7")
FolderName = "Floor12"
FloorOdds = Array[float]([1.0])
Sproingy = 1.0
Michael = null
FilthEater = null
Sara = null
Ballos = null
Chariot = null
Chinthe = null
GreenAmbassador = null
RedAmbassador = null
SteelAmbassador = null
AgniDemon = null
AqueosDemon = null
Palan = null
ShieldOfHeaven = null
GoldSproingy = null
[node name="Floor13" type="Node" parent="MapOrder"]
script = ExtResource("2_00xd7")
FolderName = "Floor13"
FloorOdds = Array[float]([1.0])
Sproingy = 1.0
Michael = null
FilthEater = null
Sara = null
Ballos = null
Chariot = null
Chinthe = null
GreenAmbassador = null
RedAmbassador = null
SteelAmbassador = null
AgniDemon = null
AqueosDemon = null
Palan = null
ShieldOfHeaven = null
GoldSproingy = null
[node name="Floor14" type="Node" parent="MapOrder"]
script = ExtResource("2_00xd7")
FolderName = "Floor14"
FloorOdds = Array[float]([1.0])
Sproingy = 1.0
Michael = null
FilthEater = null
Sara = null
Ballos = null
Chariot = null
Chinthe = null
GreenAmbassador = null
RedAmbassador = null
SteelAmbassador = null
AgniDemon = null
AqueosDemon = null
Palan = null
ShieldOfHeaven = null
GoldSproingy = null
[node name="Floor15" type="Node" parent="MapOrder"]
script = ExtResource("2_00xd7")
FolderName = "Floor15"
FloorOdds = Array[float]([1.0])
Sproingy = 1.0
Michael = null
FilthEater = null
Sara = null
Ballos = null
Chariot = null
Chinthe = null
GreenAmbassador = null
RedAmbassador = null
SteelAmbassador = null
AgniDemon = null
AqueosDemon = null
Palan = null
ShieldOfHeaven = null
GoldSproingy = null
[node name="Boss Floor 2" type="Node" parent="MapOrder"]
script = ExtResource("3_v14r0")

View File

@@ -28,47 +28,47 @@ public abstract partial class DungeonRoom : Node3D, IDungeonRoom
public void Setup()
{
_enemiesInRoom = [];
if (_room != null)
{
_room.BodyEntered += Room_BodyEntered;
_room.BodyExited += Room_BodyExited;
}
_enemiesInRoom = [];
if (_room != null)
{
_room.BodyEntered += Room_BodyEntered;
_room.BodyExited += Room_BodyExited;
}
}
private void Room_BodyExited(Node3D body)
{
if (body is IEnemy enemy)
_enemiesInRoom = _enemiesInRoom.Remove(enemy);
if (body is IPlayer)
_isPlayerInRoom = false;
if (body is IEnemy enemy)
_enemiesInRoom = _enemiesInRoom.Remove(enemy);
if (body is IPlayer)
_isPlayerInRoom = false;
}
private void Room_BodyEntered(Node3D body)
{
if (body is IEnemy enemy)
_enemiesInRoom = _enemiesInRoom.Add(enemy);
if (body is IPlayer)
if (_playerDiscoveredRoom)
_isPlayerInRoom = true;
else
OnPlayerDiscoveringRoom();
if (body is IEnemy enemy)
_enemiesInRoom = _enemiesInRoom.Add(enemy);
if (body is IPlayer)
if (_playerDiscoveredRoom)
_isPlayerInRoom = true;
else
OnPlayerDiscoveringRoom();
}
public ImmutableList<IEnemy> GetEnemiesInCurrentRoom()
{
return _enemiesInRoom;
return _enemiesInRoom;
}
private void OnPlayerDiscoveringRoom()
{
_isPlayerInRoom = true;
_playerDiscoveredRoom = true;
MinimapShadow.Hide();
_isPlayerInRoom = true;
_playerDiscoveredRoom = true;
MinimapShadow.Hide();
}
public void OnExitTree()
{
_room.BodyEntered -= Room_BodyEntered;
_room.BodyExited -= Room_BodyExited;
_room.BodyEntered -= Room_BodyEntered;
_room.BodyExited -= Room_BodyExited;
}
}
}

View File

@@ -0,0 +1,31 @@
using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using Godot;
using Zennysoft.Ma.Adapter;
namespace Zennysoft.Game.Ma;
[Meta(typeof(IAutoNode))]
public partial class JumpScareRoom : DungeonRoom
{
public override void _Notification(int what) => this.Notify(what);
[Dependency]
public IPlayer Player => this.DependOn<IPlayer>();
[Node] public Area3D JumpScare { get; set; }
[Export] public Resource Dialogue { get; set; } = default!;
public void OnResolved()
{
JumpScare.AreaEntered += JumpScare_AreaEntered;
}
private void JumpScare_AreaEntered(Area3D area)
{
Player.PlayJumpScareAnimation();
DialogueController.ShowDialogue(Dialogue, "general");
JumpScare.SetMonitoring(false);
}
}

View File

@@ -0,0 +1 @@
uid://cwqgealqc3w4

View File

@@ -19,57 +19,54 @@ public partial class MonsterRoom : DungeonRoom
public override void _Ready()
{
SpawnItems();
SpawnItems();
}
public void SpawnEnemies(Godot.Collections.Dictionary<EnemyType, float> enemyInfo)
{
if (enemyInfo == null || !enemyInfo.Any(x => x.Value > 0))
return;
if (enemyInfo == null || !enemyInfo.Any(x => x.Value > 0))
return;
var rng = new RandomNumberGenerator();
rng.Randomize();
var enemySpawnPoints = EnemySpawnPoints.GetChildren();
var numberOfEnemiesToSpawn = rng.RandiRange(1, enemySpawnPoints.Count);
var rng = new RandomNumberGenerator();
rng.Randomize();
var enemySpawnPoints = EnemySpawnPoints.GetChildren();
var numberOfEnemiesToSpawn = rng.RandiRange(1, enemySpawnPoints.Count);
foreach (var spawnPoint in enemySpawnPoints.Cast<Marker3D>())
{
if (numberOfEnemiesToSpawn <= 0)
break;
numberOfEnemiesToSpawn--;
foreach (var spawnPoint in enemySpawnPoints.Cast<Marker3D>())
{
if (numberOfEnemiesToSpawn <= 0)
break;
numberOfEnemiesToSpawn--;
var index = rng.RandWeighted([.. enemyInfo.Values]);
var selectedEnemy = enemyInfo.ElementAt((int)index);
var instantiatedEnemy = EnemyTypeToEnemyConverter.Convert(selectedEnemy.Key);
instantiatedEnemy.Position = new Vector3(spawnPoint.Position.X, 0f, spawnPoint.Position.Z);
AddChild(instantiatedEnemy);
}
var index = rng.RandWeighted([.. enemyInfo.Values]);
var selectedEnemy = enemyInfo.ElementAt((int)index);
var instantiatedEnemy = EnemyTypeToEnemyConverter.Convert(selectedEnemy.Key);
instantiatedEnemy.Position = new Vector3(spawnPoint.Position.X, 0f, spawnPoint.Position.Z);
AddChild(instantiatedEnemy);
}
}
// RegularFlame.GetChildren();
//
private void SpawnItems()
{
if (ItemSpawnPoints == null)
return;
if (ItemSpawnPoints == null)
return;
var itemSpawnPoints = ItemSpawnPoints.GetChildren();
var rng = new RandomNumberGenerator();
rng.Randomize();
var numberOfItemsToSpawn = rng.RandiRange(1, itemSpawnPoints.Count);
itemSpawnPoints.Shuffle();
var database = ItemDatabase.Instance;
foreach (var spawnPoint in itemSpawnPoints.Cast<Marker3D>())
{
if (numberOfItemsToSpawn <= 0)
break;
numberOfItemsToSpawn--;
var itemSpawnPoints = ItemSpawnPoints.GetChildren();
var rng = new RandomNumberGenerator();
rng.Randomize();
var numberOfItemsToSpawn = rng.RandiRange(1, itemSpawnPoints.Count);
itemSpawnPoints.Shuffle();
var database = ItemDatabase.Instance;
foreach (var spawnPoint in itemSpawnPoints.Cast<Marker3D>())
{
if (numberOfItemsToSpawn <= 0)
break;
numberOfItemsToSpawn--;
var selectedItem = database.PickItem<InventoryItem>();
var duplicated = selectedItem.Duplicate((int)DuplicateFlags.UseInstantiation) as Node3D;
duplicated.Position = new Vector3(spawnPoint.Position.X, 0, spawnPoint.Position.Z);
AddChild(duplicated);
}
var selectedItem = database.PickItem<InventoryItem>();
var duplicated = selectedItem.Duplicate((int)DuplicateFlags.UseInstantiation) as Node3D;
duplicated.Position = new Vector3(spawnPoint.Position.X, 0, spawnPoint.Position.Z);
AddChild(duplicated);
}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,7 @@
[gd_scene load_steps=17 format=3 uid="uid://dhkbvos11tkdw"]
[gd_scene load_steps=19 format=3 uid="uid://dhkbvos11tkdw"]
[ext_resource type="Script" uid="uid://bccyfmj8ikewh" path="res://src/map/dungeon/code/SpecialRoom.cs" id="1_5m2h2"]
[ext_resource type="Script" uid="uid://cwqgealqc3w4" path="res://src/map/dungeon/code/JumpScareRoom.cs" id="1_unlia"]
[ext_resource type="Resource" uid="uid://iapl7k07fwt0" path="res://src/npc/Proscenium/JumpScare.dialogue" id="2_fgt65"]
[ext_resource type="PackedScene" uid="uid://bc7ubbvnx0jdo" path="res://src/map/dungeon/models/Area 1/Jumpscare/A1-Jumpscare.glb" id="2_umqhi"]
[ext_resource type="Texture2D" uid="uid://dw50ys561j8no" path="res://src/map/assets/DUST_1.png" id="5_5m2h2"]
@@ -31,6 +32,9 @@ albedo_color = Color(0, 0, 0, 1)
material = SubResource("StandardMaterial3D_unlia")
size = Vector2(20.5, 19)
[sub_resource type="BoxShape3D" id="BoxShape3D_unlia"]
size = Vector3(6.43689, 5.99969, 4.5957)
[sub_resource type="Curve" id="Curve_umqhi"]
_limits = [-2.0, 2.0, 0.0, 1.0]
_data = [Vector2(0.00358423, 0.230769), 0.0, 0.0, 0, 0, Vector2(0.982079, -1.03846), 0.0, 0.0, 0, 0]
@@ -68,7 +72,8 @@ subdivide_depth = 1
[node name="JumpScareRoom" type="Node3D"]
transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, -8.509, -3.41755, -8.60795)
script = ExtResource("1_5m2h2")
script = ExtResource("1_unlia")
Dialogue = ExtResource("2_fgt65")
[node name="Model" type="Node3D" parent="."]
@@ -129,6 +134,15 @@ layers = 2
sorting_offset = 100.0
mesh = SubResource("PlaneMesh_unlia")
[node name="JumpScare" type="Area3D" parent="Room"]
unique_name_in_owner = true
collision_layer = 0
collision_mask = 64
[node name="CollisionShape3D" type="CollisionShape3D" parent="Room/JumpScare"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.112, 4.54046, 4.67285)
shape = SubResource("BoxShape3D_unlia")
[node name="Lights" type="Node3D" parent="."]
[node name="OmniLight3D" type="OmniLight3D" parent="Lights"]