Basic implementation for acquiring affinity sigil from Sarco

This commit is contained in:
2026-06-04 12:24:58 -07:00
parent 189497458d
commit 150a21aabc
16 changed files with 242 additions and 15 deletions
@@ -8,6 +8,11 @@ public class RescuedItemDatabase
private List<IBaseInventoryItem> _items { get; init; } private List<IBaseInventoryItem> _items { get; init; }
private int _maxSize { get; init; } = 20; private int _maxSize { get; init; } = 20;
public RescuedItemDatabase()
{
_items = [];
}
public RescuedItemDatabase(int maxSize) public RescuedItemDatabase(int maxSize)
{ {
_items = []; _items = [];
@@ -11,4 +11,4 @@ public partial record QuestData
[Save("quest_data_1")] [Save("quest_data_1")]
public bool QuestMarker1 { get; set; } = false; public bool QuestMarker1 { get; set; } = false;
} }
@@ -0,0 +1,11 @@
using Chickensoft.Introspection;
using Chickensoft.Serialization;
namespace Zennysoft.Ma.Adapter;
[Meta, Id("sarco_data")]
public partial record SarcoData
{
[Save("igneous_sarco")]
public bool IgneousSarcoAcquired { get; set; } = false;
}
+1 -1
View File
@@ -284,7 +284,7 @@ EnemyViewerWalk={
[internationalization] [internationalization]
locale/translations_pot_files=PackedStringArray("res://src/dialog/Dialogue.dialogue", "res://src/npc/Ran/ran.dialogue", "res://src/npc/Rat/ratdialogue.dialogue", "res://src/dialog/Altar.dialogue", "res://stone.dialogue", "res://src/npc/Proscenium/JumpScare.dialogue") locale/translations_pot_files=PackedStringArray("res://src/dialog/Dialogue.dialogue", "res://src/npc/Ran/ran.dialogue", "res://src/npc/Rat/ratdialogue.dialogue", "res://src/dialog/Altar.dialogue", "res://stone.dialogue", "res://src/npc/Proscenium/JumpScare.dialogue", "res://src/map/Placeables/sarco.dialogue")
[layer_names] [layer_names]
@@ -1,5 +1,6 @@
using DialogueManagerRuntime; using DialogueManagerRuntime;
using Godot; using Godot;
using Godot.Collections;
namespace Zennysoft.Game.Ma; namespace Zennysoft.Game.Ma;
@@ -13,18 +14,18 @@ public partial class DialogueController : Node
public override void _Ready() public override void _Ready()
{ {
DialogueBalloon = GD.Load<PackedScene>("res://src/ui/dialogue/DialogueBalloon.tscn"); DialogueBalloon = GD.Load<PackedScene>("res://src/ui/dialogue/DialogueBalloon.tscn");
} }
public static void ShowDialogue(Resource dialogueResource, string dialogueTitle) public static void ShowDialogue(Resource dialogueResource, string dialogueTitle, Array<Variant> extraGameStates = null)
{ {
Interrupt(); Interrupt();
_currentlyActiveDialogue = DialogueManager.ShowDialogueBalloonScene(DialogueBalloon, dialogueResource, dialogueTitle); _currentlyActiveDialogue = DialogueManager.ShowDialogueBalloonScene(DialogueBalloon, dialogueResource, dialogueTitle, extraGameStates);
} }
public static void Interrupt() public static void Interrupt()
{ {
if (IsInstanceValid(_currentlyActiveDialogue)) if (IsInstanceValid(_currentlyActiveDialogue))
_currentlyActiveDialogue.QueueFree(); _currentlyActiveDialogue.QueueFree();
} }
} }
+8
View File
@@ -70,6 +70,8 @@ public partial class Game : Node3D, IGame
public QuestData QuestData { get; private set; } public QuestData QuestData { get; private set; }
public SarcoData SarcoData { get; private set; }
public ItemRescueMenu ItemRescueMenu { get => InGameUI.ItemRescueMenu; } public ItemRescueMenu ItemRescueMenu { get => InGameUI.ItemRescueMenu; }
private EffectService _effectService; private EffectService _effectService;
@@ -97,6 +99,7 @@ public partial class Game : Node3D, IGame
QuestData = new QuestData(); QuestData = new QuestData();
RescuedItems = new RescuedItemDatabase(20); RescuedItems = new RescuedItemDatabase(20);
SarcoData = new SarcoData();
ItemDatabase = ItemDatabase.Instance; ItemDatabase = ItemDatabase.Instance;
GameChunk = new SaveChunk<GameData>( GameChunk = new SaveChunk<GameData>(
@@ -109,6 +112,10 @@ public partial class Game : Node3D, IGame
{ {
DeathCount = QuestData.DeathCount, DeathCount = QuestData.DeathCount,
QuestMarker1 = QuestData.QuestMarker1 QuestMarker1 = QuestData.QuestMarker1
},
SarcoData = new SarcoData()
{
IgneousSarcoAcquired = SarcoData.IgneousSarcoAcquired,
} }
}; };
return gameData; return gameData;
@@ -118,6 +125,7 @@ public partial class Game : Node3D, IGame
{ {
RescuedItems = data.RescuedItems; RescuedItems = data.RescuedItems;
QuestData = data.QuestData; QuestData = data.QuestData;
SarcoData = data.SarcoData;
} }
); );
+3
View File
@@ -11,5 +11,8 @@ public partial record GameData
[Save("quest_data")] [Save("quest_data")]
public required QuestData QuestData { get; init; } public required QuestData QuestData { get; init; }
[Save("sarco_data")]
public required SarcoData SarcoData { get; init; }
} }
+2
View File
@@ -46,6 +46,8 @@ public interface IGame : IProvide<IGame>, IProvide<IGameRepo>, IProvide<IPlayer>
public QuestData QuestData { get; } public QuestData QuestData { get; }
public SarcoData SarcoData { get; }
public event Action GameExitRequested; public event Action GameExitRequested;
public event Action GameLoaded; public event Action GameLoaded;
@@ -0,0 +1,87 @@
using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using DialogueManagerRuntime;
using Godot;
using System.Linq;
using System.Threading.Tasks;
using Zennysoft.Game.Ma;
using Zennysoft.Ma.Adapter;
[Meta(typeof(IAutoNode))]
public partial class Sarco : Node3D
{
public override void _Notification(int what) => this.Notify(what);
[Dependency] protected IPlayer _player => this.DependOn(() => GetParent().GetChildren().OfType<IPlayer>().Single());
[Dependency] public IGame _game => this.DependOn<IGame>();
[Dependency] private IGameRepo _gameRepo => this.DependOn<IGameRepo>();
[Export]
public ElementType Affinity { get; set; }
[Export]
public Resource Dialogue { get; set; }
[Node] public AnimationPlayer AnimationPlayer { get; set; }
[Node] public Area3D InteractZone { get; set; }
private bool _isInInteractZone = false;
private bool _interactionComplete = false;
public string AffinityString => Affinity.ToString();
public void OnReady()
{
SetPhysicsProcess(true);
InteractZone.BodyEntered += InteractZone_BodyEntered;
InteractZone.BodyExited += InteractZone_BodyExited;
}
public void OnResolved()
{
_interactionComplete = _game.SarcoData.IgneousSarcoAcquired;
if (_interactionComplete)
ShowFlower();
}
public override void _Input(InputEvent @event)
{
if (Dialogue != null && @event.IsActionPressed(GameInputs.Interact) && _isInInteractZone && !_interactionComplete)
{
GetTree().Paused = true;
DialogueController.ShowDialogue(Dialogue, "general", [this]);
}
}
public async Task EquipAffinity()
{
_player.SetSigil(new Sigil() { ElementType = Affinity });
}
public async Task ShowFlower()
{
AnimationPlayer.Play("fade_in");
}
public async Task Finish()
{
GetTree().Paused = false;
_interactionComplete = true;
_game.SarcoData.IgneousSarcoAcquired = true;
await _game.Save();
}
private void InteractZone_BodyEntered(Node3D body)
{
_isInInteractZone = true;
}
private void InteractZone_BodyExited(Node3D body)
{
_isInInteractZone = false;
}
}
@@ -0,0 +1 @@
uid://cn27rfw6olqaf
@@ -1,6 +1,8 @@
[gd_scene load_steps=5 format=3 uid="uid://dqjovmlt1y4tb"] [gd_scene load_steps=11 format=3 uid="uid://dqjovmlt1y4tb"]
[ext_resource type="PackedScene" uid="uid://bfvy34lj7lns" path="res://src/map/assets/Sarcophagus/sarco altar.glb" id="1_35fk8"] [ext_resource type="PackedScene" uid="uid://bfvy34lj7lns" path="res://src/map/assets/Sarcophagus/sarco altar.glb" id="1_35fk8"]
[ext_resource type="Script" uid="uid://cn27rfw6olqaf" path="res://src/map/Placeables/Sarco.cs" id="1_bw4xo"]
[ext_resource type="Resource" uid="uid://d2s0mmg453n5f" path="res://src/map/Placeables/sarco.dialogue" id="2_21qtc"]
[ext_resource type="PackedScene" uid="uid://d2rje5p3a0xdg" path="res://src/map/assets/Sarcophagus/sarco.glb" id="2_c6ny3"] [ext_resource type="PackedScene" uid="uid://d2rje5p3a0xdg" path="res://src/map/assets/Sarcophagus/sarco.glb" id="2_c6ny3"]
[ext_resource type="Texture2D" uid="uid://cqcjbeoghy70" path="res://src/items/special/textures/Flower.png" id="3_c6ny3"] [ext_resource type="Texture2D" uid="uid://cqcjbeoghy70" path="res://src/items/special/textures/Flower.png" id="3_c6ny3"]
@@ -8,8 +10,50 @@
height = 10.272 height = 10.272
radius = 2.56201 radius = 2.56201
[sub_resource type="Animation" id="Animation_c6ny3"]
resource_name = "fade_in"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("FLOWER:transparency")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [1.0, 0.0]
}
[sub_resource type="Animation" id="Animation_bw4xo"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("FLOWER:transparency")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [1.0]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_21qtc"]
_data = {
&"RESET": SubResource("Animation_bw4xo"),
&"fade_in": SubResource("Animation_c6ny3")
}
[sub_resource type="CylinderShape3D" id="CylinderShape3D_21qtc"]
height = 20.9375
radius = 5.50684
[node name="Sarco" type="Node3D"] [node name="Sarco" type="Node3D"]
transform = Transform3D(0.595, 0, 0, 0, 0.595, 0, 0, 0, 0.595, 0, 0, 0) transform = Transform3D(0.595, 0, 0, 0, 0.595, 0, 0, 0, 0.595, 0, 0, 0)
script = ExtResource("1_bw4xo")
Dialogue = ExtResource("2_21qtc")
[node name="sarco altar" parent="." instance=ExtResource("1_35fk8")] [node name="sarco altar" parent="." instance=ExtResource("1_35fk8")]
@@ -23,6 +67,30 @@ shape = SubResource("CylinderShape3D_bw4xo")
[node name="FLOWER" type="Sprite3D" parent="."] [node name="FLOWER" type="Sprite3D" parent="."]
transform = Transform3D(0.299972, -0.253855, 0.309151, -0.212973, 0.225749, 0.39202, -0.338614, -0.366872, 0.0273082, 2.43807, 2.21512, 0.0190778) transform = Transform3D(0.299972, -0.253855, 0.309151, -0.212973, 0.225749, 0.39202, -0.338614, -0.366872, 0.0273082, 2.43807, 2.21512, 0.0190778)
visible = false transparency = 1.0
shaded = true shaded = true
texture = ExtResource("3_c6ny3") texture = ExtResource("3_c6ny3")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
unique_name_in_owner = true
libraries = {
&"": SubResource("AnimationLibrary_21qtc")
}
[node name="InteractZone" type="Area3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.273779, 0, 0)
collision_layer = 2
collision_mask = 2
[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractZone"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00627998, 1.69336, -0.00723076)
shape = SubResource("CylinderShape3D_21qtc")
[node name="Prompt" type="Control" parent="."]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
@@ -0,0 +1,11 @@
~ general
Acquired {{AffinityString}} sigil.
do ShowFlower()
- Equip now.
do EquipAffinity()
{{AffinityString}} sigil equipped.
do Finish()
=> END
- Do not equip.
do Finish()
=> END
@@ -0,0 +1,16 @@
[remap]
importer="dialogue_manager"
importer_version=15
type="Resource"
uid="uid://d2s0mmg453n5f"
path="res://.godot/imported/sarco.dialogue-b3046780591777465058b493c5c5a670.tres"
[deps]
source_file="res://src/map/Placeables/sarco.dialogue"
dest_files=["res://.godot/imported/sarco.dialogue-b3046780591777465058b493c5c5a670.tres"]
[params]
defaults=true
@@ -35,11 +35,11 @@
[ext_resource type="Texture2D" uid="uid://co3s2s5tswuj4" path="res://src/map/overworld/Overworld Fixes Models/Overworld Reexport Fixes_MOSAIC.png" id="30_6gklp"] [ext_resource type="Texture2D" uid="uid://co3s2s5tswuj4" path="res://src/map/overworld/Overworld Fixes Models/Overworld Reexport Fixes_MOSAIC.png" id="30_6gklp"]
[ext_resource type="Texture2D" uid="uid://pu4o1pwi6hnf" path="res://src/map/overworld/Overworld Fixes Models/Overworld Reexport Fixes_rock_outside_colored_CORRECTED1.png" id="31_kdqo4"] [ext_resource type="Texture2D" uid="uid://pu4o1pwi6hnf" path="res://src/map/overworld/Overworld Fixes Models/Overworld Reexport Fixes_rock_outside_colored_CORRECTED1.png" id="31_kdqo4"]
[ext_resource type="PackedScene" uid="uid://r5d74jsx8tq6" path="res://src/map/Placeables/Stele B.tscn" id="32_xqf5a"] [ext_resource type="PackedScene" uid="uid://r5d74jsx8tq6" path="res://src/map/Placeables/Stele B.tscn" id="32_xqf5a"]
[ext_resource type="AudioStream" uid="uid://60hn13ryqn88" path="res://src/audio/amb/amb_perlin.ogg" id="49_xqf5a"] [ext_resource type="AudioStream" uid="uid://60hn13ryqn88" path="res://src/audio/AMB/amb_perlin.ogg" id="49_xqf5a"]
[ext_resource type="AudioStream" uid="uid://db0e4p4b11tyf" path="res://src/audio/amb/amb_beach.ogg" id="51_v60tm"] [ext_resource type="AudioStream" uid="uid://db0e4p4b11tyf" path="res://src/audio/AMB/amb_beach.ogg" id="51_v60tm"]
[ext_resource type="AudioStream" uid="uid://b7g0tnn43an8" path="res://src/audio/amb/amb_white_noise.ogg" id="52_o5pdk"] [ext_resource type="AudioStream" uid="uid://b7g0tnn43an8" path="res://src/audio/AMB/amb_white_noise.ogg" id="52_o5pdk"]
[ext_resource type="AudioStream" uid="uid://b5vhghigr263m" path="res://src/audio/amb/amb_ATMOSTPHERE.ogg" id="53_v60tm"] [ext_resource type="AudioStream" uid="uid://b5vhghigr263m" path="res://src/audio/AMB/amb_ATMOSTPHERE.ogg" id="53_v60tm"]
[ext_resource type="AudioStream" uid="uid://d3uj87dsngy22" path="res://src/audio/amb/amb_water_lapping2.ogg" id="53_xqf5a"] [ext_resource type="AudioStream" uid="uid://d3uj87dsngy22" path="res://src/audio/AMB/amb_water_lapping2.ogg" id="53_xqf5a"]
[ext_resource type="PackedScene" uid="uid://dqjovmlt1y4tb" path="res://src/map/Placeables/Sarco.tscn" id="59_mic3u"] [ext_resource type="PackedScene" uid="uid://dqjovmlt1y4tb" path="res://src/map/Placeables/Sarco.tscn" id="59_mic3u"]
[ext_resource type="PackedScene" uid="uid://doncarj3f8iua" path="res://src/vfx/Torch.tscn" id="60_xqf5a"] [ext_resource type="PackedScene" uid="uid://doncarj3f8iua" path="res://src/vfx/Torch.tscn" id="60_xqf5a"]
[ext_resource type="PackedScene" uid="uid://b3owhc620qisb" path="res://src/map/Placeables/Stele A.tscn" id="61_v60tm"] [ext_resource type="PackedScene" uid="uid://b3owhc620qisb" path="res://src/map/Placeables/Stele A.tscn" id="61_v60tm"]
@@ -2749,6 +2749,7 @@ parameters/looping = true
script = ExtResource("66_q7hpd") script = ExtResource("66_q7hpd")
[node name="Water Lapping" type="AudioStreamPlayer3D" parent="Audio/DimmableAudio"] [node name="Water Lapping" type="AudioStreamPlayer3D" parent="Audio/DimmableAudio"]
process_mode = 3
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -101.693, 4.56576, 0.425669) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -101.693, 4.56576, 0.425669)
stream = ExtResource("53_xqf5a") stream = ExtResource("53_xqf5a")
volume_db = -7.143 volume_db = -7.143
@@ -2760,6 +2761,7 @@ bus = &"AMBIENT"
parameters/looping = true parameters/looping = true
[node name="Water Lapping2" type="AudioStreamPlayer3D" parent="Audio/DimmableAudio"] [node name="Water Lapping2" type="AudioStreamPlayer3D" parent="Audio/DimmableAudio"]
process_mode = 3
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -109.458, 4.56576, -39.2783) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -109.458, 4.56576, -39.2783)
stream = ExtResource("53_xqf5a") stream = ExtResource("53_xqf5a")
volume_db = -7.143 volume_db = -7.143
@@ -2771,11 +2773,14 @@ bus = &"AMBIENT"
parameters/looping = true parameters/looping = true
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="Audio/DimmableAudio"] [node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="Audio/DimmableAudio"]
process_mode = 3
stream = ExtResource("53_v60tm") stream = ExtResource("53_v60tm")
autoplay = true autoplay = true
bus = &"AMBIENT"
parameters/looping = true parameters/looping = true
[node name="Ocean4" type="AudioStreamPlayer" parent="Audio/DimmableAudio"] [node name="Ocean4" type="AudioStreamPlayer" parent="Audio/DimmableAudio"]
process_mode = 3
stream = ExtResource("51_v60tm") stream = ExtResource("51_v60tm")
volume_db = -19.067 volume_db = -19.067
autoplay = true autoplay = true
@@ -3012,6 +3017,10 @@ transform = Transform3D(0.921192, 0.0644309, 0.329915, -0.635509, 0.0745904, 0.4
mesh = SubResource("ArrayMesh_pxsmp") mesh = SubResource("ArrayMesh_pxsmp")
skeleton = NodePath("") skeleton = NodePath("")
[node name="Sarco2" parent="." instance=ExtResource("59_mic3u")]
transform = Transform3D(-0.561658, 0, -0.196382, 0, 0.595, 0, 0.196382, 0, -0.561658, -328.661, 2.6811, 27.9079)
Affinity = 4
[editable path="Node3D/Overworld Re-Scaled (Missing Distance Objects)"] [editable path="Node3D/Overworld Re-Scaled (Missing Distance Objects)"]
[editable path="Actors/Rat"] [editable path="Actors/Rat"]
[editable path="Actors/Clalo"] [editable path="Actors/Clalo"]
+2
View File
@@ -344,6 +344,8 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
if (AutoRevive) if (AutoRevive)
return; return;
SetSigil(new Sigil() { ElementType = ElementType.None });
HealthTimer.WaitTime = _healthTimerWaitTime; HealthTimer.WaitTime = _healthTimerWaitTime;
HealthTimer.Timeout -= OnHealthTimerTimeout; HealthTimer.Timeout -= OnHealthTimerTimeout;
SetProcessInput(false); SetProcessInput(false);
@@ -85,6 +85,9 @@ public partial class InventoryMenu : Control, IInventoryMenu
public override void _Input(InputEvent @event) public override void _Input(InputEvent @event)
{ {
if (!Visible)
return;
if (_blocking) if (_blocking)
{ {
GetViewport().SetInputAsHandled(); GetViewport().SetInputAsHandled();