diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lua/libmana.lua | 14 | ||||
-rw-r--r-- | scripts/lua/npclib.lua | 16 |
2 files changed, 13 insertions, 17 deletions
diff --git a/scripts/lua/libmana.lua b/scripts/lua/libmana.lua index b87de1fe..20a5e13f 100644 --- a/scripts/lua/libmana.lua +++ b/scripts/lua/libmana.lua @@ -326,7 +326,7 @@ function on_death(being, funct) ondeath_functs[being] = {} end table.insert(ondeath_functs[being], funct) - being_register(being) + being:register() end --- LUA on_remove (scheduling) @@ -340,7 +340,7 @@ function on_remove(being, funct) onremove_functs[being] = {} end table.insert(onremove_functs[being], funct) - being_register(being) + being:register() end -- Registered as callback for when a registered being dies. @@ -375,10 +375,8 @@ end -- **Warning:** Before reducing the money make sure to check if the character -- owns enough money using chr_money. chr_money_change = function(ch, amount) - being_set_base_attribute( - ch, - ATTR_GP, - being_get_base_attribute(ch, ATTR_GP) + amount) + ch:set_base_attribute(ATTR_GP, + ch:base_attribute(ATTR_GP) + amount) end --- LUA chr_money (inventory) @@ -389,7 +387,7 @@ end -- **Warning:** Before reducing the money make sure to check if the character -- owns enough money using chr_money. chr_money = function(ch) - return being_get_base_attribute(ch, ATTR_GP) + return ch:base_attribute(ATTR_GP) end -- Register callbacks @@ -400,4 +398,4 @@ on_create_npc_delayed(create_npc_delayed) on_map_initialize(map_initialize) on_being_death(death_notification) -on_being_remove(remove_notification) +on_entity_remove(remove_notification) diff --git a/scripts/lua/npclib.lua b/scripts/lua/npclib.lua index 48e53769..b3b4b096 100644 --- a/scripts/lua/npclib.lua +++ b/scripts/lua/npclib.lua @@ -31,8 +31,7 @@ local wasmall_starty = {} function walkaround_small(npc) if not wasmall_timer[npc] then wasmall_timer[npc] = 1 - wasmall_startx[npc] = posX(npc) - wasmall_starty[npc] = posY(npc) + wasmall_startx[npc], wasmall_starty[npc] = npc:position() end wasmall_timer[npc] = wasmall_timer[npc] + 1 @@ -41,7 +40,7 @@ function walkaround_small(npc) wasmall_timer[npc] = math.random(1, 10) local x = math.random(-32, 32) + wasmall_startx[npc] local y = math.random(-32, 32) + wasmall_starty[npc] - being_walk(npc, x, y, 2) + npc:walk(x, y, 2) end end @@ -58,8 +57,7 @@ local wawide_starty = {} function walkaround_wide(npc) if not wawide_timer[npc] then wawide_timer[npc] = 1 - wawide_startx[npc] = posX(npc) - wawide_starty[npc] = posY(npc) + wawide_startx[npc], wawide_starty[npc] = npc:position() end wawide_timer[npc] = wawide_timer[npc] + 1 @@ -68,7 +66,7 @@ function walkaround_wide(npc) wawide_timer[npc] = math.random(1, 10) local x = math.random(-128, 128) + wawide_startx[npc] local y = math.random(-128, 128) + wawide_starty[npc] - being_walk(npc, x, y, 2) + npc:walk(x, y, 2) end end @@ -88,9 +86,9 @@ function walkaround_map(npc) if wam_timer[npc] == 50 then wam_timer[npc] = math.random(1, 10) - local x = math.random(-128, 128) + posX(npc) - local y = math.random(-128, 128) + posY(npc) - being_walk(npc, x, y, 2) + local x = math.random(-128, 128) + npc:x() + local y = math.random(-128, 128) + npc:y() + npc:walk(x, y, 2) end end |