From ef4175cdfae6a6981738e15cb0009d8e47ed7c80 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Mon, 15 Apr 2013 21:24:55 +0200 Subject: Moved functions to entity members where appropriate Some functions were skipped for now because they may need a new name or change of behavior. Changes: chr_warp entity:warp chr_get_inventory entity:inventory chr_inv_change entity:inv_change chr_inv_count entity:inv_count chr_get_equipment entity:equipment chr_equip_slot entity:equip_slot chr_equip_item entity:equip_item chr_unequip_slot entity:unequip_slot chr_unequip_item entity:unequip_item chr_get_level entity:level chr_get_exp entity:xp chr_give_exp entity:give_xp chr_get_rights entity:rights chr_set_hair_style entity:set_hair_style chr_get_hair_style entity:hair_style chr_set_hair_color entity:set_hair_color chr_get_hair_color entity:hair_color chr_get_kill_count entity:kill_count chr_give_special entity:give_special chr_has_special entity:has_special chr_take_special entity:take_special chr_set_special_recharge_speed entity:set_special_recharge_speed chr_get_special_recharge_speed entity:special_recharge_speed chr_set_special_mana entity:set_special_mana chr_get_special_mana entity:special_mana chr_kick entity:kick exp_for_level xp_for_level monster_get_id entity:monster_id monster_change_anger entity:change_anger monster_drop_anger entity:drop_anger monster_get_angerlist entity:angerlist being_apply_status entity:apply_status being_remove_status entity:remove_status being_has_status entity:has_status being_set_status_time entity:set_status_time being_get_status_time entity:status_time being_get_gender entity:gender being_set_gender entity:set_gender being_type entity:type being_walk entity:walk being_say entity:say being_damage entity:damage being_heal entity:heal being_get_name entity:name being_get_action entity:action being_set_action entity:set_action being_get_direction entity:direction being_set_direction entity:set_direction being_apply_attribute_modifier entity:apply_attribute_modifier being_remove_attribute_modifier entity:remove_attribute_modifier being_set_base_attribute entity:set_base_attribute being_get_modified_attribute entity:modified_attribute being_get_base_attribute entity:base_attribute being_set_walkmask entity:set_walkmask being_get_walkmask entity:walkmask being_get_mapid entity:mapid chat_message entity:message being_register entity:register chr_shake_screen entity:shake_screen chr_create_text_particle entity:show_text_particle - entity:position posX entity:x posY entity:y monster_get_name monsterclass:name item_get_name itemclass:name --- scripts/lua/npclib.lua | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'scripts/lua/npclib.lua') 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 -- cgit v1.2.3-70-g09d2