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/libmana.lua | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'scripts/lua/libmana.lua') 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) -- cgit v1.2.3-70-g09d2