From 82c6d4254cf0ac2a2c9ab40337535a13dcb577d8 Mon Sep 17 00:00:00 2001
From: DBotThePony <dbotthepony@yandex.ru>
Date: Sun, 23 Apr 2023 23:54:08 +0700
Subject: [PATCH] root.hasTech, techType, techConfig

---
 .../ru/dbotthepony/kstarbound/Starbound.kt    | 23 +++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/Starbound.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/Starbound.kt
index fc71da19..f41ca2d6 100644
--- a/src/main/kotlin/ru/dbotthepony/kstarbound/Starbound.kt
+++ b/src/main/kotlin/ru/dbotthepony/kstarbound/Starbound.kt
@@ -756,6 +756,29 @@ class Starbound : ISBFileLocator {
 			1
 		}
 
+		state.setTableFunction("createBiome", this) { args ->
+			TODO("createBiome")
+		}
+
+		state.setTableFunction("hasTech", this) { args ->
+			args.push(args.getString() in techs)
+			1
+		}
+
+		state.setTableFunction("techType", this) { args ->
+			val name = args.getString()
+			val tech = techs[name] ?: throw NoSuchElementException("No such tech $name")
+			args.push(tech.value.type)
+			1
+		}
+
+		state.setTableFunction("techConfig", this) { args ->
+			val name = args.getString()
+			val tech = techs[name] ?: throw NoSuchElementException("No such tech $name")
+			tech.push(args)
+			1
+		}
+
 		state.pop()
 
 		state.load(polyfill, "@starbound.jar!/scripts/polyfill.lua")