mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:15:45 +00:00
Spawn markers in editor
This commit is contained in:
parent
82f4c75ad7
commit
479df3c7c4
8 changed files with 150 additions and 76 deletions
|
|
@ -0,0 +1,29 @@
|
||||||
|
[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://kerywjgft7vh" path="res://3D/TrenchBroom/EntityDefinitions/base/target_base.tres" id="2_n1lol"]
|
||||||
|
[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"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("3_rwtar")
|
||||||
|
script_class = ExtResource("4_7cqxf")
|
||||||
|
apply_rotation_on_map_build = false
|
||||||
|
apply_scale_on_map_build = false
|
||||||
|
classname = "marker_spawn_enemy"
|
||||||
|
description = "Enemy Spawn Marker"
|
||||||
|
base_classes = Array[Resource]([ExtResource("1_yd0db"), ExtResource("2_n1lol")])
|
||||||
|
class_properties = {
|
||||||
|
"autospawn": true,
|
||||||
|
"resource_path": ""
|
||||||
|
}
|
||||||
|
class_property_descriptions = {
|
||||||
|
"autospawn": "Whether to spawn automatically or not",
|
||||||
|
"resource_path": "Path to the enemy resource"
|
||||||
|
}
|
||||||
|
meta_properties = {
|
||||||
|
"color": Color(0.9229911, 0.41614023, 0.21117541, 1),
|
||||||
|
"size": AABB(-4, -4, -6, 4, 4, 6)
|
||||||
|
}
|
||||||
|
node_class = "Marker3D"
|
||||||
|
metadata/_custom_type_script = "uid://cxsqwtsqd8w33"
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
[gd_resource type="Resource" script_class="FuncGodotFGDPointClass" load_steps=5 format=3 uid="uid://cp6w7rgfgtxlk"]
|
||||||
|
|
||||||
|
[ext_resource type="Resource" uid="uid://5bc1qysixhmh" path="res://3D/TrenchBroom/EntityDefinitions/base/actor_base.tres" id="1_4w7c8"]
|
||||||
|
[ext_resource type="Resource" uid="uid://kerywjgft7vh" path="res://3D/TrenchBroom/EntityDefinitions/base/target_base.tres" id="2_4yeye"]
|
||||||
|
[ext_resource type="Script" uid="uid://cxsqwtsqd8w33" path="res://addons/func_godot/src/fgd/func_godot_fgd_point_class.gd" id="2_8rpcj"]
|
||||||
|
[ext_resource type="Script" uid="uid://00rbjdb4mnb0" path="res://Scripts/Actors/EnemyMarker3D.cs" id="3_4yeye"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("2_8rpcj")
|
||||||
|
script_class = ExtResource("3_4yeye")
|
||||||
|
apply_rotation_on_map_build = false
|
||||||
|
apply_scale_on_map_build = false
|
||||||
|
classname = "marker_spawn_enemy_fairy_guard"
|
||||||
|
description = "Fairy Guard Spawn Marker"
|
||||||
|
base_classes = Array[Resource]([ExtResource("1_4w7c8"), ExtResource("2_4yeye")])
|
||||||
|
class_properties = {
|
||||||
|
"autospawn": true,
|
||||||
|
"resource_path": "res://Resources/Enemies/Fairy_Guard_3D.tres"
|
||||||
|
}
|
||||||
|
class_property_descriptions = {
|
||||||
|
"autospawn": "Whether to spawn automatically or not",
|
||||||
|
"resource_path": "Path to the enemy resource"
|
||||||
|
}
|
||||||
|
meta_properties = {
|
||||||
|
"color": Color(0.9229911, 0.41614023, 0.21117541, 1),
|
||||||
|
"size": AABB(-4, -4, -6, 4, 4, 6)
|
||||||
|
}
|
||||||
|
node_class = "Marker3D"
|
||||||
|
metadata/_custom_type_script = "uid://cxsqwtsqd8w33"
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
[gd_resource type="Resource" script_class="FuncGodotFGDPointClass" load_steps=5 format=3 uid="uid://n7nb0h11j0nh"]
|
||||||
|
|
||||||
|
[ext_resource type="Resource" uid="uid://5bc1qysixhmh" path="res://3D/TrenchBroom/EntityDefinitions/base/actor_base.tres" id="1_ipnjc"]
|
||||||
|
[ext_resource type="Resource" uid="uid://kerywjgft7vh" path="res://3D/TrenchBroom/EntityDefinitions/base/target_base.tres" id="2_dg4k0"]
|
||||||
|
[ext_resource type="Script" uid="uid://cxsqwtsqd8w33" path="res://addons/func_godot/src/fgd/func_godot_fgd_point_class.gd" id="2_e3k6b"]
|
||||||
|
[ext_resource type="Script" uid="uid://b88cmj87g78mx" path="res://Scripts/Actors/ItemMarker3D.cs" id="4_otker"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("2_e3k6b")
|
||||||
|
script_class = ExtResource("4_otker")
|
||||||
|
apply_rotation_on_map_build = false
|
||||||
|
apply_scale_on_map_build = false
|
||||||
|
classname = "marker_spawn_item"
|
||||||
|
description = "Item Spawn Marker"
|
||||||
|
base_classes = Array[Resource]([ExtResource("1_ipnjc"), ExtResource("2_dg4k0")])
|
||||||
|
class_properties = {
|
||||||
|
"autospawn": true,
|
||||||
|
"resource_path": ""
|
||||||
|
}
|
||||||
|
class_property_descriptions = {
|
||||||
|
"autospawn": "Whether to spawn automatically or not",
|
||||||
|
"resource_path": "Path to the enemy resource"
|
||||||
|
}
|
||||||
|
meta_properties = {
|
||||||
|
"color": Color(0.24138406, 0.36984414, 0.9698661, 1),
|
||||||
|
"size": AABB(-4, -4, -6, 4, 4, 6)
|
||||||
|
}
|
||||||
|
node_class = "Marker3D"
|
||||||
|
metadata/_custom_type_script = "uid://cxsqwtsqd8w33"
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_resource type="Resource" script_class="FuncGodotFGDFile" load_steps=53 format=3 uid="uid://b700sa4be6dfa"]
|
[gd_resource type="Resource" script_class="FuncGodotFGDFile" load_steps=55 format=3 uid="uid://b700sa4be6dfa"]
|
||||||
|
|
||||||
[ext_resource type="Resource" uid="uid://ia1t5p4mhom3" path="res://3D/TrenchBroom/EntityDefinitions/point/lights/light_omni.tres" id="1_7vcj1"]
|
[ext_resource type="Resource" uid="uid://ia1t5p4mhom3" path="res://3D/TrenchBroom/EntityDefinitions/point/lights/light_omni.tres" id="1_7vcj1"]
|
||||||
[ext_resource type="Script" uid="uid://drlmgulwbjwqu" path="res://addons/func_godot/src/fgd/func_godot_fgd_file.gd" id="1_lykim"]
|
[ext_resource type="Script" uid="uid://drlmgulwbjwqu" path="res://addons/func_godot/src/fgd/func_godot_fgd_file.gd" id="1_lykim"]
|
||||||
|
|
@ -52,7 +52,9 @@
|
||||||
[ext_resource type="Resource" uid="uid://umbceo5tcxni" path="res://3D/TrenchBroom/EntityDefinitions/point/actors/actor_chair.tres" id="49_8hbdx"]
|
[ext_resource type="Resource" uid="uid://umbceo5tcxni" path="res://3D/TrenchBroom/EntityDefinitions/point/actors/actor_chair.tres" id="49_8hbdx"]
|
||||||
[ext_resource type="Resource" uid="uid://bhkn5vwemx7nk" path="res://3D/TrenchBroom/EntityDefinitions/point/actors/actor_box_blue_tall.tres" id="50_xpy40"]
|
[ext_resource type="Resource" uid="uid://bhkn5vwemx7nk" path="res://3D/TrenchBroom/EntityDefinitions/point/actors/actor_box_blue_tall.tres" id="50_xpy40"]
|
||||||
[ext_resource type="Resource" uid="uid://cmdgqpq5e1duq" path="res://3D/TrenchBroom/EntityDefinitions/point/actors/marker_spawn.tres" id="51_mwau1"]
|
[ext_resource type="Resource" uid="uid://cmdgqpq5e1duq" path="res://3D/TrenchBroom/EntityDefinitions/point/actors/marker_spawn.tres" id="51_mwau1"]
|
||||||
|
[ext_resource type="Resource" uid="uid://cd8kf5wey5n8n" path="res://3D/TrenchBroom/EntityDefinitions/point/actors/EnemySpawners/marker_spawn_enemy.tres" id="52_v4gel"]
|
||||||
|
[ext_resource type="Resource" uid="uid://n7nb0h11j0nh" path="res://3D/TrenchBroom/EntityDefinitions/point/actors/ItemSpawners/marker_spawn_item.tres" id="53_k53o0"]
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_lykim")
|
script = ExtResource("1_lykim")
|
||||||
entity_definitions = Array[Resource]([ExtResource("1_7vcj1"), ExtResource("2_u7uvb"), ExtResource("3_u7uvb"), ExtResource("4_1nmxk"), ExtResource("5_ljb2x"), ExtResource("6_seuvu"), ExtResource("7_fmwex"), ExtResource("8_c8m8m"), ExtResource("9_14sjf"), ExtResource("10_xik3w"), ExtResource("11_dgiqm"), ExtResource("12_1teik"), ExtResource("13_f0hti"), ExtResource("14_6ld6e"), ExtResource("15_g8j5j"), ExtResource("16_7h4of"), ExtResource("17_m3sbm"), ExtResource("18_m3sbm"), ExtResource("19_hvhb8"), ExtResource("20_3v5us"), ExtResource("21_g67cj"), ExtResource("22_iy67w"), ExtResource("23_b5lmu"), ExtResource("24_ndas4"), ExtResource("25_n7wsi"), ExtResource("26_v48k5"), ExtResource("27_ombvk"), ExtResource("28_31lma"), ExtResource("29_louv0"), ExtResource("30_wfgfu"), ExtResource("31_elv2e"), ExtResource("32_elv2e"), ExtResource("33_aawmv"), ExtResource("34_wy0ht"), ExtResource("35_3jqmy"), ExtResource("36_p5b6l"), ExtResource("37_53o7h"), ExtResource("38_mdgca"), ExtResource("39_d6b4f"), ExtResource("40_l3pck"), ExtResource("41_q8hab"), ExtResource("42_ekplg"), ExtResource("43_d7qk0"), ExtResource("44_k6g2u"), ExtResource("45_b4ckg"), ExtResource("46_dyoc0"), ExtResource("47_pa845"), ExtResource("48_lb3ub"), ExtResource("49_8hbdx"), ExtResource("50_xpy40"), ExtResource("51_mwau1")])
|
entity_definitions = Array[Resource]([ExtResource("1_7vcj1"), ExtResource("2_u7uvb"), ExtResource("3_u7uvb"), ExtResource("4_1nmxk"), ExtResource("5_ljb2x"), ExtResource("6_seuvu"), ExtResource("7_fmwex"), ExtResource("8_c8m8m"), ExtResource("9_14sjf"), ExtResource("10_xik3w"), ExtResource("11_dgiqm"), ExtResource("12_1teik"), ExtResource("13_f0hti"), ExtResource("14_6ld6e"), ExtResource("15_g8j5j"), ExtResource("16_7h4of"), ExtResource("17_m3sbm"), ExtResource("18_m3sbm"), ExtResource("19_hvhb8"), ExtResource("20_3v5us"), ExtResource("21_g67cj"), ExtResource("22_iy67w"), ExtResource("23_b5lmu"), ExtResource("24_ndas4"), ExtResource("25_n7wsi"), ExtResource("26_v48k5"), ExtResource("27_ombvk"), ExtResource("28_31lma"), ExtResource("29_louv0"), ExtResource("30_wfgfu"), ExtResource("31_elv2e"), ExtResource("32_elv2e"), ExtResource("33_aawmv"), ExtResource("34_wy0ht"), ExtResource("35_3jqmy"), ExtResource("36_p5b6l"), ExtResource("37_53o7h"), ExtResource("38_mdgca"), ExtResource("39_d6b4f"), ExtResource("40_l3pck"), ExtResource("41_q8hab"), ExtResource("42_ekplg"), ExtResource("43_d7qk0"), ExtResource("44_k6g2u"), ExtResource("45_b4ckg"), ExtResource("46_dyoc0"), ExtResource("47_pa845"), ExtResource("48_lb3ub"), ExtResource("49_8hbdx"), ExtResource("50_xpy40"), ExtResource("51_mwau1"), ExtResource("52_v4gel"), ExtResource("53_k53o0")])
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
using Cirno.Scripts.Resources;
|
using Cirno.Scripts.Resources;
|
||||||
using Cirno.Scripts.Utils;
|
using Cirno.Scripts.Utils;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using Godot.Collections;
|
||||||
|
|
||||||
namespace Cirno.Scripts.Actors;
|
namespace Cirno.Scripts.Actors;
|
||||||
|
|
||||||
|
|
@ -52,6 +53,26 @@ public partial class EnemyMarker3D : PreviewMarker3D, IActivable
|
||||||
|
|
||||||
private EnemyProxy3D _spawnedEnemy;
|
private EnemyProxy3D _spawnedEnemy;
|
||||||
|
|
||||||
|
public void _func_godot_apply_properties(Dictionary<string, Variant> props)
|
||||||
|
{
|
||||||
|
//GroupName = (string)props["targetname"];
|
||||||
|
this.AddToGroup("EnemyMarkers");
|
||||||
|
AutoSpawn = props["autospawn"].AsBool();
|
||||||
|
|
||||||
|
var scriptPath = props["resource_path"].AsString();
|
||||||
|
if (!string.IsNullOrWhiteSpace(scriptPath))
|
||||||
|
{
|
||||||
|
Enemy = GD.Load<EnemyResource>(scriptPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GD.PushWarning($"Spawner {this.Name} has no enemy assigned");
|
||||||
|
}
|
||||||
|
|
||||||
|
Billboard = true;
|
||||||
|
//MarkerId = props["id"].AsInt32();
|
||||||
|
}
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
base._Ready();
|
base._Ready();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using Cirno.Scripts.Interactables;
|
using Cirno.Scripts.Interactables;
|
||||||
using Cirno.Scripts.Resources;
|
using Cirno.Scripts.Resources;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using Godot.Collections;
|
||||||
|
|
||||||
namespace Cirno.Scripts.Actors;
|
namespace Cirno.Scripts.Actors;
|
||||||
|
|
||||||
|
|
@ -28,60 +29,25 @@ public partial class ItemMarker3D : PreviewMarker3D
|
||||||
|
|
||||||
[Export] public bool AutoSpawn { get; set; } = false;
|
[Export] public bool AutoSpawn { get; set; } = false;
|
||||||
|
|
||||||
// [ExportToolButton("Update Icon")] public Callable RedrawButton => Callable.From(Redraw);
|
public void _func_godot_apply_properties(Dictionary<string, Variant> props)
|
||||||
// [ExportToolButton("Clear Children")] public Callable ClearChildrenButton => Callable.From(ClearChildren);
|
{
|
||||||
|
//GroupName = (string)props["targetname"];
|
||||||
|
this.AddToGroup("ItemMarkers");
|
||||||
|
AutoSpawn = props["autospawn"].AsBool();
|
||||||
|
|
||||||
// public override void _Draw()
|
var scriptPath = props["resource_path"].AsString();
|
||||||
// {
|
if (!string.IsNullOrWhiteSpace(scriptPath))
|
||||||
// if (!Engine.IsEditorHint()) return;
|
{
|
||||||
// if (Item is null) return;
|
Item = GD.Load<LootItem>(scriptPath);
|
||||||
// if (Item.InventorySprite is null) return;
|
}
|
||||||
//
|
else
|
||||||
// DrawTexture(Item.InventorySprite, - new Vector2(Item.InventorySprite.GetWidth() / 2f, Item.InventorySprite.GetHeight() / 2f));
|
{
|
||||||
// }
|
GD.PushWarning($"Spawner {this.Name} has no item assigned");
|
||||||
//
|
}
|
||||||
// private void Redraw()
|
|
||||||
// {
|
|
||||||
// QueueRedraw();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// private void ClearChildren()
|
Billboard = true;
|
||||||
// {
|
//MarkerId = props["id"].AsInt32();
|
||||||
// var children = GetChildren();
|
}
|
||||||
// foreach (var child in children)
|
|
||||||
// {
|
|
||||||
// if (child is Sprite3D)
|
|
||||||
// {
|
|
||||||
// child.QueueFree();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// _sprite = null;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// private void QueueRedraw()
|
|
||||||
// {
|
|
||||||
// if (!Engine.IsEditorHint()) return;
|
|
||||||
// if (Item?.InventorySprite is null) return;
|
|
||||||
//
|
|
||||||
// if (_sprite is null)
|
|
||||||
// {
|
|
||||||
// GD.Print("Remaking sprite");
|
|
||||||
// _sprite = new EditorSprite3D();
|
|
||||||
// this.AddChild(_sprite);
|
|
||||||
// //_sprite.Owner = GetTree().EditedSceneRoot;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// _sprite.Texture = Item.InventorySprite;
|
|
||||||
// //_sprite.SetRotationDegrees(new Vector3(-45, 45, 0));
|
|
||||||
// _sprite.FixedSize = true;
|
|
||||||
// _sprite.SetBillboardMode(BaseMaterial3D.BillboardModeEnum.Enabled);
|
|
||||||
// _sprite.TextureFilter = BaseMaterial3D.TextureFilterEnum.Nearest;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
//private Sprite3D _sprite;
|
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ public partial class PreviewMarker3D : Marker3D
|
||||||
|
|
||||||
private bool _fixedSize;
|
private bool _fixedSize;
|
||||||
private bool _billboard;
|
private bool _billboard;
|
||||||
private float _pixelSize = 0.1f;
|
private float _pixelSize = 0.05f;
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
protected bool FixedSize
|
protected bool FixedSize
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,7 @@ public partial class GameController : Node
|
||||||
|
|
||||||
[Export] public Dictionary<int, NodePath> SpawnMarkers { get; private set; } = new();
|
[Export] public Dictionary<int, NodePath> SpawnMarkers { get; private set; } = new();
|
||||||
|
|
||||||
[Export]
|
[Export] public int EggStartIndex = 0;
|
||||||
public int EggStartIndex = 0;
|
|
||||||
|
|
||||||
[Export] public Node3D PlayerParentNode { get; set; }
|
[Export] public Node3D PlayerParentNode { get; set; }
|
||||||
private InventoryManager _inventoryManager { get; set; }
|
private InventoryManager _inventoryManager { get; set; }
|
||||||
|
|
@ -219,7 +218,6 @@ public partial class GameController : Node
|
||||||
{
|
{
|
||||||
_cameraTarget.Position += offset.Value;
|
_cameraTarget.Position += offset.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector3 GetStartPosition()
|
private Vector3 GetStartPosition()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue