forked from mtcontrib/maidroid
Merge pull request #13 from tacigar/tacigar/maidroid/maidroid_core
[UPDATE] Update maidroid_core
This commit is contained in:
commit
46739398ca
@ -3,10 +3,7 @@
|
||||
-- https://github.com/tacigar/maidroid
|
||||
------------------------------------------------------------
|
||||
|
||||
local state = {
|
||||
IDLE = 0,
|
||||
ACCOMPANY = 1,
|
||||
}
|
||||
local state = {IDLE = 0, ACCOMPANY = 1}
|
||||
|
||||
local function on_start(self)
|
||||
self.state = state.IDLE
|
||||
@ -19,6 +16,10 @@ local function on_stop(self)
|
||||
self.object:setvelocty{x = 0, y = 0, z = 0}
|
||||
end
|
||||
|
||||
local on_resume = on_start
|
||||
|
||||
local on_pause = on_stop
|
||||
|
||||
local function on_step(self, dtime)
|
||||
local player = self:get_nearest_player(10)
|
||||
if player == nil then
|
||||
@ -55,12 +56,13 @@ local function on_step(self, dtime)
|
||||
end
|
||||
end
|
||||
|
||||
maidroid.register_core("maidroid_core:core_basic", {
|
||||
-- register a definition of a new core.
|
||||
maidroid.register_core("maidroid_core:basic", {
|
||||
description = "maidroid core : basic",
|
||||
inventory_image = "maidroid_core_basic.png",
|
||||
on_start = on_start,
|
||||
on_stop = on_stop,
|
||||
on_resume = on_start,
|
||||
on_pause = on_stop,
|
||||
on_resume = on_resume,
|
||||
on_pause = on_pause,
|
||||
on_step = on_step,
|
||||
})
|
14
maidroid_core/cores/empty.lua
Normal file
14
maidroid_core/cores/empty.lua
Normal file
@ -0,0 +1,14 @@
|
||||
------------------------------------------------------------
|
||||
-- Copyright (c) 2016 tacigar. All rights reserved.
|
||||
-- https://github.com/tacigar/maidroid
|
||||
------------------------------------------------------------
|
||||
|
||||
maidroid.register_core("maidroid_core:empty", {
|
||||
description = "maidroid core : empty",
|
||||
inventory_image = "maidroid_core_empty.png",
|
||||
on_start = function(self) end,
|
||||
on_stop = function(self) end,
|
||||
on_resume = function(self) end,
|
||||
on_pause = function(self) end,
|
||||
on_step = function(self, dtime) end,
|
||||
})
|
@ -8,4 +8,5 @@ maidroid_core = {}
|
||||
maidroid_core.modname = "maidroid_core"
|
||||
maidroid_core.modpath = minetest.get_modpath(maidroid_core.modname)
|
||||
|
||||
dofile(maidroid_core.modpath .. "/register.lua")
|
||||
dofile(maidroid_core.modpath .. "/cores/empty.lua")
|
||||
dofile(maidroid_core.modpath .. "/cores/basic.lua")
|
||||
|
BIN
maidroid_core/textures/maidroid_core_basic.png
Normal file
BIN
maidroid_core/textures/maidroid_core_basic.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 864 B |
BIN
maidroid_core/textures/maidroid_core_basic.xcf
Normal file
BIN
maidroid_core/textures/maidroid_core_basic.xcf
Normal file
Binary file not shown.
BIN
maidroid_core/textures/maidroid_core_empty.png
Normal file
BIN
maidroid_core/textures/maidroid_core_empty.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 868 B |
BIN
maidroid_core/textures/maidroid_core_empty.xcf
Normal file
BIN
maidroid_core/textures/maidroid_core_empty.xcf
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user