From 4b32c4c5cdbbf6bace8094d275e5f1b2e64b6280 Mon Sep 17 00:00:00 2001 From: tacigar Date: Tue, 3 Jan 2017 10:43:56 +0900 Subject: [PATCH] Modify various --- maidroid/api.lua | 4 ++-- maidroid_core/cores/basic.lua | 1 + maidroid_tool/{api.lua => _aux.lua} | 7 ++++--- maidroid_tool/core_writer.lua | 2 +- maidroid_tool/egg_writer.lua | 2 +- maidroid_tool/init.lua | 2 +- 6 files changed, 10 insertions(+), 8 deletions(-) rename maidroid_tool/{api.lua => _aux.lua} (97%) diff --git a/maidroid/api.lua b/maidroid/api.lua index d036da1..35c29ca 100644 --- a/maidroid/api.lua +++ b/maidroid/api.lua @@ -301,7 +301,7 @@ end function maidroid.register_core(core_name, def) maidroid.registered_cores[core_name] = def - minetest.register_craftitem(core_name, { + minetest.register_tool(core_name, { stack_max = 1, description = def.description, inventory_image = def.inventory_image, @@ -312,7 +312,7 @@ end function maidroid.register_egg(egg_name, def) maidroid.registered_eggs[egg_name] = def - minetest.register_craftitem(egg_name, { + minetest.register_tool(egg_name, { description = def.description, inventory_image = def.inventory_image, stack_max = 1, diff --git a/maidroid_core/cores/basic.lua b/maidroid_core/cores/basic.lua index 6fb48bc..9c0e124 100644 --- a/maidroid_core/cores/basic.lua +++ b/maidroid_core/cores/basic.lua @@ -14,6 +14,7 @@ end local function on_stop(self) self.state = nil self.object:setvelocity{x = 0, y = 0, z = 0} + self:set_animation(maidroid.animation_frames.STAND) end local function on_step(self, dtime) diff --git a/maidroid_tool/api.lua b/maidroid_tool/_aux.lua similarity index 97% rename from maidroid_tool/api.lua rename to maidroid_tool/_aux.lua index 2282160..fd6a272 100644 --- a/maidroid_tool/api.lua +++ b/maidroid_tool/_aux.lua @@ -3,9 +3,11 @@ -- https://github.com/tacigar/maidroid ------------------------------------------------------------ +maidroid_tool._aux = {} + -- maidroid_tool.shared.generate_writer is a shared -- function called for registering egg writer and core writer. -function maidroid_tool.register_writer(nodename, options) +function maidroid_tool._aux.register_writer(nodename, options) local description = options.description local formspec = options.formspec local tiles = options.tiles @@ -16,7 +18,6 @@ function maidroid_tool.register_writer(nodename, options) local on_deactivate = options.on_deactivate local empty_itemname = options.empty_itemname local dye_item_map = options.dye_item_map - --~ local is_mainitem = options.is_mainitem local on_metadata_inventory_put_to_main = options.on_metadata_inventory_put_to_main local on_metadata_inventory_take_from_main = options.on_metadata_inventory_take_from_main @@ -156,7 +157,7 @@ function maidroid_tool.register_writer(nodename, options) end end - local function allow_metadata_inventory_take(_,_,_, stack) + local function allow_metadata_inventory_take(_, _, _, stack) return stack:get_count() -- maybe add more. end diff --git a/maidroid_tool/core_writer.lua b/maidroid_tool/core_writer.lua index c3393e7..209ece5 100644 --- a/maidroid_tool/core_writer.lua +++ b/maidroid_tool/core_writer.lua @@ -148,7 +148,7 @@ do -- register core writer core_entity.object:remove() end - maidroid_tool.register_writer("maidroid_tool:core_writer", { + maidroid_tool._aux.register_writer("maidroid_tool:core_writer", { description = "maidroid tool : core writer", formspec = formspec, tiles = tiles, diff --git a/maidroid_tool/egg_writer.lua b/maidroid_tool/egg_writer.lua index a489ef4..78b7cfb 100644 --- a/maidroid_tool/egg_writer.lua +++ b/maidroid_tool/egg_writer.lua @@ -165,7 +165,7 @@ do -- register egg writer egg_entity.object:remove() end - maidroid_tool.register_writer("maidroid_tool:egg_writer", { + maidroid_tool._aux.register_writer("maidroid_tool:egg_writer", { description = "maidroid tool : egg writer", formspec = formspec, tiles = tiles, diff --git a/maidroid_tool/init.lua b/maidroid_tool/init.lua index 55daad7..d2506d9 100644 --- a/maidroid_tool/init.lua +++ b/maidroid_tool/init.lua @@ -8,7 +8,7 @@ maidroid_tool = {} maidroid_tool.modname = "maidroid_tool" maidroid_tool.modpath = minetest.get_modpath(maidroid_tool.modname) -dofile(maidroid_tool.modpath .. "/api.lua") +dofile(maidroid_tool.modpath .. "/_aux.lua") dofile(maidroid_tool.modpath .. "/core_writer.lua") dofile(maidroid_tool.modpath .. "/egg_writer.lua") dofile(maidroid_tool.modpath .. "/crafting.lua")