mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-11 10:55:55 +00:00
Chests and Loot Drops
This commit is contained in:
parent
8ec057faf7
commit
a2a18c69fc
20 changed files with 242 additions and 58 deletions
|
|
@ -6,7 +6,7 @@ namespace Cirno.Scripts.Components.FSM.Enemy;
|
|||
|
||||
public partial class EnemyDropsProvider : Node2D
|
||||
{
|
||||
private RandomNumberGenerator _rng = new();
|
||||
//private RandomNumberGenerator _rng = new();
|
||||
|
||||
[Export] public float DropRadius { get; private set; } = 8f;
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ public partial class EnemyDropsProvider : Node2D
|
|||
{
|
||||
if (loot is { Item: not null })
|
||||
{
|
||||
float roll = _rng.RandfRange(0f, 100f); // Generate a number between 0 and 100
|
||||
float roll = (float)GD.RandRange(0d, 100d); // Generate a number between 0 and 100
|
||||
if (roll <= loot.Chance) // Compare with drop chance
|
||||
{
|
||||
DropItem(loot.Item);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue