added luacmd, replaced fooditem hardcodes with ugly debug hack
parent
49996f75f4
commit
0266b51d3c
|
@ -94,3 +94,6 @@
|
|||
[submodule "mods/minetest_hudbars"]
|
||||
path = mods/minetest_hudbars
|
||||
url = https://repo.or.cz/minetest_hudbars.git
|
||||
[submodule "mods/minetest-mod-luacmd"]
|
||||
path = mods/luacmd
|
||||
url = https://github.com/prestidigitator/minetest-mod-luacmd.git
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
secure.enable_security = true
|
||||
secure.trusted_mods = wbg_modcompat
|
||||
|
||||
default_privs = basic_privs, home, interact
|
||||
|
||||
new_style_leaves = 1
|
||||
|
@ -50,3 +53,4 @@ sprint_starve_drain = 0.25
|
|||
hunger_ng_use_hunger_bar = false
|
||||
hudbars_autohide_breath = false
|
||||
hudbars_autohide_stamina = false
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 63d0d602c794a531b94b0e7bf87337ef96ce6ba5
|
|
@ -65,7 +65,36 @@ if true -- allow cactus damage by shrinking its collision box and enabling "imme
|
|||
cactus.damage_per_second=1
|
||||
minetest.register_node ":default:cactus", cactus
|
||||
|
||||
if true -- fooditems for nssm
|
||||
|
||||
if true -- fooditems via ugly debug hack, but surprisingly efficient!
|
||||
ie = minetest.request_insecure_environment!
|
||||
debug = ie.require 'debug'
|
||||
scan_item=(name)->
|
||||
if _hunger_ng
|
||||
return
|
||||
ou = minetest.registered_craftitems[name].on_use
|
||||
if not ou
|
||||
return
|
||||
ups = {}
|
||||
i=1
|
||||
while true
|
||||
n, v = debug.getupvalue ou, i
|
||||
if not n
|
||||
break
|
||||
ups[n] = v
|
||||
i = i + 1
|
||||
if not ups.hp_change
|
||||
return
|
||||
minetest.log 'action','[WBG:modcompat] registering scanned fooditem "%s" with hunger_ng'\format name
|
||||
hunger_ng.add_hunger_data name, {
|
||||
heals: math.floor(ups.hp_change/4)
|
||||
satiates: ups.hp_change
|
||||
returns: ups.replace_with_item
|
||||
}
|
||||
for n,v in pairs minetest.registered_craftitems
|
||||
scan_item n
|
||||
|
||||
if false -- fooditems for nssm
|
||||
nssm_craftitem_eat=(name,_desc,satiates)->
|
||||
heals = math.floor(satiates/4)
|
||||
minetest.log 'action','[WBG:modcompat] registering nssm fooditem "%s" with hunger_ng'\format name
|
||||
|
@ -117,7 +146,7 @@ if true -- fooditems for nssm
|
|||
nssm_craftitem_eat 'roasted_super_silk_gland','Roasted Super Silk Gland',2
|
||||
|
||||
|
||||
if true -- register hunger data for any other items, undoing the "keep out of other mods' way" policy of hunger_ng
|
||||
if false -- register hunger data for any other items, undoing the "keep out of other mods' way" policy of hunger_ng
|
||||
-- don't ask, srsly...
|
||||
--file = io.open minetest.get_modpath('wbg_modcompat')..'/loaditems.txt', 'w'
|
||||
--file\write storage\get_string 'fallback_hunger_items'
|
||||
|
|
Loading…
Reference in New Issue