From eaa0ce58bf7e5a0d9ae788c1054e6c9d54781a37 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Wed, 29 Mar 2023 15:47:13 +0700 Subject: [PATCH] root.itemHasTag --- src/main/kotlin/ru/dbotthepony/kstarbound/Starbound.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/Starbound.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/Starbound.kt index 59f74b02..b1bd2003 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/Starbound.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/Starbound.kt @@ -459,6 +459,13 @@ class Starbound : ISBFileLocator { 1 } + state.setTableFunction("itemHasTag", this) { args -> + val name = args.getString() + val tag = args.getString() + args.lua.push((items[name]?.value?.itemTags ?: throw NoSuchElementException("No such item $name")).contains(tag)) + 1 + } + state.pop() state.load(polyfill, "@starbound.jar!/scripts/polyfill.lua")