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:
@@ -296,8 +296,8 @@ public partial class Game : Node3D, IGame
|
|||||||
|
|
||||||
public void SetItem(IBaseInventoryItem item)
|
public void SetItem(IBaseInventoryItem item)
|
||||||
{
|
{
|
||||||
var setScene = GD.Load<PackedScene>("res://src/items/misc/SetItem.tscn");
|
var setScene = GD.Load<PackedScene>("res://src/items/misc/Plastique.tscn");
|
||||||
var setItem = setScene.Instantiate<SetItem>();
|
var setItem = setScene.Instantiate<Plastique>();
|
||||||
_map.AddChild(setItem);
|
_map.AddChild(setItem);
|
||||||
setItem.Set();
|
setItem.Set();
|
||||||
_player.Inventory.Remove(item);
|
_player.Inventory.Remove(item);
|
||||||
|
|||||||
@@ -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 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 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 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());
|
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];
|
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);
|
return x.ItemName.CompareTo(y.ItemName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,6 +150,9 @@ public class ItemDatabase
|
|||||||
database.Add(jewelItemScene);
|
database.Add(jewelItemScene);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var plastiqueScene = ResourceLoader.Load<PackedScene>("res://src/items/misc/SetItem.tscn").Instantiate<SetItem>();
|
||||||
|
database.Add(plastiqueScene);
|
||||||
|
|
||||||
Items = [.. database];
|
Items = [.. database];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,39 +1,70 @@
|
|||||||
using Chickensoft.AutoInject;
|
using Chickensoft.AutoInject;
|
||||||
using Chickensoft.Introspection;
|
using Chickensoft.Introspection;
|
||||||
using Chickensoft.Serialization;
|
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using System;
|
||||||
using Zennysoft.Game.Ma;
|
using Zennysoft.Game.Ma;
|
||||||
using Zennysoft.Ma.Adapter;
|
using Zennysoft.Ma.Adapter;
|
||||||
|
using Zennysoft.Ma.Adapter.Entity;
|
||||||
|
|
||||||
[Meta(typeof(IAutoNode))]
|
[Meta(typeof(IAutoNode))]
|
||||||
public partial class Plastique : Node3D, IBaseInventoryItem
|
public partial class Plastique : RigidBody3D
|
||||||
{
|
{
|
||||||
public override void _Notification(int what) => this.Notify(what);
|
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 void OnReady()
|
||||||
|
|
||||||
public ItemTag ItemTag => Stats.ItemTag;
|
|
||||||
|
|
||||||
public void OnResolved()
|
|
||||||
{
|
{
|
||||||
_sprite.Texture = Stats.Texture;
|
_stateMachine = (AnimationNodeStateMachinePlayback)AnimationTree.Get(_parametersPlayback);
|
||||||
|
ExplosionArea.AreaEntered += ExplosionArea_AreaEntered;
|
||||||
|
AnimationTree.AnimationFinished += AnimationTree_AnimationFinished;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Texture2D GetTexture() => Stats.Texture;
|
private void AnimationTree_AnimationFinished(StringName animName)
|
||||||
|
{
|
||||||
[Export]
|
if (animName == "explode")
|
||||||
[Save("inventory_stats")]
|
QueueFree();
|
||||||
public EffectItemStats Stats { get; set; } = new EffectItemStats();
|
}
|
||||||
|
|
||||||
|
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
@@ -1,63 +1,39 @@
|
|||||||
using Chickensoft.AutoInject;
|
using Chickensoft.AutoInject;
|
||||||
using Chickensoft.Introspection;
|
using Chickensoft.Introspection;
|
||||||
|
using Chickensoft.Serialization;
|
||||||
using Godot;
|
using Godot;
|
||||||
using System;
|
using Zennysoft.Game.Ma;
|
||||||
using Zennysoft.Ma.Adapter;
|
using Zennysoft.Ma.Adapter;
|
||||||
using Zennysoft.Ma.Adapter.Entity;
|
|
||||||
|
|
||||||
[Meta(typeof(IAutoNode))]
|
[Meta(typeof(IAutoNode))]
|
||||||
public partial class SetItem : RigidBody3D
|
public partial class SetItem : Node3D, IBaseInventoryItem
|
||||||
{
|
{
|
||||||
public override void _Notification(int what) => this.Notify(what);
|
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);
|
_sprite.Texture = Stats.Texture;
|
||||||
ExplosionArea.AreaEntered += ExplosionArea_AreaEntered;
|
|
||||||
AnimationTree.AnimationFinished += AnimationTree_AnimationFinished;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AnimationTree_AnimationFinished(StringName animName)
|
public Texture2D GetTexture() => Stats.Texture;
|
||||||
{
|
|
||||||
if (animName == "explode")
|
|
||||||
QueueFree();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ExplosionArea_AreaEntered(Area3D area)
|
[Export]
|
||||||
{
|
[Save("inventory_stats")]
|
||||||
if (area.GetParent() is ExplodableWall wall)
|
public EffectItemStats Stats { get; set; } = new EffectItemStats();
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
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://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://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://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://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://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"]
|
[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";
|
InteractButton.Text = "Augment";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetOptionsInternal(SetItem setItem)
|
||||||
|
{
|
||||||
|
InteractButton.Text = "Set";
|
||||||
|
}
|
||||||
|
|
||||||
private void SetOptionsInternal(ThrowableItem equipable)
|
private void SetOptionsInternal(ThrowableItem equipable)
|
||||||
{
|
{
|
||||||
InteractButton.Text = string.Empty;
|
InteractButton.Text = string.Empty;
|
||||||
@@ -175,10 +180,10 @@ public partial class ActionPanel : Panel
|
|||||||
ActionPanelClosing?.Invoke();
|
ActionPanelClosing?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PerformAction(Plastique plastique)
|
private void PerformAction(SetItem setItem)
|
||||||
{
|
{
|
||||||
SfxDatabase.Instance.Play(SoundEffect.SelectUI);
|
SfxDatabase.Instance.Play(SoundEffect.SelectUI);
|
||||||
_game.SetItem(plastique);
|
_game.SetItem(setItem);
|
||||||
_currentlySelected = null;
|
_currentlySelected = null;
|
||||||
ActionPanelClosing?.Invoke();
|
ActionPanelClosing?.Invoke();
|
||||||
ReturnToGameAction?.Invoke();
|
ReturnToGameAction?.Invoke();
|
||||||
|
|||||||
Reference in New Issue
Block a user