Make key items (flower and key staff)

Implement fog door for unlockable doors
This commit is contained in:
2026-06-16 00:01:49 -07:00
parent 3e1ad0d0cb
commit d4a27f6d4d
37 changed files with 640 additions and 394 deletions
@@ -202,3 +202,23 @@ public class RevivePlayerAugment : IAugmentType
_player.AutoRevive = false; _player.AutoRevive = false;
} }
} }
public class KeyStaffAugment : IAugmentType
{
private readonly IPlayer _player;
public KeyStaffAugment(IPlayer player)
{
_player = player;
}
public void Apply()
{
_player.CanOpenDoors = true;
}
public void Remove()
{
_player.CanOpenDoors &= false;
}
}
@@ -17,5 +17,6 @@ public enum JewelTags
ReviveUserOnce, ReviveUserOnce,
TelluricElement, TelluricElement,
IncreaseAtkDefLuck, IncreaseAtkDefLuck,
IncreaseLuck IncreaseLuck,
KeyStaff
} }
@@ -78,6 +78,8 @@ public interface IPlayer : IKillable, ICharacterBody3D
public bool BriefImmunity { get; set; } public bool BriefImmunity { get; set; }
public bool CanOpenDoors { get; set; }
public event Action PlayerDied; public event Action PlayerDied;
public delegate IBaseInventoryItem RerollItem(IBaseInventoryItem item); public delegate IBaseInventoryItem RerollItem(IBaseInventoryItem item);
} }
+10 -1
View File
@@ -94,7 +94,8 @@ public partial class Inventory : Node, IInventory
var jewelItems = listToSort.Where(x => x is Jewel).OrderBy(x => x as Jewel, new JewelComparer()); var jewelItems = listToSort.Where(x => x is Jewel).OrderBy(x => x as Jewel, new JewelComparer());
var setItems = listToSort.Where(x => x is Plastique).OrderBy(x => x as SetItem, new SetItemComparer()); var setItems = listToSort.Where(x => x is Plastique).OrderBy(x => x as SetItem, new SetItemComparer());
var boxItems = listToSort.Where(x => x is BoxItem).OrderBy(x => x as BoxItem, new BoxItemComparer()); var boxItems = listToSort.Where(x => x is BoxItem).OrderBy(x => x as BoxItem, new BoxItemComparer());
Items = [.. equippedItems, .. weapons, .. armor, .. accessories, .. ammo, .. consumables, .. throwables, .. effectItems, .. jewelItems, .. boxItems, .. setItems]; var keyItems = listToSort.Where(x => x is KeyItem).OrderBy(x => x as KeyItem, new KeyItemComparer());
Items = [.. equippedItems, .. weapons, .. armor, .. accessories, .. ammo, .. consumables, .. throwables, .. effectItems, .. jewelItems, .. boxItems, .. setItems, .. keyItems];
var stackableItems = Items.OfType<IStackable>(); var stackableItems = Items.OfType<IStackable>();
var itemsToStack = stackableItems.GroupBy(x => ((IBaseInventoryItem)x).ItemName).Where(x => x.Count() > 1); var itemsToStack = stackableItems.GroupBy(x => ((IBaseInventoryItem)x).ItemName).Where(x => x.Count() > 1);
@@ -172,6 +173,14 @@ public partial class Inventory : Node, IInventory
} }
} }
public class KeyItemComparer : IComparer<KeyItem>
{
public int Compare(KeyItem x, KeyItem y)
{
return x.ItemName.CompareTo(y.ItemName);
}
}
public class ConsumableComparer : IComparer<ConsumableItem> public class ConsumableComparer : IComparer<ConsumableItem>
{ {
public int Compare(ConsumableItem x, ConsumableItem y) public int Compare(ConsumableItem x, ConsumableItem y)
@@ -71,6 +71,7 @@ public class ItemDatabase
var boxResources = DirAccess.GetFilesAt("res://src/items/box/resources/"); var boxResources = DirAccess.GetFilesAt("res://src/items/box/resources/");
var ammoResources = DirAccess.GetFilesAt("res://src/items/ammo/resources/"); var ammoResources = DirAccess.GetFilesAt("res://src/items/ammo/resources/");
var jewelResources = DirAccess.GetFilesAt("res://src/items/jewels/resources/"); var jewelResources = DirAccess.GetFilesAt("res://src/items/jewels/resources/");
var keyResources = DirAccess.GetFilesAt("res://src/items/key/resources/");
foreach (var armor in armorResources) foreach (var armor in armorResources)
{ {
@@ -156,6 +157,15 @@ public class ItemDatabase
database.Add(jewelItemScene); database.Add(jewelItemScene);
} }
foreach (var keyItem in keyResources)
{
var keyItemInfo = GD.Load<KeyItemStats>($"res://src/items/key/resources/{keyItem}".TrimSuffix(".remap"));
var keyItemScene = ResourceLoader.Load<PackedScene>("res://src/items/key/KeyItem.tscn").Instantiate<KeyItem>();
keyItemScene.Stats = keyItemInfo;
if (!database.Contains(keyItemScene))
database.Add(keyItemScene);
}
Items = [.. database]; Items = [.. database];
} }
} }
@@ -3,7 +3,6 @@ using Chickensoft.Collections;
using Chickensoft.Introspection; using Chickensoft.Introspection;
using Chickensoft.Serialization; using Chickensoft.Serialization;
using Godot; using Godot;
using System.Collections.Generic;
using Zennysoft.Game.Abstractions; using Zennysoft.Game.Abstractions;
using Zennysoft.Game.Implementation; using Zennysoft.Game.Implementation;
using Zennysoft.Ma.Adapter; using Zennysoft.Ma.Adapter;
@@ -1,7 +1,6 @@
using Chickensoft.Introspection; using Chickensoft.Introspection;
using Chickensoft.Serialization; using Chickensoft.Serialization;
using Godot; using Godot;
using Zennysoft.Game.Implementation;
using Zennysoft.Ma.Adapter; using Zennysoft.Ma.Adapter;
namespace Zennysoft.Game.Ma; namespace Zennysoft.Game.Ma;
@@ -0,0 +1,11 @@
using Chickensoft.Introspection;
using Godot;
namespace Zennysoft.Game.Ma;
[GlobalClass]
[Meta, Id("key_item_stats")]
public partial class KeyItemStats : InventoryItemStats
{
}
@@ -0,0 +1 @@
uid://bq5g6pllsvh0h
@@ -0,0 +1,66 @@
[gd_resource type="Resource" script_class="JewelStats" load_steps=5 format=3 uid="uid://co8yjgx1s7c2w"]
[ext_resource type="Script" uid="uid://c4hhsqjy3qknn" path="res://src/map/FloorSpawnTable.cs" id="1_0gbxu"]
[ext_resource type="Texture2D" uid="uid://cdgqd574geekd" path="res://src/items/jewels/texture/keystafffd.png" id="2_0gbxu"]
[ext_resource type="Script" uid="uid://btikba31yb0tl" path="res://src/items/jewels/JewelStats.cs" id="3_p7eda"]
[sub_resource type="Resource" id="Resource_8i8u4"]
script = ExtResource("1_0gbxu")
Altar = true
Floor01 = true
Floor02 = true
Floor03 = true
Floor04 = true
Floor05 = true
Floor06 = true
Floor07 = true
Floor09 = true
Floor10 = true
Floor11 = true
Floor12 = true
Floor13 = true
Floor14 = true
Floor15 = true
BossFloorA = false
BossFloorB = false
River = false
Server = false
Platform = false
Grassland = false
Cellular = false
GoddessOfGuidance = false
TrueGoddessOfGuidance = false
FinalFloor = false
BadEnd = false
HeartOfAllThings = false
[resource]
script = ExtResource("3_p7eda")
JewelTag = 17
WeaponAugmentDescription = ""
ArmorAugmentDescription = ""
Name = "Key Staff"
StatDescription = "Opens key doors. Automatically returns to surface.
Cannot augment armor or masks."
FlavorText = "A grant of responsibility.
"
BonusAttack = 0
BonusDefense = 0
BonusLuck = 0
BonusHP = 0
BonusVT = 0
AeolicResistance = 0
TelluricResistance = 0
HydricResistance = 0
IgneousResistance = 0
FerrumResistance = 0
HolyResistance = 0
CurseResistance = 0
ThrowSpeed = 12.0
ThrowDamage = 5
ItemTag = 0
Texture = ExtResource("2_0gbxu")
RarityTag = 4
SpawnRate = 0.0
SpawnsOn = SubResource("Resource_8i8u4")
metadata/_custom_type_script = "uid://btikba31yb0tl"

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

