mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-10 17:55:54 +00:00
Fix drops on enemies and treasure rooms
This commit is contained in:
parent
2c72f36108
commit
8d71a59d84
25 changed files with 81 additions and 40 deletions
|
|
@ -29,11 +29,11 @@ public partial class LootItem : Resource
|
|||
//[Export] public PackedScene HudItemScene;
|
||||
[Export(PropertyHint.File)] public StringName DropScenePath { get; private set; } // Has to be a string path to avoid recursion issues
|
||||
|
||||
public ItemPickup Spawn(Node2D parent)
|
||||
public ItemPickup Spawn(Node2D sibling, bool dropAsChild = false)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(DropScenePath)) return null;
|
||||
var itemScene = GD.Load<PackedScene>(DropScenePath);
|
||||
var spawnedItem = parent.CreateSibling<ItemPickup>(itemScene);
|
||||
var spawnedItem = dropAsChild ? sibling.CreateChild<ItemPickup>(itemScene) : sibling.CreateSibling<ItemPickup>(itemScene);
|
||||
|
||||
spawnedItem.Name = this.ItemKey;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue