Merge b287f978e3 into 516d79d86f
				
					
				
			
						commit
						0cb3b5f312
					
				| 
						 | 
				
			
			@ -0,0 +1,74 @@
 | 
			
		|||
[gd_scene load_steps=11 format=3 uid="uid://rd08pot25h00"]
 | 
			
		||||
 | 
			
		||||
[ext_resource type="Script" path="res://Characters/NPC.cs" id="1_04gcf"]
 | 
			
		||||
[ext_resource type="Script" path="res://State/Character/CharacterStateMachine.cs" id="2_kynkg"]
 | 
			
		||||
[ext_resource type="Texture2D" uid="uid://bej8thq7ruyty" path="res://Assets/Sprites/Characters/forsen2.png" id="2_s5nik"]
 | 
			
		||||
[ext_resource type="Script" path="res://State/Character/NPCIdleState.cs" id="3_pcrll"]
 | 
			
		||||
[ext_resource type="Script" path="res://State/Thinker/IdleState.cs" id="3_rgc42"]
 | 
			
		||||
[ext_resource type="Script" path="res://State/Thinker/ThinkerStateMachine.cs" id="4_mo4wj"]
 | 
			
		||||
[ext_resource type="PackedScene" uid="uid://dldnp8eunxj3q" path="res://BoundingBoxes/InteractionTrigger.tscn" id="5_sjs24"]
 | 
			
		||||
[ext_resource type="Script" path="res://Utils/InteractionTriggerDialogue.cs" id="5_yknpw"]
 | 
			
		||||
[ext_resource type="Resource" uid="uid://c4n7vhoxybu70" path="res://Dialogue/snus-dealer.dialogue" id="6_isvnq"]
 | 
			
		||||
[ext_resource type="Script" path="res://Items/Inventory.cs" id="7_vip6b"]
 | 
			
		||||
 | 
			
		||||
[node name="Character" type="CharacterBody2D" node_paths=PackedStringArray("ThinkerStateMachine", "Sprite", "Inventory", "StateMachine")]
 | 
			
		||||
script = ExtResource("1_04gcf")
 | 
			
		||||
ThinkerStateMachine = NodePath("Thinker")
 | 
			
		||||
Sprite = NodePath("Sprites/Sprite")
 | 
			
		||||
Inventory = NodePath("Inventory")
 | 
			
		||||
StateMachine = NodePath("StateMachine")
 | 
			
		||||
 | 
			
		||||
[node name="StateMachine" type="Node" parent="." node_paths=PackedStringArray("InitialState", "Character")]
 | 
			
		||||
script = ExtResource("2_kynkg")
 | 
			
		||||
InitialState = NodePath("Idle")
 | 
			
		||||
Character = NodePath("..")
 | 
			
		||||
 | 
			
		||||
[node name="Idle" type="Node" parent="StateMachine" node_paths=PackedStringArray("Character")]
 | 
			
		||||
script = ExtResource("3_pcrll")
 | 
			
		||||
Character = NodePath("../..")
 | 
			
		||||
 | 
			
		||||
[node name="Thinker" type="Node" parent="." node_paths=PackedStringArray("InitialState")]
 | 
			
		||||
script = ExtResource("4_mo4wj")
 | 
			
		||||
InitialState = NodePath("Idle")
 | 
			
		||||
 | 
			
		||||
[node name="Idle" type="Node" parent="Thinker" node_paths=PackedStringArray("NPC")]
 | 
			
		||||
script = ExtResource("3_rgc42")
 | 
			
		||||
NPC = NodePath("../..")
 | 
			
		||||
 | 
			
		||||
[node name="Animations" type="Node" parent="."]
 | 
			
		||||
 | 
			
		||||
[node name="Movement" type="AnimationPlayer" parent="Animations"]
 | 
			
		||||
 | 
			
		||||
[node name="Hurt" type="AnimationPlayer" parent="Animations"]
 | 
			
		||||
 | 
			
		||||
