Fix swapped names of SetItem and Plastique

Add plastique to debug menu spawn
Make plastique damage player
Make plastique deal double damage to demon wall
Fix prompt for setting vs using plastique
This commit is contained in:
2026-06-06 16:35:54 -07:00
parent 85e74821ad
commit 947d311f27
9 changed files with 1485 additions and 1470 deletions
+2 -2
View File
@@ -296,8 +296,8 @@ public partial class Game : Node3D, IGame
public void SetItem(IBaseInventoryItem item)
{
var setScene = GD.Load<PackedScene>("res://src/items/misc/SetItem.tscn");
var setItem = setScene.Instantiate<SetItem>();
var setScene = GD.Load<PackedScene>("res://src/items/misc/Plastique.tscn");
var setItem = setScene.Instantiate<Plastique>();
_map.AddChild(setItem);
setItem.Set();
_player.Inventory.Remove(item);
+3 -3
View File
@@ -92,7 +92,7 @@ public partial class Inventory : Node, IInventory
var throwables = listToSort.Where(x => x is ThrowableItem).OrderBy(x => x as ThrowableItem, new ThrowableComparer());
var effectItems = listToSort.Where(x => x is EffectItem).OrderBy(x => x as EffectItem, new EffectComparer());
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 Plastique, 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());
Items = [.. equippedItems, .. weapons, .. armor, .. accessories, .. ammo, .. consumables, .. throwables, .. effectItems, .. jewelItems, .. boxItems, .. setItems];
@@ -156,9 +156,9 @@ public partial class Inventory : Node, IInventory
}
}
public class SetItemComparer : IComparer<Plastique>
public class SetItemComparer : IComparer<SetItem>
{
public int Compare(Plastique x, Plastique y)
public int Compare(SetItem x, SetItem y)
{
return x.ItemName.CompareTo(y.ItemName);
}
@@ -150,6 +150,9 @@ public class ItemDatabase
database.Add(jewelItemScene);
}
var plastiqueScene = ResourceLoader.Load<PackedScene>("res://src/items/misc/SetItem.tscn").Instantiate<SetItem>();
database.Add(plastiqueScene);
Items = [.. database];
}
}
+50 -19
View File
@@ -1,39 +1,70 @@
using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using Chickensoft.Serialization;
using Godot;
using System;
using Zennysoft.Game.Ma;
using Zennysoft.Ma.Adapter;
using Zennysoft.Ma.Adapter.Entity;
[Meta(typeof(IAutoNode))]
public partial class Plastique : Node3D, IBaseInventoryItem
public partial class Plastique : RigidBody3D
{
public override void _Notification(int what) => this.Notify(what);
[Node] private Sprite3D _sprite { get; set; }
[Node] public AnimationTree AnimationTree { get; set; }
public string ItemName => Stats.Name;
[Node] public Area3D ExplosionArea { get; set; }
public string StatDescription => Stats.StatDescription;
[Dependency] public IPlayer Player => this.DependOn<IPlayer>();
public string FlavorText => Stats.FlavorText;
[Export] public int ExplosionDamage { get; set; } = 10;
public float SpawnRate => Stats.SpawnRate;
protected AnimationNodeStateMachinePlayback _stateMachine;
public int ThrowDamage => Stats.ThrowDamage;
protected readonly string _parametersPlayback = "parameters/playback";
public float ThrowSpeed => Stats.ThrowSpeed;
public ItemTag ItemTag => Stats.ItemTag;
public void OnResolved()
public void OnReady()
{
_sprite.Texture = Stats.Texture;
_stateMachine = (AnimationNodeStateMachinePlayback)AnimationTree.Get(_parametersPlayback);
ExplosionArea.AreaEntered += ExplosionArea_AreaEntered;
AnimationTree.AnimationFinished += AnimationTree_AnimationFinished;
}
public Texture2D GetTexture() => Stats.Texture;
[Export]
[Save("inventory_stats")]
public EffectItemStats Stats { get; set; } = new EffectItemStats();
private void AnimationTree_AnimationFinished(StringName animName)
{
if (animName == "explode")
QueueFree();
}
private void ExplosionArea_AreaEntered(Area3D area)
{
if (area.GetParent() is ExplodableWall wall)
wall.Demolish();
if (area.GetOwner() is DemonWall demonWall)
demonWall.HealthComponent.Damage(ExplosionDamage * 2, ElementType.Igneous);
else if (area.GetOwner() is IEnemy enemy)
enemy.HealthComponent.Damage(ExplosionDamage, ElementType.Igneous);
else if (area.GetOwner() is IPlayer player)
player.TakeDamage(new AttackData(ExplosionDamage, ElementType.Igneous));
}
public async void Set()
{
AddCollisionExceptionWith((Node)Player);
GlobalPosition = Player.GlobalPosition + Vector3.Up;
ApplyCentralImpulse(-Player.GlobalBasis.Z.Normalized() * 5.0f);
await ToSignal(GetTree().CreateTimer(1), "timeout");
Explode();
}
public void Explode()
{
_stateMachine.Travel("timer");
}
public void OnExitTree()
{
ExplosionArea.AreaEntered -= ExplosionArea_AreaEntered;
AnimationTree.AnimationFinished -= AnimationTree_AnimationFinished;
}
}
File diff suppressed because it is too large Load Diff
+20 -44
View File
@@ -1,63 +1,39 @@
using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using Chickensoft.Serialization;
using Godot;
using System;
using Zennysoft.Game.Ma;
using Zennysoft.Ma.Adapter;
using Zennysoft.Ma.Adapter.Entity;
[Meta(typeof(IAutoNode))]
public partial class SetItem : RigidBody3D
public partial class SetItem : Node3D, IBaseInventoryItem
{
public override void _Notification(int what) => this.Notify(what);
[Node] public AnimationTree AnimationTree { get; set; }
[Node] private Sprite3D _sprite { get; set; }
[Node] public Area3D ExplosionArea { get; set; }
public string ItemName => Stats.Name;
[Dependency] public IPlayer Player => this.DependOn<IPlayer>();
public string StatDescription => Stats.StatDescription;
protected AnimationNodeStateMachinePlayback _stateMachine;
public string FlavorText => Stats.FlavorText;
protected readonly string _parametersPlayback = "parameters/playback";
public float SpawnRate => Stats.SpawnRate;
public void OnReady()
public int ThrowDamage => Stats.ThrowDamage;
public float ThrowSpeed => Stats.ThrowSpeed;
public ItemTag ItemTag => Stats.ItemTag;
public void OnResolved()
{
_stateMachine = (AnimationNodeStateMachinePlayback)AnimationTree.Get(_parametersPlayback);
ExplosionArea.AreaEntered += ExplosionArea_AreaEntered;
AnimationTree.AnimationFinished += AnimationTree_AnimationFinished;
_sprite.Texture = Stats.Texture;
}
private void AnimationTree_AnimationFinished(StringName animName)
{
if (animName == "explode")
QueueFree();
}
public Texture2D GetTexture() => Stats.Texture;
private void ExplosionArea_AreaEntered(Area3D area)
{
if (area.GetParent() is ExplodableWall wall)
wall.Demolish();
if (area.GetOwner() is IEnemy enemy)
enemy.HealthComponent.Damage(10, ElementType.Igneous);
}
public async void Set()
{
AddCollisionExceptionWith((Node)Player);
GlobalPosition = Player.GlobalPosition + Vector3.Up;
ApplyCentralImpulse(-Player.GlobalBasis.Z.Normalized() * 5.0f);
await ToSignal(GetTree().CreateTimer(1), "timeout");
Explode();
}
public void Explode()
{
_stateMachine.Travel("timer");
}
public void OnExitTree()
{
ExplosionArea.AreaEntered -= ExplosionArea_AreaEntered;
AnimationTree.AnimationFinished -= AnimationTree_AnimationFinished;
}
[Export]
[Save("inventory_stats")]
public EffectItemStats Stats { get; set; } = new EffectItemStats();
}
File diff suppressed because it is too large Load Diff
@@ -5,7 +5,7 @@
[ext_resource type="PackedScene" uid="uid://dn5546yqyntfr" path="res://src/map/dungeon/rooms/Set A/10. Item Transfer Room.tscn" id="2_502ht"]
[ext_resource type="PackedScene" uid="uid://drasshmo7ntqc" path="res://src/map/dungeon/rooms/Special Rooms/Breakable Wall Room.tscn" id="3_20m80"]
[ext_resource type="PackedScene" uid="uid://cihbmyo0ltq4m" path="res://src/map/dungeon/rooms/Set A/19. Floor Exit A.tscn" id="4_nm3ab"]
[ext_resource type="PackedScene" uid="uid://6ca5oildpf3n" path="res://src/items/misc/Plastique.tscn" id="5_o11y8"]
[ext_resource type="PackedScene" uid="uid://6ca5oildpf3n" path="res://src/items/misc/SetItem.tscn" id="5_o11y8"]
[ext_resource type="PackedScene" uid="uid://h1ijbjf7p462" path="res://src/map/dungeon/corridors/A1 - Corridor - Corner .tscn" id="5_xx18x"]
[ext_resource type="PackedScene" uid="uid://8qyob3r6geey" path="res://src/map/dungeon/corridors/A1 - Corridor - 1 Block.tscn" id="6_5nybr"]
[ext_resource type="PackedScene" uid="uid://d03tsdfy0bxf7" path="res://src/map/dungeon/corridors/A1 - Corridor - T-Block.tscn" id="7_e0v1c"]
@@ -138,6 +138,11 @@ public partial class ActionPanel : Panel
InteractButton.Text = "Augment";
}
private void SetOptionsInternal(SetItem setItem)
{
InteractButton.Text = "Set";
}
private void SetOptionsInternal(ThrowableItem equipable)
{
InteractButton.Text = string.Empty;
@@ -175,10 +180,10 @@ public partial class ActionPanel : Panel
ActionPanelClosing?.Invoke();
}
private void PerformAction(Plastique plastique)
private void PerformAction(SetItem setItem)
{
SfxDatabase.Instance.Play(SoundEffect.SelectUI);
_game.SetItem(plastique);
_game.SetItem(setItem);
_currentlySelected = null;
ActionPanelClosing?.Invoke();
ReturnToGameAction?.Invoke();