Files
Factory47/GameShit/MainGame/MainGame.gd

34 lines
947 B
GDScript

extends Node3D
signal hideChatbox
## define all of the game variables, ill replace this with a settings file later
## ignore duplicate keys, idrc atp
## this game is jus a mess of spaghetti anyhow
var selectedBlockID : String = "base:testMachine"
var selectedSlot = 0
var currentHeldItemID : String = "base:air"
var canPlaceBlock : bool = false
var username = "test"
var loadedLanguage = "en-US"
var isInputLocked = false
func _ready() -> void:
var cfg = ConfigLoader.loadConfig()
username = cfg.username
func getIfIDExists(ID:String) -> bool:
var segments = ID.split(":")
return ResourceLoader.exists("res://WorldObjects/{namespace}/{id}.tscn".format({"namespace": segments[0], "id": segments[1]}))
func _process(delta: float) -> void:
if currentHeldItemID != "base:air" and getIfIDExists(currentHeldItemID):
canPlaceBlock = true
selectedBlockID = currentHeldItemID
else:
canPlaceBlock = false
selectedBlockID = "base:air"