[node name="Stun" type="AnimationPlayer" parent="Animations"]
 | 
			
		||||
 | 
			
		||||
[node name="Attack" type="AnimationPlayer" parent="Animations"]
 | 
			
		||||
 | 
			
		||||
[node name="Stats" type="Node" parent="."]
 | 
			
		||||
 | 
			
		||||
[node name="Sprites" type="Node2D" parent="."]
 | 
			
		||||
 | 
			
		||||
[node name="Sprite" type="Sprite2D" parent="Sprites"]
 | 
			
		||||
texture = ExtResource("2_s5nik")
 | 
			
		||||
centered = false
 | 
			
		||||
offset = Vector2(-12, -20)
 | 
			
		||||
hframes = 46
 | 
			
		||||
 | 
			
		||||
[node name="Inventory" type="Node2D" parent="." node_paths=PackedStringArray("Hotbar")]
 | 
			
		||||
script = ExtResource("7_vip6b")
 | 
			
		||||
Hotbar = []
 | 
			
		||||
 | 
			
		||||
[node name="Interaction" type="Node2D" parent="." node_paths=PackedStringArray("InteractionTrigger")]
 | 
			
		||||
position = Vector2(0, -4)
 | 
			
		||||
script = ExtResource("5_yknpw")
 | 
			
		||||
InteractionTrigger = NodePath("InteractionTrigger")
 | 
			
		||||
DialogueResource = ExtResource("6_isvnq")
 | 
			
		||||
DialogueTitle = "shop"
 | 
			
		||||
 | 
			
		||||
[node name="InteractionTrigger" parent="Interaction" instance=ExtResource("5_sjs24")]
 | 
			
		||||
 | 
			
		||||
[node name="Label" parent="Interaction/InteractionTrigger/Popup" index="0"]
 | 
			
		||||
text = "Listen"
 | 
			
		||||
 | 
			
		||||
[editable path="Interaction/InteractionTrigger"]
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,27 @@
 | 
			
		|||
//using Godot;
 | 
			
		||||
//using SupaLidlGame.BoundingBoxes;
 | 
			
		||||
//using SupaLidlGame.Extensions;
 | 
			
		||||
//
 | 
			
		||||
//namespace SupaLidlGame.Characters;
 | 
			
		||||
//
 | 
			
		||||
//public partial class Vendor : NPC
 | 
			
		||||
//{
 | 
			
		||||
//    [Export]
 | 
			
		||||
//    public InteractionTrigger InteractionTrigger { get; set; }
 | 
			
		||||
//
 | 
			
		||||
//    [Export(PropertyHint.File, "*.dialogue")]
 | 
			
		||||
//    public Resource DialogueResource { get; set; }
 | 
			
		||||
//
 | 
			
		||||
//    [Export]
 | 
			
		||||
//    public string DialogueTitle { get; set; }
 | 
			
		||||
//
 | 
			
		||||
//    public override void _Ready()
 | 
			
		||||
//    {
 | 
			
		||||
//        InteractionTrigger.Interaction += OnInteraction;
 | 
			
		||||
//    }
 | 
			
		||||
//
 | 
			
		||||
//    private void OnInteraction()
 | 
			
		||||
//    {
 | 
			
		||||
//        this.GetWorld().DialogueBalloon.Start(DialogueResource, DialogueTitle);
 | 
			
		||||
//    }
 | 
			
		||||
//}
 | 
			
		||||