@@ -0,0 +1,43 @@
using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using Chickensoft.Serialization;
using Godot;
using Zennysoft.Game.Abstractions;
using Zennysoft.Game.Ma;
using Zennysoft.Ma.Adapter;
[Meta(typeof(IAutoNode)), Id("key_item")]
public partial class KeyItem : Node3D, IBaseInventoryItem
{
public override void _Notification(int what) => this.Notify(what);
[Node] private Sprite3D _sprite { get; set; } = default!;
public override void _Ready()
{
_sprite.Texture = Stats.Texture;
}
public string ItemName => Stats.Name;
public string StatDescription => Stats.StatDescription;
public string FlavorText => Stats.FlavorText;
public float BaseRarity => Stats.SpawnRate;
public int ThrowDamage => Stats.ThrowDamage;
public float ThrowSpeed => Stats.ThrowSpeed;
public ItemTag ItemTag => ItemTag.KeyItem;
[Export]
[Save("key_item_stats")]
public InventoryItemStats Stats { get; set; } = new KeyItemStats();
public Texture2D GetTexture() => Stats.Texture;
public RarityTag RarityTag => Stats.RarityTag;
public float SpawnRate => Stats.SpawnRate;
public IFloorSpawnTable SpawnsOn => Stats.SpawnsOn;
}
@@ -0,0 +1 @@
uid://dnym3raxjl0po
@@ -0,0 +1,77 @@
[gd_scene load_steps=4 format=3 uid="uid://dj4kqgxp2upr"]
[ext_resource type="Script" uid="uid://dnym3raxjl0po" path="res://src/items/key/KeyItem.cs" id="1_708ca"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_ndnym"]
height = 0.725098
[sub_resource type="BoxShape3D" id="BoxShape3D_708ca"]
size = Vector3(0.778381, 0.929947, 0.731567)
[node name="KeyItem" type="RigidBody3D"]
collision_layer = 0
axis_lock_linear_x = true
axis_lock_linear_z = true
axis_lock_angular_x = true
axis_lock_angular_y = true
axis_lock_angular_z = true
script = ExtResource("1_708ca")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.00908482, 0)
shape = SubResource("CylinderShape3D_ndnym")
[node name="Pickup" type="Area3D" parent="."]
unique_name_in_owner = true
collision_layer = 4
collision_mask = 0
[node name="CollisionShape3D" type="CollisionShape3D" parent="Pickup"]
shape = SubResource("BoxShape3D_708ca")
[node name="Sprite" type="Sprite3D" parent="Pickup"]
unique_name_in_owner = true
transform = Transform3D(0.999973, 0.00489444, -0.00548299, -0.00488109, 0.999985, 0.00244357, 0.00549488, -0.00241672, 0.999982, 0, 0, 0)
layers = 9
pixel_size = 0.005
billboard = 2
shaded = true
texture_filter = 0
render_priority = 100
[node name="SpotLight3D" type="SpotLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.366956, 0.930238, 0, -0.930238, 0.366956, 0, 1.28212, 0.771256)
light_energy = 0.25
light_indirect_energy = 0.0
light_cull_mask = 8
distance_fade_enabled = true
distance_fade_begin = 10.0
spot_range = 4.0
[node name="SpotLight3D2" type="SpotLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, -0.534057, 0.845448, 0, -0.845448, -0.534057, -0.19446, 1.49007, -1.0422)
light_energy = 0.25
light_indirect_energy = 0.0
light_bake_mode = 0
light_cull_mask = 8
distance_fade_enabled = true
distance_fade_begin = 10.0
spot_range = 4.0
[node name="SpotLight3D3" type="SpotLight3D" parent="."]
transform = Transform3D(0.619848, -0.663442, -0.419086, 0, -0.534057, 0.845448, -0.784722, -0.524049, -0.331034, -0.904801, 1.28212, -0.393992)
light_energy = 0.25
light_indirect_energy = 0.0
light_cull_mask = 8
distance_fade_enabled = true
distance_fade_begin = 10.0
spot_range = 4.0
[node name="SpotLight3D4" type="SpotLight3D" parent="."]
transform = Transform3D(-0.0257408, 0.845168, 0.53388, 1.84729e-08, -0.534057, 0.845448, 0.999669, 0.0217625, 0.013747, 0.8955, 1.41022, -0.00555617)
light_energy = 0.25
light_indirect_energy = 0.0
light_cull_mask = 8
distance_fade_enabled = true
distance_fade_begin = 10.0
spot_range = 4.0
@@ -0,0 +1,62 @@
[gd_resource type="Resource" script_class="KeyItemStats" load_steps=5 format=3 uid="uid://bqcw5x7dxjya"]
[ext_resource type="Script" uid="uid://c4hhsqjy3qknn" path="res://src/map/FloorSpawnTable.cs" id="1_cme2b"]
[ext_resource type="Texture2D" uid="uid://cqcjbeoghy70" path="res://src/items/key/textures/Flower.png" id="2_nt264"]
[ext_resource type="Script" uid="uid://bq5g6pllsvh0h" path="res://src/items/effect/KeyItemStats.cs" id="2_ug7yh"]
[sub_resource type="Resource" id="Resource_cme2b"]
script = ExtResource("1_cme2b")
Altar = true
Floor01 = true
Floor02 = true
Floor03 = true
Floor04 = true
Floor05 = true
Floor06 = true
Floor07 = true
Floor09 = true
Floor10 = true
Floor11 = true
Floor12 = true
Floor13 = true
Floor14 = true
Floor15 = true
BossFloorA = false
BossFloorB = false
River = false
Server = false
Platform = false
Grassland = false
Cellular = false
GoddessOfGuidance = false
TrueGoddessOfGuidance = false
FinalFloor = false
BadEnd = false
HeartOfAllThings = false
[resource]
script = ExtResource("2_ug7yh")
Name = "Flower"
StatDescription = ""
FlavorText = "A sign of remembrance and respect.
Any may take up the torch of grief and carry on the will of devotion."
BonusAttack = 0
BonusDefense = 0
BonusLuck = 0
BonusHP = 0
BonusVT = 0
AeolicResistance = 0
TelluricResistance = 0
HydricResistance = 0
IgneousResistance = 0
FerrumResistance = 0
HolyResistance = 0
CurseResistance = 0
ThrowSpeed = 0.0
ThrowDamage = 0
ItemTag = 22
Texture = ExtResource("2_nt264")
RarityTag = 4
SpawnRate = 0.0
SpawnsOn = SubResource("Resource_cme2b")
metadata/_custom_type_script = "uid://bq5g6pllsvh0h"

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

@@ -1,35 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cqcjbeoghy70"
path.bptc="res://.godot/imported/Flower.png-7075f69b770a0b55b17651a1d2f6c42b.bptc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://src/items/special/textures/Flower.png"
dest_files=["res://.godot/imported/Flower.png-7075f69b770a0b55b17651a1d2f6c42b.bptc.ctex"]
[params]
compress/mode=2
compress/high_quality=true
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0
@@ -1,35 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cdgqd574geekd"
path.bptc="res://.godot/imported/keystafffd.png-347b1fa801a359064c8db04e790936fc.bptc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://src/items/special/textures/keystafffd.png"
dest_files=["res://.godot/imported/keystafffd.png-347b1fa801a359064c8db04e790936fc.bptc.ctex"]
[params]
compress/mode=2
compress/high_quality=true
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0
@@ -4,7 +4,7 @@
[ext_resource type="Script" uid="uid://cn27rfw6olqaf" path="res://src/map/Placeables/Sarco.cs" id="1_bw4xo"] [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="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/key/textures/Flower.png" id="3_c6ny3"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_bw4xo"] [sub_resource type="CylinderShape3D" id="CylinderShape3D_bw4xo"]
height = 10.272 height = 10.272
@@ -3,7 +3,7 @@
[ext_resource type="Texture2D" uid="uid://dcodsa21o3syb" path="res://src/map/assets/Steles/Steles_C024_C.jpg" id="1_o7s11"] [ext_resource type="Texture2D" uid="uid://dcodsa21o3syb" path="res://src/map/assets/Steles/Steles_C024_C.jpg" id="1_o7s11"]
[ext_resource type="Script" uid="uid://bee0bhxtd4r8s" path="res://src/npc/Stele.cs" id="1_xkojd"] [ext_resource type="Script" uid="uid://bee0bhxtd4r8s" path="res://src/npc/Stele.cs" id="1_xkojd"]
[ext_resource type="Texture2D" uid="uid://c8nvb5jn8f6k1" path="res://src/map/assets/Steles/Steles_Untitled-1.png" id="2_u6crp"] [ext_resource type="Texture2D" uid="uid://c8nvb5jn8f6k1" path="res://src/map/assets/Steles/Steles_Untitled-1.png" id="2_u6crp"]
[ext_resource type="Texture2D" uid="uid://cqcjbeoghy70" path="res://src/items/special/textures/Flower.png" id="4_xkojd"] [ext_resource type="Texture2D" uid="uid://cqcjbeoghy70" path="res://src/items/key/textures/Flower.png" id="4_xkojd"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ul40e"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ul40e"]
resource_name = "Material.008" resource_name = "Material.008"
@@ -4,7 +4,7 @@
[ext_resource type="Texture2D" uid="uid://35g2bx4vh3wd" path="res://src/map/assets/Steles/Steles_IMG0031.png" id="1_6obim"] [ext_resource type="Texture2D" uid="uid://35g2bx4vh3wd" path="res://src/map/assets/Steles/Steles_IMG0031.png" id="1_6obim"]
[ext_resource type="Texture2D" uid="uid://c8nvb5jn8f6k1" path="res://src/map/assets/Steles/Steles_Untitled-1.png" id="2_ochsp"] [ext_resource type="Texture2D" uid="uid://c8nvb5jn8f6k1" path="res://src/map/assets/Steles/Steles_Untitled-1.png" id="2_ochsp"]
[ext_resource type="Texture2D" uid="uid://bwelhd4sx7mkw" path="res://src/map/assets/Steles/Steles_COPPEROX.jpg" id="3_4nuqd"] [ext_resource type="Texture2D" uid="uid://bwelhd4sx7mkw" path="res://src/map/assets/Steles/Steles_COPPEROX.jpg" id="3_4nuqd"]
[ext_resource type="Texture2D" uid="uid://cqcjbeoghy70" path="res://src/items/special/textures/Flower.png" id="5_4nuqd"] [ext_resource type="Texture2D" uid="uid://cqcjbeoghy70" path="res://src/items/key/textures/Flower.png" id="5_4nuqd"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_rgye3"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_rgye3"]
resource_name = "Material.003" resource_name = "Material.003"
@@ -4,7 +4,7 @@
[ext_resource type="Texture2D" uid="uid://35g2bx4vh3wd" path="res://src/map/assets/Steles/Steles_IMG0031.png" id="1_mtjg5"] [ext_resource type="Texture2D" uid="uid://35g2bx4vh3wd" path="res://src/map/assets/Steles/Steles_IMG0031.png" id="1_mtjg5"]
[ext_resource type="Texture2D" uid="uid://br8l5h7n6t41d" path="res://src/map/assets/Steles/Steles_eye.png" id="2_t14ca"] [ext_resource type="Texture2D" uid="uid://br8l5h7n6t41d" path="res://src/map/assets/Steles/Steles_eye.png" id="2_t14ca"]
[ext_resource type="Texture2D" uid="uid://c8nvb5jn8f6k1" path="res://src/map/assets/Steles/Steles_Untitled-1.png" id="3_1uk4s"] [ext_resource type="Texture2D" uid="uid://c8nvb5jn8f6k1" path="res://src/map/assets/Steles/Steles_Untitled-1.png" id="3_1uk4s"]
[ext_resource type="Texture2D" uid="uid://cqcjbeoghy70" path="res://src/items/special/textures/Flower.png" id="5_1uk4s"] [ext_resource type="Texture2D" uid="uid://cqcjbeoghy70" path="res://src/items/key/textures/Flower.png" id="5_1uk4s"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_rgye3"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_rgye3"]
resource_name = "Material.003" resource_name = "Material.003"
@@ -5,7 +5,7 @@
[ext_resource type="Texture2D" uid="uid://dj2upntyeqryx" path="res://src/map/assets/Steles/Steles_COPPWIR.jpg" id="2_xe50d"] [ext_resource type="Texture2D" uid="uid://dj2upntyeqryx" path="res://src/map/assets/Steles/Steles_COPPWIR.jpg" id="2_xe50d"]
[ext_resource type="Texture2D" uid="uid://bwelhd4sx7mkw" path="res://src/map/assets/Steles/Steles_COPPEROX.jpg" id="3_q5wc4"] [ext_resource type="Texture2D" uid="uid://bwelhd4sx7mkw" path="res://src/map/assets/Steles/Steles_COPPEROX.jpg" id="3_q5wc4"]
[ext_resource type="Texture2D" uid="uid://c8nvb5jn8f6k1" path="res://src/map/assets/Steles/Steles_Untitled-1.png" id="4_fpef4"] [ext_resource type="Texture2D" uid="uid://c8nvb5jn8f6k1" path="res://src/map/assets/Steles/Steles_Untitled-1.png" id="4_fpef4"]
[ext_resource type="Texture2D" uid="uid://cqcjbeoghy70" path="res://src/items/special/textures/Flower.png" id="6_q5wc4"] [ext_resource type="Texture2D" uid="uid://cqcjbeoghy70" path="res://src/items/key/textures/Flower.png" id="6_q5wc4"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ul40e"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ul40e"]
resource_name = "Material.008" resource_name = "Material.008"
@@ -2,7 +2,7 @@
[ext_resource type="Texture2D" uid="uid://bwelhd4sx7mkw" path="res://src/map/assets/Steles/Steles_COPPEROX.jpg" id="1_2erh4"] [ext_resource type="Texture2D" uid="uid://bwelhd4sx7mkw" path="res://src/map/assets/Steles/Steles_COPPEROX.jpg" id="1_2erh4"]
[ext_resource type="Script" uid="uid://bee0bhxtd4r8s" path="res://src/npc/Stele.cs" id="1_yvxj1"] [ext_resource type="Script" uid="uid://bee0bhxtd4r8s" path="res://src/npc/Stele.cs" id="1_yvxj1"]
[ext_resource type="Texture2D" uid="uid://cqcjbeoghy70" path="res://src/items/special/textures/Flower.png" id="3_yvxj1"] [ext_resource type="Texture2D" uid="uid://cqcjbeoghy70" path="res://src/items/key/textures/Flower.png" id="3_yvxj1"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_f3mmc"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_f3mmc"]
resource_name = "Material.006" resource_name = "Material.006"
@@ -2,7 +2,7 @@
[ext_resource type="Texture2D" uid="uid://br0vjonsyq32m" path="res://src/map/assets/Steles/Steles_ALUMPLAT.jpg" id="1_hc3bc"] [ext_resource type="Texture2D" uid="uid://br0vjonsyq32m" path="res://src/map/assets/Steles/Steles_ALUMPLAT.jpg" id="1_hc3bc"]
[ext_resource type="Script" uid="uid://bee0bhxtd4r8s" path="res://src/npc/Stele.cs" id="1_y65cn"] [ext_resource type="Script" uid="uid://bee0bhxtd4r8s" path="res://src/npc/Stele.cs" id="1_y65cn"]
[ext_resource type="Texture2D" uid="uid://cqcjbeoghy70" path="res://src/items/special/textures/Flower.png" id="3_y65cn"] [ext_resource type="Texture2D" uid="uid://cqcjbeoghy70" path="res://src/items/key/textures/Flower.png" id="3_y65cn"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_a85ng"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_a85ng"]
resource_name = "Material.005" resource_name = "Material.005"
@@ -3,7 +3,7 @@
[ext_resource type="Script" uid="uid://bee0bhxtd4r8s" path="res://src/npc/Stele.cs" id="1_dkr3t"] [ext_resource type="Script" uid="uid://bee0bhxtd4r8s" path="res://src/npc/Stele.cs" id="1_dkr3t"]
[ext_resource type="Texture2D" uid="uid://35g2bx4vh3wd" path="res://src/map/assets/Steles/Steles_IMG0031.png" id="1_nj8pm"] [ext_resource type="Texture2D" uid="uid://35g2bx4vh3wd" path="res://src/map/assets/Steles/Steles_IMG0031.png" id="1_nj8pm"]
[ext_resource type="Texture2D" uid="uid://jdweu6rj63e5" path="res://src/map/assets/Steles/Steles_Swirld.png" id="2_ts7fn"] [ext_resource type="Texture2D" uid="uid://jdweu6rj63e5" path="res://src/map/assets/Steles/Steles_Swirld.png" id="2_ts7fn"]
[ext_resource type="Texture2D" uid="uid://cqcjbeoghy70" path="res://src/items/special/textures/Flower.png" id="4_dkr3t"] [ext_resource type="Texture2D" uid="uid://cqcjbeoghy70" path="res://src/items/key/textures/Flower.png" id="4_dkr3t"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_rgye3"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_rgye3"]
resource_name = "Material.003" resource_name = "Material.003"
+38 -4
View File
@@ -1,26 +1,60 @@
using Chickensoft.AutoInject; using Chickensoft.AutoInject;
using Chickensoft.Introspection; using Chickensoft.Introspection;
using Godot; using Godot;
using Zennysoft.Game.Ma;
using Zennysoft.Ma.Adapter;
[Meta(typeof(IAutoNode))] [Meta(typeof(IAutoNode))]
public partial class UnlockableDoor : Node3D, IDoor public partial class UnlockableDoor : Node3D, IDoor
{ {
public override void _Notification(int what) => this.Notify(what); public override void _Notification(int what) => this.Notify(what);
[Dependency] private IPlayer _player => this.DependOn<IPlayer>();
[Node] public Area3D UnlockArea { get; set; } [Node] public Area3D UnlockArea { get; set; }
[Node] public Area3D EnterArea { get; set; }
[Node] public CollisionShape3D CollisionShape3D { get; set; }
[Node] public Node3D FogDoor { get; set; }
[Node] public AnimationPlayer AnimationPlayer { get; set; }
private bool _playerInArea = false;
public void OnReady() public void OnReady()
{ {
UnlockArea.AreaEntered += UnlockArea_AreaEntered; UnlockArea.AreaEntered += UnlockArea_AreaEntered;
UnlockArea.AreaExited += UnlockArea_AreaExited;
EnterArea.AreaEntered += EnterArea_AreaEntered;
AnimationPlayer.AnimationFinished += AnimationPlayer_AnimationFinished;
} }
private void UnlockArea_AreaEntered(Area3D area) private void EnterArea_AreaEntered(Area3D area)
{ {
var children = GetChildren(); FogDoor.CallDeferred(MethodName.SetVisible, false);
foreach (var child in children)
child.QueueFree();
} }
private void AnimationPlayer_AnimationFinished(StringName animName)
{
if (animName == "unlock")
{
CollisionShape3D.SetDeferred(CollisionShape3D.PropertyName.Disabled, true);
AnimationPlayer.SetDeferred(AnimationPlayer.PropertyName.Active, false);
}
}
public override void _UnhandledInput(InputEvent @event)
{
if (_playerInArea && _player.CanOpenDoors && @event.IsActionPressed(GameInputs.Attack) && !AnimationPlayer.IsPlaying())
AnimationPlayer.Play("unlock");
}
private void UnlockArea_AreaExited(Area3D area) => _playerInArea = false;
private void UnlockArea_AreaEntered(Area3D area) => _playerInArea = true;
public void OnExitTree() public void OnExitTree()
{ {
UnlockArea.AreaEntered -= UnlockArea_AreaEntered; UnlockArea.AreaEntered -= UnlockArea_AreaEntered;
@@ -0,0 +1,25 @@
shader_type spatial;
render_mode unshaded, blend_mix;
uniform sampler2D depth_texture : hint_depth_texture;
uniform float hole_depth : hint_range(0.1, 10.0, 0.1) = 1.0;
void fragment() {
float depth = texture(depth_texture, SCREEN_UV).r;
float linear_depth = 1.0 / (depth * INV_PROJECTION_MATRIX[2].w + INV_PROJECTION_MATRIX[3].w);
linear_depth = linear_depth + VERTEX.z;
float fade = clamp(linear_depth / hole_depth, 0.0, 1.0);
ALBEDO = vec3(1.0);
ALPHA = fade;
}
@@ -0,0 +1 @@
uid://6vedw540l3p2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -29,6 +29,8 @@ public partial class DummyPlayer : CharacterBody3D, IPlayer
ISigilComponent IPlayer.SigilComponent => throw new NotImplementedException(); ISigilComponent IPlayer.SigilComponent => throw new NotImplementedException();
public bool CanOpenDoors { get; set; }
public event Action PlayerDied; public event Action PlayerDied;
public void Activate() => throw new NotImplementedException(); public void Activate() => throw new NotImplementedException();
+5
View File
@@ -77,6 +77,8 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
[Export(PropertyHint.Range, "1, 60, 1")] public double RustDuration { get; set; } = 30; [Export(PropertyHint.Range, "1, 60, 1")] public double RustDuration { get; set; } = 30;
[Export] public bool CanOpenDoors { get; set; } = false;
[Export] [Export]
private bool HealthTimerIsActive = false; private bool HealthTimerIsActive = false;
#endregion #endregion
@@ -518,6 +520,9 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
weapon.IncreaseLuck(25); weapon.IncreaseLuck(25);
weapon.Augment = new Augment(JewelTags.IncreaseLuck, new BasicAugment(), jewel.ItemName, jewel.Stats.WeaponAugmentDescription, jewel.GetTexture()); weapon.Augment = new Augment(JewelTags.IncreaseLuck, new BasicAugment(), jewel.ItemName, jewel.Stats.WeaponAugmentDescription, jewel.GetTexture());
break; break;
case JewelTags.KeyStaff:
weapon.Augment = new Augment(JewelTags.KeyStaff, new KeyStaffAugment(this), jewel.ItemName, jewel.Stats.WeaponAugmentDescription, jewel.GetTexture());
break;
} }
EquipmentComponent.UpdateEquipment(weapon); EquipmentComponent.UpdateEquipment(weapon);
} }
@@ -72,7 +72,12 @@ public partial class AugmentableItemsMenu : Control
foreach (var item in inventory) foreach (var item in inventory)
{ {
if (item is IAugmentableItem augmentable && augmentable.Augment == null) if (augmentingItem.ItemName == "Key Staff" && item is IWeapon weapon && weapon.Augment == null)
{
ItemSlots[slotIndex].SetItemToSlot(item);
ItemSlots[slotIndex++].EnableItem();
}
else if (augmentingItem.ItemName != "Key Staff" && item is IAugmentableItem augmentable && augmentable.Augment == null)
{ {
ItemSlots[slotIndex].SetItemToSlot(item); ItemSlots[slotIndex].SetItemToSlot(item);
ItemSlots[slotIndex++].EnableItem(); ItemSlots[slotIndex++].EnableItem();
@@ -300,6 +300,7 @@ public partial class InventoryMenu : Control, IInventoryMenu
Jewel => "Jewel", Jewel => "Jewel",
Plastique => "Explosive", Plastique => "Explosive",
ThrowableItem => "Dice", ThrowableItem => "Dice",
KeyItem => "Key item",
_ => "Unknown item type.", _ => "Unknown item type.",
}; };
} }
@@ -202,6 +202,7 @@ public partial class ItemRescueMenu : Control, IInventoryMenu
Jewel => "Jewel", Jewel => "Jewel",
Plastique => "Explosive", Plastique => "Explosive",
ThrowableItem => "Dice", ThrowableItem => "Dice",
KeyItem => "Key item",
_ => "Unknown item type.", _ => "Unknown item type.",
}; };
} }