[UPDATE] Update register -> core/basic

This commit is contained in:
tacigar 2016-09-14 08:27:13 +09:00
parent 894a1fe35f
commit e276514a6b
2 changed files with 15 additions and 13 deletions

View File

@ -3,10 +3,7 @@
-- https://github.com/tacigar/maidroid -- https://github.com/tacigar/maidroid
------------------------------------------------------------ ------------------------------------------------------------
local state = { local state = {IDLE = 0, ACCOMPANY = 1}
IDLE = 0,
ACCOMPANY = 1,
}
local function on_start(self) local function on_start(self)
self.state = state.IDLE self.state = state.IDLE
@ -19,6 +16,10 @@ local function on_stop(self)
self.object:setvelocty{x = 0, y = 0, z = 0} self.object:setvelocty{x = 0, y = 0, z = 0}
end end
local on_resume = on_start
local on_pause = on_stop
local function on_step(self, dtime) local function on_step(self, dtime)
local player = self:get_nearest_player(10) local player = self:get_nearest_player(10)
if player == nil then if player == nil then
@ -55,12 +56,13 @@ local function on_step(self, dtime)
end end
end end
maidroid.register_core("maidroid_core:core_basic", { -- register a definition of a new core.
description = "maidroid core : basic", maidroid.register_core("maidroid_core:basic", {
inventory_image = "maidroid_core_basic.png", description = "maidroid core : basic",
on_start = on_start, inventory_image = "maidroid_core_basic.png",
on_stop = on_stop, on_start = on_start,
on_resume = on_start, on_stop = on_stop,
on_pause = on_stop, on_resume = on_resume,
on_step = on_step, on_pause = on_pause,
on_step = on_step,
}) })

View File

@ -8,4 +8,4 @@ maidroid_core = {}
maidroid_core.modname = "maidroid_core" maidroid_core.modname = "maidroid_core"
maidroid_core.modpath = minetest.get_modpath(maidroid_core.modname) maidroid_core.modpath = minetest.get_modpath(maidroid_core.modname)
dofile(maidroid_core.modpath .. "/register.lua") dofile(maidroid_core.modpath .. "/cores/basic.lua")