Activable spawners

This commit is contained in:
Marco 2025-09-22 18:19:40 +02:00
commit 467fb5be9d
10 changed files with 427 additions and 397 deletions

View file

@ -2175,7 +2175,7 @@
// entity 108 // entity 108
{ {
"classname" "marker_spawn_enemy" "classname" "marker_spawn_enemy"
"origin" "84 12 22" "origin" "164 56 22"
"resource_path" "res://Resources/Enemies/Fairy_Guard_3D.tres" "resource_path" "res://Resources/Enemies/Fairy_Guard_3D.tres"
} }
// entity 109 // entity 109
@ -2184,6 +2184,7 @@
"origin" "48 128 26" "origin" "48 128 26"
"resource_path" "res://Resources/Enemies/Fairy_Guard_3D.tres" "resource_path" "res://Resources/Enemies/Fairy_Guard_3D.tres"
"autospawn" "0" "autospawn" "0"
"targetname" "camera_1"
} }
// entity 110 // entity 110
{ {
@ -2204,12 +2205,12 @@
"activationtype" "Open" "activationtype" "Open"
// brush 0 // brush 0
{ {
( 32 -8 16 ) ( 32 -7 16 ) ( 32 -8 17 ) special/trigger [ 0 -1 0 0 ] [ 0 0 -1 0 ] 0 1 1 ( 32 -12 16 ) ( 32 -11 16 ) ( 32 -12 17 ) special/trigger [ 0 -1 0 -4 ] [ 0 0 -1 0 ] 90 1 1
( 32 -8 16 ) ( 32 -8 17 ) ( 33 -8 16 ) special/trigger [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1 ( 32 -12 16 ) ( 32 -12 17 ) ( 33 -12 16 ) special/trigger [ 1 0 0 0 ] [ 0 0 -1 0 ] 90 1 1
( 32 -8 16 ) ( 33 -8 16 ) ( 32 -7 16 ) special/trigger [ -1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1 ( 32 -12 16 ) ( 33 -12 16 ) ( 32 -11 16 ) special/trigger [ -1 0 0 0 ] [ 0 -1 0 -4 ] 90 1 1
( 96 32 28 ) ( 96 33 28 ) ( 97 32 28 ) special/trigger [ 1 0 0 0 ] [ 0 -1 0 0 ] 270 1 1 ( 96 28 28 ) ( 96 29 28 ) ( 97 28 28 ) special/trigger [ 1 0 0 0 ] [ 0 -1 0 -4 ] 0 1 1
( 96 32 20 ) ( 97 32 20 ) ( 96 32 21 ) special/trigger [ -1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1 ( 96 28 20 ) ( 97 28 20 ) ( 96 28 21 ) special/trigger [ -1 0 0 0 ] [ 0 0 -1 0 ] 90 1 1
( 96 32 20 ) ( 96 32 21 ) ( 96 33 20 ) special/trigger [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1 ( 96 28 20 ) ( 96 28 21 ) ( 96 29 20 ) special/trigger [ 0 1 0 4 ] [ 0 0 -1 0 ] 90 1 1
} }
} }
// entity 113 // entity 113
@ -2218,3 +2219,9 @@
"origin" "152 -56 32" "origin" "152 -56 32"
"angles" "0 90 0" "angles" "0 90 0"
} }
// entity 114
{
"classname" "marker_spawn_enemy"
"origin" "132 144 22"
"resource_path" "res://Resources/Enemies/Fairy_Guard_3D.tres"
}

View file

@ -1,7 +1,7 @@
[gd_resource type="Resource" script_class="FuncGodotFGDPointClass" load_steps=5 format=3 uid="uid://cd8kf5wey5n8n"] [gd_resource type="Resource" script_class="FuncGodotFGDPointClass" load_steps=5 format=3 uid="uid://cd8kf5wey5n8n"]
[ext_resource type="Resource" uid="uid://5bc1qysixhmh" path="res://3D/TrenchBroom/EntityDefinitions/base/actor_base.tres" id="1_yd0db"] [ext_resource type="Resource" uid="uid://5bc1qysixhmh" path="res://3D/TrenchBroom/EntityDefinitions/base/actor_base.tres" id="1_yd0db"]
[ext_resource type="Resource" uid="uid://kerywjgft7vh" path="res://3D/TrenchBroom/EntityDefinitions/base/target_base.tres" id="2_n1lol"] [ext_resource type="Resource" uid="uid://c1utxplehq2jl" path="res://3D/TrenchBroom/EntityDefinitions/base/targetname_base.tres" id="2_yd0db"]
[ext_resource type="Script" uid="uid://cxsqwtsqd8w33" path="res://addons/func_godot/src/fgd/func_godot_fgd_point_class.gd" id="3_rwtar"] [ext_resource type="Script" uid="uid://cxsqwtsqd8w33" path="res://addons/func_godot/src/fgd/func_godot_fgd_point_class.gd" id="3_rwtar"]
[ext_resource type="Script" uid="uid://00rbjdb4mnb0" path="res://Scripts/Actors/EnemyMarker3D.cs" id="4_7cqxf"] [ext_resource type="Script" uid="uid://00rbjdb4mnb0" path="res://Scripts/Actors/EnemyMarker3D.cs" id="4_7cqxf"]
@ -12,7 +12,7 @@ apply_rotation_on_map_build = false
apply_scale_on_map_build = false apply_scale_on_map_build = false
classname = "marker_spawn_enemy" classname = "marker_spawn_enemy"
description = "Enemy Spawn Marker" description = "Enemy Spawn Marker"
base_classes = Array[Resource]([ExtResource("1_yd0db"), ExtResource("2_n1lol")]) base_classes = Array[Resource]([ExtResource("1_yd0db"), ExtResource("2_yd0db")])
class_properties = { class_properties = {
"autospawn": true, "autospawn": true,
"resource_path": "" "resource_path": ""

File diff suppressed because one or more lines are too long

View file

@ -62,10 +62,10 @@ public partial class ForceField3D : AnimatableBody3D, IActivable
this.Activate(); this.Activate();
} }
public void _func_godot_apply_properties(Dictionary props) public void _func_godot_apply_properties(Dictionary<string, Variant> props)
{ {
TargetName = (string)props["targetname"]; TargetName = props["targetname"].AsStringName();
StartActive = (bool)props["startenabled"]; StartActive = props["startenabled"].AsBool();
} }
public override void _Ready() public override void _Ready()

View file

@ -53,6 +53,8 @@ public partial class EnemyMarker3D : PreviewMarker3D, IActivable
private EnemyProxy3D _spawnedEnemy; private EnemyProxy3D _spawnedEnemy;
[Export] public StringName TargetName { get; set; }
public void _func_godot_apply_properties(Dictionary<string, Variant> props) public void _func_godot_apply_properties(Dictionary<string, Variant> props)
{ {
//GroupName = (string)props["targetname"]; //GroupName = (string)props["targetname"];
@ -69,6 +71,8 @@ public partial class EnemyMarker3D : PreviewMarker3D, IActivable
GD.PushWarning($"Spawner {this.Name} has no enemy assigned"); GD.PushWarning($"Spawner {this.Name} has no enemy assigned");
} }
TargetName = props["targetname"].AsStringName();
Billboard = true; Billboard = true;
//MarkerId = props["id"].AsInt32(); //MarkerId = props["id"].AsInt32();
} }
@ -77,6 +81,11 @@ public partial class EnemyMarker3D : PreviewMarker3D, IActivable
{ {
base._Ready(); base._Ready();
if (!string.IsNullOrWhiteSpace(TargetName))
{
this.AddToGroup(TargetName);
}
if (AutoSpawn) if (AutoSpawn)
{ {
Spawn(false); Spawn(false);

View file

@ -42,6 +42,11 @@ public partial class ScriptableBulletsEmitter3D : Destructible3D, IActivable, IS
public override void _Ready() public override void _Ready()
{ {
if (Engine.IsEditorHint()) return; if (Engine.IsEditorHint()) return;
if (Script is null)
{
GD.PushWarning($"Emitter {Name} has no script assigned");
return;
}
//_scriptInstance = Script.Duplicate(true) as BulletScript; //_scriptInstance = Script.Duplicate(true) as BulletScript;
if (!string.IsNullOrWhiteSpace(ActivationGroup)) if (!string.IsNullOrWhiteSpace(ActivationGroup))

View file

@ -23,7 +23,7 @@ public partial class Idle : EnemyStateBase3D
// player detection // player detection
// damage receiver will be a module // damage receiver will be a module
GD.Print("Entered Idle"); //GD.Print("Entered Idle");
_ = DelayStart(); _ = DelayStart();
} }

View file

@ -29,7 +29,7 @@ public partial class Idle : EnemyStateBase3D
// player detection // player detection
// damage receiver will be a module // damage receiver will be a module
GD.Print("Entered Idle"); //GD.Print("Entered Idle");
} }
public override void ExitState() public override void ExitState()
@ -60,7 +60,7 @@ public partial class Idle : EnemyStateBase3D
private void PlayerDetectionOnPlayerInRange() private void PlayerDetectionOnPlayerInRange()
{ {
_isPlayerInRange = true; _isPlayerInRange = true;
GD.Print("Player In Range"); //GD.Print("Player In Range");
} }
private void PlayerDetectionOnPlayerOutOfRange() private void PlayerDetectionOnPlayerOutOfRange()

View file

@ -27,7 +27,7 @@ public partial class Shooting : EnemyStateBase3D
{ {
base.EnterState(); base.EnterState();
GD.Print("Entering Shooting"); //GD.Print("Entering Shooting");
PlayerDetection.PlayerOutOfRange += PlayerDetectionOnPlayerOutOfRange; PlayerDetection.PlayerOutOfRange += PlayerDetectionOnPlayerOutOfRange;

View file

@ -78,7 +78,7 @@ public partial class Idle : EnemyStateBase
private void PlayerDetectionOnPlayerInRange() private void PlayerDetectionOnPlayerInRange()
{ {
_isPlayerInRange = true; _isPlayerInRange = true;
GD.Print("Player In Range"); //GD.Print("Player In Range");
} }
public override void PhysicsProcessState(double delta) public override void PhysicsProcessState(double delta)