| 
						 | 
				
			
			@ -34,6 +34,8 @@ public sealed partial class DebugConsole : Control
 | 
			
		|||
 | 
			
		||||
    private Node ctx => Context;
 | 
			
		||||
 | 
			
		||||
    public const double DEBUG_REFRESH_INTERVAL = 0.25;
 | 
			
		||||
 | 
			
		||||
    public override void _Ready()
 | 
			
		||||
    {
 | 
			
		||||
        _entry = GetNode<Entry>("%Entry");
 | 
			
		||||
| 
						 | 
				
			
			@ -61,6 +63,39 @@ public sealed partial class DebugConsole : Control
 | 
			
		|||
                }
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        GD.Print("DebugConsole init");
 | 
			
		||||
        // TODO: put this in a separate class
 | 
			
		||||
        // watch godot.log
 | 
			
		||||
        bool isFileLoggingEnabled = ProjectSettings
 | 
			
		||||
            .GetSetting("debug/file_logging/enable_file_logging.pc")
 | 
			
		||||
            .AsBool();
 | 
			
		||||
 | 
			
		||||
        if (isFileLoggingEnabled)
 | 
			
		||||
        {
 | 
			
		||||
            GD.Print("File logging is enabled.");
 | 
			
		||||
            string logPath = ProjectSettings
 | 
			
		||||
                .GetSetting("debug/file_logging/log_path")
 | 
			
		||||
                .AsString();
 | 
			
		||||
            var fs = FileAccess.Open(logPath, FileAccess.ModeFlags.Read);
 | 
			
		||||
 | 
			
		||||
            var timer = new Timer();
 | 
			
		||||
            AddChild(timer);
 | 
			
		||||
            timer.Timeout += () =>
 | 
			
		||||
            {
 | 
			
		||||
                // push 
 | 
			
		||||
                while (fs.GetPosition() < fs.GetLength())
 | 
			
		||||
                {
 | 
			
		||||
                    string line = fs.GetLine();
 | 
			
		||||
                    _output.Text += line;
 | 
			
		||||
                }
 | 
			
		||||
            };
 | 
			
		||||
            timer.Start(DEBUG_REFRESH_INTERVAL);
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            GD.PushWarning("File logging is not enabled.");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public IEnumerable<NodePathToken> SplitPath(NodePath path)
 | 
			
		||||
| 
						 | 
				
			
			@ -209,13 +244,21 @@ public sealed partial class DebugConsole : Control
 | 
			
		|||
 | 
			
		||||
        Godot.Expression exp = new();
 | 
			
		||||
 | 
			
		||||
        string[] reserved = { "from", "set_context", "context", "set_prop", "to_node_path" };
 | 
			
		||||
        string[] reserved = {
 | 
			
		||||
            "from",
 | 
			
		||||
            "set_context",
 | 
			
		||||
            "context",
 | 
			
		||||
            "set_prop",
 | 
			
		||||
            "to_node_path",
 | 
			
		||||
            "load",
 | 
			
		||||
        };
 | 
			
		||||
        Godot.Collections.Array reservedMap = new();
 | 
			
		||||
        reservedMap.Add(new Callable(this, MethodName.From));
 | 
			
		||||
        reservedMap.Add(new Callable(this, MethodName.SetContext));
 | 
			
		||||
        reservedMap.Add(Context);
 | 
			
		||||
        reservedMap.Add(new Callable(this, MethodName.SetProp));
 | 
			
		||||
        reservedMap.Add(new Callable(this, MethodName.ToNodePath));
 | 
			
		||||
        reservedMap.Add(new Callable(this, MethodName.Load));
 | 
			
		||||
 | 
			
		||||
        var err = exp.Parse(str, reserved);
 | 
			
		||||
        if (err != Error.Ok)
 | 
			
		||||
| 
						 | 
				
			
			@ -246,4 +289,9 @@ public sealed partial class DebugConsole : Control
 | 
			
		|||
    {
 | 
			
		||||
        Context = node;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private Resource Load(string path)
 | 
			
		||||
    {
 | 
			
		||||
        return ResourceLoader.Load(path);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
~ start
 | 
			
		||||
 | 
			
		||||
Snus Dealer: d
 | 
			
		||||
 | 
			
		||||
% => test
 | 
			
		||||
% => dont_snus
 | 
			
		||||
 | 
			
		||||
=> END
 | 
			
		||||
 | 
			
		||||
~ test
 | 
			
		||||
 | 
			
		||||
Snus Dealer: asdadsadasd
 | 
			
		||||
 | 
			
		||||
=> END
 | 
			
		||||
 | 
			
		||||
~ dont_snus
 | 
			
		||||
 | 
			
		||||
Snus Dealer: If you don't snus...
 | 
			
		||||
Snus Dealer: you lose.
 | 
			
		||||
 | 
			
		||||
=> END
 | 
			
		||||
 | 
			
		||||
~ shop
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,15 @@
 | 
			
		|||
[remap]
 | 
			
		||||
 | 
			
		||||
importer="dialogue_manager_compiler_11"
 | 
			
		||||
type="Resource"
 | 
			
		||||
uid="uid://c4n7vhoxybu70"
 | 
			
		||||
path="res://.godot/imported/snus-dealer.dialogue-69dbddee28632f18888364bae03f393d.tres"
 | 
			
		||||
 | 
			
		||||
[deps]
 | 
			
		||||
 | 
			
		||||
source_file="res://Dialogue/snus-dealer.dialogue"
 | 
			
		||||
dest_files=["res://.godot/imported/snus-dealer.dialogue-69dbddee28632f18888364bae03f393d.tres"]
 | 
			
		||||
 | 
			
		||||
[params]
 | 
			
		||||
 | 
			
		||||
defaults=true
 | 
			
		||||
| 
						 | 
				
			
			@ -58,7 +58,7 @@ public partial class DynamicDoor : StaticBody2D
 | 
			
		|||
            foreach (var navmesh in Rebake)
 | 
			
		||||
            {
 | 
			
		||||
                // rebake navmesh so NPCs can correctly travel conditionally
 | 
			
		||||
                GD.Print("rebaking");
 | 
			
		||||
                GD.Print("Dynamic door updated; rebaking navmeshes...");
 | 
			
		||||
                navmesh.BakeNavigationPolygon();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -102,12 +102,12 @@ y_sort_enabled = true
 | 
			
		|||
texture_filter = 1
 | 
			
		||||
sprite_frames = SubResource("SpriteFrames_gf7ku")
 | 
			
		||||
autoplay = "default"
 | 
			
		||||
frame = 6
 | 
			
		||||
frame_progress = 0.743234
 | 
			
		||||
frame = 9
 | 
			
		||||
frame_progress = 0.966501
 | 
			
		||||
offset = Vector2(0, -12)
 | 
			
		||||
 | 
			
		||||
[node name="PointLight2D" type="PointLight2D" parent="."]
 | 
			
		||||
color = Color(1, 0.9525, 0.85, 1)
 | 
			
		||||
color = Color(1, 0.811765, 0.537255, 1)
 | 
			
		||||
energy = 1.2
 | 
			
		||||
blend_mode = 2
 | 
			
		||||
shadow_filter_smooth = 3.0
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,6 +24,15 @@ public partial class ProjectileSpawner : Ranged
 | 
			
		|||
    [Export]
 | 
			
		||||
    public float ProjectileAngleDeviation { get; set; }
 | 
			
		||||
 | 
			
		||||
    public string ProjectilePath
 | 
			
		||||
    {
 | 
			
		||||
        get => Projectile?.ResourcePath;
 | 
			
		||||
        set
 | 
			
		||||
        {
 | 
			
		||||
            Projectile = GD.Load<PackedScene>(value);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected virtual void SpawnProjectile(Scenes.Map map,
 | 
			
		||||
        Vector2 direction, float velocityModifier = 1)
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -843,7 +843,7 @@ position = Vector2(1272, 0)
 | 
			
		|||
[node name="Campfire" parent="Entities" index="0" instance=ExtResource("3_ve4i2")]
 | 
			
		||||
position = Vector2(-24, -8)
 | 
			
		||||
 | 
			
		||||
[node name="Areas" parent="." index="3"]
 | 
			
		||||
[node name="Areas" parent="." index="10"]
 | 
			
		||||
visible = false
 | 
			
		||||
 | 
			
		||||
[node name="Main" type="NavigationRegion2D" parent="Areas" index="0"]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,6 +14,8 @@ public partial class GlobalState : Node
 | 
			
		|||
    [Export]
 | 
			
		||||
    public Stats Stats { get; set; }
 | 
			
		||||
 | 
			
		||||
    public static GlobalState Instance { get; private set; }
 | 
			
		||||
 | 
			
		||||
    [Export]
 | 
			
		||||
    public GameSettings Settings { get; set; }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -30,6 +32,13 @@ public partial class GlobalState : Node
 | 
			
		|||
 | 
			
		||||
    public override void _Ready()
 | 
			
		||||
    {
 | 
			
		||||
        if (Instance != null)
 | 
			
		||||
        {
 | 
			
		||||
            throw new MultipleSingletonsException();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        Instance = this;
 | 
			
		||||
 | 
			
		||||
        ProcessMode = ProcessModeEnum.Always;
 | 
			
		||||
        LoadSettings();
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,5 @@
 | 
			
		|||
using Godot;
 | 
			
		||||
using SupaLidlGame.Extensions;
 | 
			
		||||
 | 
			
		||||
namespace SupaLidlGame.Utils;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -52,8 +53,7 @@ public partial class CharacterStats : Node
 | 
			
		|||
        else
 | 
			
		||||
        {
 | 
			
		||||
            _shouldDecayStagger = false;
 | 
			
		||||
            _staggerDecayTimer.Stop();
 | 
			
		||||
            _staggerDecayTimer.Start(1);
 | 
			
		||||
            _staggerDecayTimer.Restart(1);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1 +1 @@
 | 
			
		|||
Subproject commit 36625398e3ad45306521926c5190141a7ac925b0
 | 
			
		||||
Subproject commit b265f5cebab07f3af55c92f642b458db9c973a7c
 | 
			
		||||
| 
						 | 
				
			
			@ -17,17 +17,17 @@ config/icon="res://icon.svg"
 | 
			
		|||
 | 
			
		||||
[autoload]
 | 
			
		||||
 | 
			
		||||
DialogueManager="*res://addons/dialogue_manager/dialogue_manager.gd"
 | 
			
		||||
GlobalState="*res://State/Global/GlobalState.cs"
 | 
			
		||||
EventBus="*res://Events/EventBus.cs"
 | 
			
		||||
BaseUI="*res://UI/Base.tscn"
 | 
			
		||||
World="*res://Scenes/Level.tscn"
 | 
			
		||||
AudioManager="*res://Audio/AudioManager.cs"
 | 
			
		||||
DebugUi="*res://UI/Debug/DebugUI.tscn"
 | 
			
		||||
DialogueManager="*res://addons/dialogue_manager/dialogue_manager.gd"
 | 
			
		||||
 | 
			
		||||
[dialogue_manager]
 | 
			
		||||
 | 
			
		||||
general/states=["GlobalState"]
 | 
			
		||||
general/states=["GlobalState", "World"]
 | 
			
		||||
general/wrap_lines=true
 | 
			
		||||
 | 
			
		||||
[display]
 | 
			
		||||
| 
						 | 
				
			
			@ -201,7 +201,7 @@ cast={
 | 
			
		|||
 | 
			
		||||
[internationalization]
 | 
			
		||||
 | 
			
		||||
locale/translations_pot_files=PackedStringArray("res://Assets/Dialog/doc.dialogue", "res://Assets/Dialogue/doc.dialogue", "res://Assets/Dialogue/spellbook.dialogue", "res://Assets/Dialogue/books.dialogue", "res://Assets/Dialogue/clone-machine.dialogue")
 | 
			
		||||
locale/translations_pot_files=PackedStringArray("res://Assets/Dialogue/doc.dialogue", "res://Assets/Dialogue/books.dialogue", "res://Assets/Dialogue/clone-machine.dialogue", "res://Dialogue/snus-dealer.dialogue")
 | 
			
		||||
 | 
			
		||||
[layer_names]
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue