summaryrefslogtreecommitdiffstats
path: root/src/scripting
Commit message (Collapse)AuthorAgeFilesLines
* Added look_at bindErik Schilling2013-05-111-0/+33
|
* Added entity:destination() bindErik Schilling2013-05-111-0/+18
|
* Added function to check for lenght of a possible pathErik Schilling2013-05-113-9/+54
|
* Added get_monster_classes() bindErik Schilling2013-05-112-0/+19
| | | | It returns all monster classes in a id->monsterclass table.
* [Abilities] Added abilities to monstersErik Schilling2013-05-111-10/+45
| | | | | Monsters can now either receive abilities at lifetime via scripts, or via the <ability> node in the monsters node.
* [Abilities] Removed the old autoattack systemErik Schilling2013-05-082-451/+3
| | | | | As a side effect i had to remove the monster attack AI for now. I will readd this as next thing.
* [Abilities] Added a add_hit_taken bindErik Schilling2013-05-081-0/+15
| | | | This allows to display hit messages in the client for abilities
* [Abilities] Added support for a global cooldownErik Schilling2013-05-083-36/+59
| | | | | | | | | Each ability can now define a cooldown that prevents the player from using other abilities for a while. The time of this cooldown can be set to any attribute. The modified value of the attribute is the value of the cooldown in game ticks. The cooldown will be automatically started if the ability has `autoconsume` set to true. Otherwise a script has to call entity:cooldown_ability(ability).
* [Abilities] Moved the ability code into a own componentErik Schilling2013-05-081-9/+9
| | | | This later allows monsters and characters to use this component.
* [Abilities] Made the rechargespeed depending on attributesErik Schilling2013-05-081-57/+0
| | | | | | | | | | This allows a lot more flexibility and makes stuff like magical items a lot easier to implement. We will also use this for the attack system in the future. So a attack (abilitiy) would simply depend on some value like Agility (or a derived attribute from it). Which sets the recharge speed. The recharge speed is the modified value of the attribute per game tick.
* [Abilities] Renamed set to categoryErik Schilling2013-05-081-1/+1
| | | | | | On the one hand setSetName and setName could sound misleading in the qt client patch i plan. On the otherhand i never really liked the name "set". I think category is more general and obvious.
* [Abilities] Renamed specials to abilitiesErik Schilling2013-05-084-144/+145
|
* Made member function tables available as a globalsThorbjørn Lindeijer2013-05-031-0/+5
| | | | | | | | | | | | This way the scripts can add or replace existing member functions, which can be useful. As demonstration chr_money and chr_money_change are now added as Entity.money and Entity.change_money. Also fixed the banker to use ask_number instead of ask_integer (I had decided to rename this and apparently forgot the banker). Mantis-issue: 503 Reviewed-by: Ablu
* Fixed a bunch of cppcheck warningsErik Schilling2013-05-022-8/+6
|
* Use nullptr instead of NULL everywhereErik Schilling2013-04-274-14/+14
|
* Fixed typo in script docsErik Schilling2013-04-271-1/+1
|
* Forgot to rename npc_message in some docsThorbjørn Lindeijer2013-04-151-11/+11
|
* Fixed small script documentation errorThorbjørn Lindeijer2013-04-151-1/+1
|
* Fixed error messageThorbjørn Lindeijer2013-04-151-1/+1
| | | | Thanks to Ablu for noticing.
* Dropped the & from the Lua function tablesThorbjørn Lindeijer2013-04-151-149/+149
| | | | It's not actually necessary.
* Moved functions to entity members where appropriateThorbjørn Lindeijer2013-04-151-465/+575
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Simplified some script function namesThorbjørn Lindeijer2013-04-141-39/+38
| | | | | | | | npc_message -> say npc_choice -> ask npc_ask_integer -> ask_number npc_ask_string -> ask_string npc_trade -> trade
* Removed NPC and character parameters from NPC functionsThorbjørn Lindeijer2013-04-142-64/+69
| | | | | | | | These functions can only be used in the context of a character talking to an NPC, so these parameters can be deduced from that context rather than passing them explicitly all the time. Simplifies NPC scripting.
* Use a full user data for Entity referencesThorbjørn Lindeijer2013-04-144-89/+47
| | | | | Only moved a single script function to a member for now, will do others in a separate commit.
* Fixed too long lua documentationErik Schilling2013-04-121-21/+46
|
* Moved Actor into an ComponentErik Schilling2013-04-121-39/+46
| | | | This was the final step to remove the hierachy with Entity on the top.
* Converted Being into a ComponentErik Schilling2013-04-118-182/+203
| | | | | | I did not really care too much about staying consistent with the use of static_casts to Actors since they are only temporary anyway until Actor is a component too.
* Converted the Character class into a componentErik Schilling2013-04-115-85/+99
| | | | | A CharacterData was created as a proxy class in order to allow using the old serialization method.
* Moved the Monster class to a ComponentErik Schilling2013-04-033-21/+25
| | | | | | | Things done: - Allowed to create new Attributes outside of the protected scope of Being - Moved Monster to MonsterComponent - Some minor cleanup in the Attribute setting code of monsters
* Fixed multiple warnings and errors that blocked c++0xErik Schilling2013-04-021-1/+1
| | | | | This allows the server to compile with c++0x (and enables it). This also includes some coding style / readabillity fixes.
* Moved fighting code into a componentErik Schilling2013-04-021-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | All damage dealing is now handeled via CombatComponent. Monsters use a derived MonsterCombatComponent since they can have a damage mutation and have a seperate script callback. The wirering with Being is still not optional since most of the stuff does not exist as components. Things done: - Seperated the fighting code from Being and only let Characters and Monsters add the Component (less overhead for npcs) - Added a getter for Attribute values to prevent searching it all the time in non Being members - Fixed the type if the damage mutation to double (no idea why it was int) I did not want to copy it over incorrectly - Removed the addAttack/removeAttack overrides in Character and made the knuckleAttack being added based on newly added signals Future TODOS: - Remove depedency on Being as soon all needed dependencies are available as components of Entity - Move the monster script callback into the general combatcomponent and make it usuable for characters too
* Changed NPC to an NpcComponent added to a BeingThorbjørn Lindeijer2013-03-253-34/+43
|
* Changed Effect to a component of ActorThorbjørn Lindeijer2013-03-251-1/+1
| | | | Reviewed-by: Yohann Ferreira
* Changed Item to a component of ActorThorbjørn Lindeijer2013-03-251-9/+5
| | | | | | | | | | | | | | | Items also have positions, so the ItemComponent only makes sense as part of an Actor. Later on it will probably be part of an entity that also has an ActorComponent. Since it was annoying to update all the places where items were created, I've introduced a function for this. The component types are now prefixed with "CT_" because I wanted to introduce an 'Item' namespace which would otherwise be conflicting. The component types enum isn't used much in the code so it can look a bit ugly. Reviewed-by: Yohann Ferreira
* Changed SpawnArea and TriggerArea to components of EntityThorbjørn Lindeijer2013-03-251-4/+8
| | | | | | Well, first visible change is that everything just gets longer to read. Reviewed-by: Yohann Ferreira
* Documented all lua binds directly in the sourceErik Schilling2013-02-241-1341/+2201
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds a comment to each lua binding. In the future a script should parse those and generate the docs from them. This should prevent outdated docs and duplicate effort to keep code and docs synced. In C++ categories can be defined in this way: /** LUA_CATEGORY long description of the category (shortname) * further text * goes into * the next lines */ The shortname is only used to bind other comments to the category. In lua the category would look like this: --- LUA_CATEGORY long description of the category (shortname) -- further text -- goes into -- the next lines A comment that describes a bind then can look like this: /** LUA some_function (shortnameofcategory) * some_function(string name) * some_function(int id) ** * Description */ Or in Lua: --- LUA some_function (shortnameofcategory) -- some_function(string name) -- some_function(int id) --- -- Description Autoupdates script follows soon
* Introduced Script::ContextErik Schilling2013-02-217-45/+74
| | | | | | | | This should allow to finally call functions to lua without having to care about working around situations where a lua call causes a c++ call which needs to call to lua again. Tested against the source of tales repository data.
* Moved attribute (re)calculation to the scriptsErik Schilling2013-02-041-0/+26
| | | | | | | | | | | | | | | | | | | | | | This introduces two callbacks: - on_update_derived_attribute -> Called to recalculate other derived attributes. - on_recalculate_base_attribute -> Called to recalculate a base attribute (only called for characters. However the function passed as callback can be useful for recalculating the derived attributes as well) Monsters no longer block recalculation of attributes except HP and Speed. I saw no sense to keep this. Fixed constant value in libmana-constants.lua Dropped bool type of the recalculation functions. It would be difficult to keep it while pushing all to the script engine and it was unused anyway. All in all this adds a LOT more flexibillity to projects since they can now adapt all attributes in the way they want.
* Replaced EventListener with signals based on libsigc++Thorbjørn Lindeijer2013-01-095-23/+12
| | | | | | | | | | | | | This replaces the rather hard to understand event dispatcher with a probably even harder to understand templated library, but fortunately we can rely on the available documentation. Hopefully it will also help with the readability of our code and with adding additional signals to other classes. Added libsigc++ to README and Travis CI configuration. Reviewed-by: Erik Schilling
* Micro-optimizations for pushing strings to LuaThorbjørn Lindeijer2013-01-094-37/+29
| | | | | Use lua_pushliteral and lua_pushlstring instead of lua_pushstring, which avoids Lua having to determine the length of the string.
* Added support for Lua 5.2Thorbjørn Lindeijer2013-01-093-1/+23
| | | | Should still work against Lua 5.1 as well.
* Added script binds for getting attack informationErik Schilling2013-01-082-8/+155
| | | | | | | | | | | | | | | | | | | | | | | | | New binds: - Damage: - id - skill - base - delta - cth - element - type - truestrike - range - Attack: - priority - cooldown - warmup - global_cooldown - damage - on_attack - MonsterClass: - attacks - ItemClass: - attacks
* Set the current map when executing being callbacksThorbjørn Lindeijer2013-01-071-0/+2
| | | | | | | | The on_death and on_remove callbacks where not being executed in the context of any map. Now they execute in the context of the map of the being. Reviewed-by: Erik Schilling
* Fixed item_drop insertion of objectErik Schilling2012-08-101-3/+2
|
* Fixed wrong error raising in lua.cppErik Schilling2012-08-051-2/+2
| | | | Reviewed-by: bjorn.
* Removed old warnings and documentation from chr_inv_change.Erik Schilling2012-08-051-7/+3
| | | | | | | This was forgotten to do when dropping the money checks and introducing the checkItem function. Reviewed-by: bjorn.
* Fixed the atinit functionErik Schilling2012-08-051-0/+1
| | | | | | | Previously each map had its own scope. They got merged now but the atinit function was forgotten to adapt. Reviewed-by: bjorn.
* Fixed an error message and inlined some one-linersThorbjørn Lindeijer2012-07-212-30/+29
|
* Removed raiseScriptErrorThorbjørn Lindeijer2012-07-213-37/+24
| | | | | | | It wasn't really adding anything since errors raised using luaL_error are already logged anyway. Reviewed-by: Erik Schilling
* Added lua binds for issuing request of quest variable + bind for trying to ↵Erik Schilling2012-07-171-2/+67
| | | | | | | | | | | read them The difference to the old chr_get_quest bind is that this allows querying quest vars from non npc functions as well. Change is tested. Reviewed-by: bjorn.