Inventory management focused game written in Godot / C#
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
public partial class Item : RigidBody3D
|
|
|
|
{
|
|
|
|
[Export] public Vector3I Size { get; set; }
|
|
|
|
|
|
|
|
public virtual Node3D Model
|
|
|
|
=> GetNode<Node3D>("Model");
|
|
|
|
|
|
|
|
public override void _Ready()
|
|
|
|
{
|
|
|
|
// TODO: Find a better way to better import models with colliders.
|
|
|
|
// TODO: Import items dynamically at runtime?
|
|
|
|
// TODO: Use PostImport tool script?
|
|
|
|
foreach (var body in FindChildren("*", "StaticBody3D").Cast<StaticBody3D>()) {
|
|
|
|
foreach (var shape in body.GetChildren().OfType<CollisionShape3D>()) {
|
|
|
|
body.RemoveChild(shape);
|
|
|
|
AddChild(shape);
|
|
|
|
}
|
|
|
|
body.GetParent().RemoveChild(body);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set the collision properties here so we don't have to specify them in each item scene separately.
|
|
|
|
CollisionLayer = (uint)(PhysicsLayer.Item | PhysicsLayer.Interactable);
|
|
|
|
CollisionMask = (uint)(PhysicsLayer.Static | PhysicsLayer.Dynamic | PhysicsLayer.Player | PhysicsLayer.Item);
|
|
|
|
|
|
|
|
Freeze = FindParent("Grid") != null;
|
|
|
|
}
|
|
|
|
}
|