added machine item slots so ican start building gameplay
This commit is contained in:
28
Objects/Scripts/SItemSlot.gd
Normal file
28
Objects/Scripts/SItemSlot.gd
Normal file
@@ -0,0 +1,28 @@
|
||||
extends Node3D
|
||||
|
||||
signal removeItemS
|
||||
signal placeItemS(ID: String)
|
||||
|
||||
@export_storage var ItemTexture: Texture2D:
|
||||
set(value):
|
||||
ItemTexture = value
|
||||
update_visuals()
|
||||
|
||||
@export_storage var ItemID: String
|
||||
|
||||
func _ready() -> void:
|
||||
update_visuals()
|
||||
|
||||
func update_visuals() -> void:
|
||||
if has_node("Sprite3D"):
|
||||
if ItemTexture != null:
|
||||
$Sprite3D.texture = ItemTexture
|
||||
$Sprite3D.pixel_size = 0.2 / ItemTexture.get_height()
|
||||
else:
|
||||
$Sprite3D.texture = null
|
||||
|
||||
func placeItem(ID: String):
|
||||
$StaticBody3D.placeItem(ID)
|
||||
|
||||
func removeItem():
|
||||
$StaticBody3D.removeItem()
|
||||
Reference in New Issue
Block a user