🐛 Rebase fixing
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=8 format=3 uid="uid://qfdiudt3vpai"]
|
[gd_scene load_steps=9 format=3 uid="uid://qfdiudt3vpai"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://lequnojtar76" path="res://scripts/CSharp/Common/Fight/RoamingEnemyGroup.cs" id="1_t3mrx"]
|
[ext_resource type="Script" uid="uid://lequnojtar76" path="res://scripts/CSharp/Common/Fight/RoamingEnemyGroup.cs" id="1_t3mrx"]
|
||||||
[ext_resource type="Texture2D" uid="uid://ccrnmx6bd842k" path="res://art/characters/farm fäulnis blobs.png" id="2_6ftwg"]
|
[ext_resource type="Texture2D" uid="uid://ccrnmx6bd842k" path="res://art/characters/farm fäulnis blobs.png" id="2_6ftwg"]
|
||||||
@@ -17,6 +17,10 @@ region = Rect2(774.378, 151.512, 1097.48, 1412.67)
|
|||||||
atlas = ExtResource("2_6ftwg")
|
atlas = ExtResource("2_6ftwg")
|
||||||
region = Rect2(1149.47, 92.492, 445.652, 353.692)
|
region = Rect2(1149.47, 92.492, 445.652, 353.692)
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_xi5g8"]
|
||||||
|
resource_local_to_scene = true
|
||||||
|
radius = 402.0112
|
||||||
|
|
||||||
[node name="RoamingEnemyGroup" type="Node2D"]
|
[node name="RoamingEnemyGroup" type="Node2D"]
|
||||||
script = ExtResource("1_t3mrx")
|
script = ExtResource("1_t3mrx")
|
||||||
|
|
||||||
@@ -35,7 +39,13 @@ texture = SubResource("AtlasTexture_kbgcx")
|
|||||||
position = Vector2(-41, -109)
|
position = Vector2(-41, -109)
|
||||||
texture = SubResource("AtlasTexture_6fvcb")
|
texture = SubResource("AtlasTexture_6fvcb")
|
||||||
|
|
||||||
[node name="InteractionArea" parent="." node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("4_xi5g8")]
|
[node name="InteractionArea" parent="." node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("4_xi5g8")]
|
||||||
_spriteToOutline = [NodePath("../Visuals/Sprite2D"), NodePath("../Visuals/Sprite2D3"), NodePath("../Visuals/Sprite2D2")]
|
_spritesToOutline = [NodePath("../Visuals/Sprite2D"), NodePath("../Visuals/Sprite2D3"), NodePath("../Visuals/Sprite2D2")]
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" parent="InteractionArea/Area2D" index="0"]
|
||||||
|
position = Vector2(-49, -174)
|
||||||
|
shape = SubResource("CircleShape2D_xi5g8")
|
||||||
|
|
||||||
[connection signal="Interacted" from="InteractionArea" to="." method="StartFight"]
|
[connection signal="Interacted" from="InteractionArea" to="." method="StartFight"]
|
||||||
|
|
||||||
|
[editable path="InteractionArea"]
|
||||||
|
|||||||
+1
-3
@@ -12,7 +12,7 @@ config_version=5
|
|||||||
|
|
||||||
config/name="Babushka"
|
config/name="Babushka"
|
||||||
run/main_scene="uid://bopv10dqm1knc"
|
run/main_scene="uid://bopv10dqm1knc"
|
||||||
config/features=PackedStringArray("4.4", "C#", "Forward Plus")
|
config/features=PackedStringArray("4.5", "C#", "Forward Plus")
|
||||||
run/max_fps=120
|
run/max_fps=120
|
||||||
boot_splash/fullsize=false
|
boot_splash/fullsize=false
|
||||||
boot_splash/image="uid://utam4axkvutc"
|
boot_splash/image="uid://utam4axkvutc"
|
||||||
@@ -30,8 +30,6 @@ Dialogic="*res://addons/dialogic/Core/DialogicGameHandler.gd"
|
|||||||
InventoryManager="*res://scripts/CSharp/Common/Inventory/InventoryManager.cs"
|
InventoryManager="*res://scripts/CSharp/Common/Inventory/InventoryManager.cs"
|
||||||
InputService="*res://scripts/CSharp/Common/Services/InputService.cs"
|
InputService="*res://scripts/CSharp/Common/Services/InputService.cs"
|
||||||
QuestManager="*res://prefabs/quests/quest_manager_autoload.tscn"
|
QuestManager="*res://prefabs/quests/quest_manager_autoload.tscn"
|
||||||
FightManagerAutoload="*res://prefabs/fight/fight_manager_autoload.tscn"
|
|
||||||
InputService="*res://scripts/CSharp/Common/Services/InputService.cs"
|
|
||||||
Signal_Debugger="*res://addons/SignalVisualizer/Debugger/SignalDebugger.gd"
|
Signal_Debugger="*res://addons/SignalVisualizer/Debugger/SignalDebugger.gd"
|
||||||
FightWorldAutoload="*res://prefabs/fight/fight_world_autoload.tscn"
|
FightWorldAutoload="*res://prefabs/fight/fight_world_autoload.tscn"
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using Babushka.scripts.CSharp.Common.Services;
|
using Babushka.scripts.CSharp.Common.Services;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
@@ -11,19 +12,21 @@ public partial class InteractionArea2D : Node2D
|
|||||||
[Export] private bool _active = true;
|
[Export] private bool _active = true;
|
||||||
[Export] private bool _useOutline = true;
|
[Export] private bool _useOutline = true;
|
||||||
[Export] private ShaderMaterial _outlineMaterial;
|
[Export] private ShaderMaterial _outlineMaterial;
|
||||||
[Export] private bool _useSprite = true;
|
[Export] private CanvasItem? _spriteToOutline; // keep to not break old usages. TODO: remove later
|
||||||
[Export] private CanvasItem _spriteToOutline;
|
[Export] private CanvasItem[] _spritesToOutline;
|
||||||
[Export] private bool _showLabel = true;
|
[Export] private bool _showLabel = true;
|
||||||
[Export] private int _id = -1; // TODO: remove
|
[Export] private int _id = -1; // TODO: remove
|
||||||
|
|
||||||
private Material _backupMaterial;
|
private Material[] _backupMaterials;
|
||||||
|
|
||||||
[Signal] public delegate void InteractedToolEventHandler(int id); // TODO: remove
|
[Signal] public delegate void InteractedToolEventHandler(int id); // TODO: remove
|
||||||
|
|
||||||
[Signal] public delegate void InteractedEventHandler();
|
[Signal] public delegate void InteractedEventHandler();
|
||||||
|
|
||||||
public bool IsActive
|
public bool IsActive
|
||||||
{
|
{
|
||||||
get => _active;
|
get => _active;
|
||||||
set => _active = value;
|
set => _active = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetActiveInverse(bool active)
|
public void SetActiveInverse(bool active)
|
||||||
@@ -33,52 +36,66 @@ public partial class InteractionArea2D : Node2D
|
|||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
if (_useSprite && _useOutline)
|
if (_useOutline)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_backupMaterial = _spriteToOutline.Material;
|
// support old implementations of the script. If the sprite to outline is set, add it to the array
|
||||||
|
if (_spriteToOutline != null)
|
||||||
|
{
|
||||||
|
Array.Resize(ref _spritesToOutline, _spritesToOutline.Length + 1);
|
||||||
|
_spritesToOutline[^1] = _spriteToOutline;
|
||||||
|
}
|
||||||
|
|
||||||
|
_backupMaterials = _spritesToOutline.Select(s => s.Material).ToArray();
|
||||||
}
|
}
|
||||||
catch(Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
GD.PrintErr($"No sprite to outline found on: {GetParent().Name}" + exception.Message);
|
GD.PrintErr($"No sprite to outline found on: {GetParent().Name}" + exception.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void OnPlayerEntered(Node2D player)
|
public void OnPlayerEntered(Node2D player)
|
||||||
{
|
{
|
||||||
if (!_active || !InputService.Instance.InputEnabled)
|
if (!_active || !InputService.Instance.InputEnabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(_showLabel)
|
if (_showLabel)
|
||||||
_label.Show();
|
_label.Show();
|
||||||
|
|
||||||
if (!_useSprite || !_useOutline)
|
if (!_useOutline)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_spriteToOutline.Material = _outlineMaterial;
|
foreach (var sprite in _spritesToOutline)
|
||||||
|
{
|
||||||
|
sprite.Material = _outlineMaterial;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnPlayerExited(Node2D player)
|
public void OnPlayerExited(Node2D player)
|
||||||
{
|
{
|
||||||
if (!_active)
|
if (!_active)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_label.Hide();
|
_label.Hide();
|
||||||
|
|
||||||
if (!_useSprite || !_useOutline)
|
if (!_useOutline)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_spriteToOutline.Material = _backupMaterial;
|
for (var i = 0; i < _spritesToOutline.Length; i++)
|
||||||
|
{
|
||||||
|
var sprite = _spritesToOutline[i];
|
||||||
|
sprite.Material = _backupMaterials[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _Input(InputEvent @event)
|
public override void _Input(InputEvent @event)
|
||||||
{
|
{
|
||||||
if (!_active || !InputService.Instance.InputEnabled)
|
if (!_active || !InputService.Instance.InputEnabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (@event.IsAction("interact") && @event.IsPressed())
|
if (@event.IsAction("interact") && @event.IsPressed())
|
||||||
{
|
{
|
||||||
TryInteract();
|
TryInteract();
|
||||||
@@ -95,10 +112,16 @@ public partial class InteractionArea2D : Node2D
|
|||||||
if (_area.HasOverlappingAreas())
|
if (_area.HasOverlappingAreas())
|
||||||
{
|
{
|
||||||
_label.Hide();
|
_label.Hide();
|
||||||
|
|
||||||
if (_useSprite && _useOutline)
|
if (_useOutline)
|
||||||
_spriteToOutline.Material = _backupMaterial;
|
{
|
||||||
|
for (var i = 0; i < _spritesToOutline.Length; i++)
|
||||||
|
{
|
||||||
|
var sprite = _spritesToOutline[i];
|
||||||
|
sprite.Material = _backupMaterials[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EmitSignal(SignalName.InteractedTool, _id);
|
EmitSignal(SignalName.InteractedTool, _id);
|
||||||
EmitSignal(SignalName.Interacted);
|
EmitSignal(SignalName.Interacted);
|
||||||
}
|
}
|
||||||
@@ -107,7 +130,7 @@ public partial class InteractionArea2D : Node2D
|
|||||||
public void SetSpriteActiveState(bool success, int id) // TODO: remove
|
public void SetSpriteActiveState(bool success, int id) // TODO: remove
|
||||||
{
|
{
|
||||||
GD.PrintErr("SetSpriteActiveState is being called.");
|
GD.PrintErr("SetSpriteActiveState is being called.");
|
||||||
if(!_active)
|
if (!_active)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user