diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-03-11 18:16:16 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-03-11 19:27:32 +0100 |
commit | 5ff34fd2458dff28d664c90fb93f455231f8633c (patch) | |
tree | 533151e5f3002c1e24ce4d44e5cd32c66c026b51 /example/scripts/npcs/shaker.lua | |
parent | b822dcee52d15d41c4186a250e73b85b16c9dc39 (diff) | |
download | manaserv-5ff34fd2458dff28d664c90fb93f455231f8633c.tar.gz manaserv-5ff34fd2458dff28d664c90fb93f455231f8633c.tar.bz2 manaserv-5ff34fd2458dff28d664c90fb93f455231f8633c.tar.xz manaserv-5ff34fd2458dff28d664c90fb93f455231f8633c.zip |
Register Lua script API functions into the global namespace
Scripts mostly execute the Mana script API, and it seems like just
unnecessary verbosity to refer to the 'mana' table all the time. This table
no longer exists now.
Reviewed-by: Erik Schilling
Diffstat (limited to 'example/scripts/npcs/shaker.lua')
-rw-r--r-- | example/scripts/npcs/shaker.lua | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/example/scripts/npcs/shaker.lua b/example/scripts/npcs/shaker.lua index ac6b152a..768fc126 100644 --- a/example/scripts/npcs/shaker.lua +++ b/example/scripts/npcs/shaker.lua @@ -15,8 +15,8 @@ function shaker_update(npc) if shake_count > 20 then
shake_count = 0
- center_x = mana.posX(npc)
- center_y = mana.posY(npc)
+ center_x = posX(npc)
+ center_y = posY(npc)
tremor(center_x, center_y, 300)
end
end
@@ -28,17 +28,17 @@ function square(x) end
function tremor (center_x, center_y, intensity)
- for dummy, object in ipairs(mana.get_beings_in_circle(center_x, center_y, intensity)) do
- if mana.being_type(object) == TYPE_CHARACTER then
- object_x = mana.posX(object)
- object_y = mana.posY(object)
+ for dummy, object in ipairs(get_beings_in_circle(center_x, center_y, intensity)) do
+ if being_type(object) == TYPE_CHARACTER then
+ object_x = posX(object)
+ object_y = posY(object)
dist_x = object_x - center_x
dist_y = object_y - center_y
dist = math.sqrt(square(dist_x) + square(dist_y))
intensity_local = intensity - dist
intensity_x = (intensity - dist) * (dist_x / dist) / 5
intensity_y = (intensity - dist) * (dist_y / dist) / 5
- mana.chr_shake_screen(object, intensity_x, intensity_y)
+ chr_shake_screen(object, intensity_x, intensity_y)
end
end
end
|