Fix really really really annoying issue with enemy spawns
Godot refuses to set CharacterBody3D positions correctly unless you call ResetPhysicsInterpolation immediately after
This commit is contained in:
@@ -412,8 +412,16 @@ public partial class Game : Node3D, IGame
|
||||
{
|
||||
var restorativeScene = GD.Load<PackedScene>("res://src/items/restorative/Restorative.tscn");
|
||||
var restorative = restorativeScene.Instantiate<Restorative>();
|
||||
AddChild(restorative);
|
||||
restorative.GlobalPosition = new Vector3(vector.X, 2f, vector.Z) + (-_player.GetGlobalBasis().Z);
|
||||
AddChild(restorative);
|
||||
}
|
||||
|
||||
private void DropItem(Vector3 vector)
|
||||
{
|
||||
var randomItem = ItemDatabase.Instance.PickItem<IBaseInventoryItem>() as Node3D;
|
||||
var duplicated = randomItem.Duplicate((int)DuplicateFlags.UseInstantiation) as Node3D;
|
||||
duplicated.GlobalPosition = new Vector3(vector.X, 2f, vector.Z) + (-_player.GetGlobalBasis().Z);
|
||||
AddChild(duplicated);
|
||||
}
|
||||
|
||||
private void UseTeleportPrompt_CloseTeleportPrompt()
|
||||
@@ -691,7 +699,12 @@ public partial class Game : Node3D, IGame
|
||||
|
||||
private void GameRepo_EnemyDied(IEnemy obj)
|
||||
{
|
||||
DropRestorative(obj.GlobalPosition);
|
||||
var rng = new RandomNumberGenerator();
|
||||
rng.Randomize();
|
||||
if (rng.Randf() < 0.15f)
|
||||
DropItem(obj.GlobalPosition);
|
||||
else
|
||||
DropRestorative(obj.GlobalPosition);
|
||||
}
|
||||
|
||||
private void BroadcastMessage(string obj)
|
||||
|
||||
Reference in New Issue
Block a user