From f8e816d9185c09d1c17d921b775e483d132982e5 Mon Sep 17 00:00:00 2001 From: Erik Schilling Date: Tue, 3 Apr 2012 13:29:05 +0200 Subject: Enhanced special support - Made the current charge being saved. - Added script binds: - chr_set_special_recharge_speed - chr_get_special_recharge_speed - chr_set_special_mana - chr_get_special_mana - get_special_info - Added special info lua class. Functions: - name - needed_mana - rechargeable - on_use - on_recharged - category Further the engine no longer sets charge to 0 after using of specials this allows more flexbilillity (like failing specials). Changes on the xml database: - recharge renamed to rechargeable (needed by client and server) - needed - the needed mana to trigger a special (server only) - rechargespeed - the defailt recharge speed in mana per tick (server only) - target - the type of target (either being or point) (server and client) I also made the lua engine pushing nil instead of a 0 light userdata when the pointer was 0. Database update needed. Change is tested. Mana-Mantis: #167, #156 Reviewed-by: bjorn. --- src/scripting/scriptmanager.cpp | 33 --------------------------------- 1 file changed, 33 deletions(-) (limited to 'src/scripting/scriptmanager.cpp') diff --git a/src/scripting/scriptmanager.cpp b/src/scripting/scriptmanager.cpp index c133a5e..76c4dae 100644 --- a/src/scripting/scriptmanager.cpp +++ b/src/scripting/scriptmanager.cpp @@ -51,39 +51,6 @@ Script *ScriptManager::currentState() return _currentState; } -// TODO: Have some generic event mechanism rather than calling global functions - -void ScriptManager::addDataToSpecial(int id, Special *special) -{ - /* currently only gets the recharge cost. - TODO: get any other info in a similar way, but - first we have to agree on what other - info we actually want to provide. - */ - if (special && _getSpecialRechargeCostCallback.isValid()) - { - _currentState->prepare(_getSpecialRechargeCostCallback); - _currentState->push(id); - int scriptReturn = _currentState->execute(); - special->neededMana = scriptReturn; - } -} - -bool ScriptManager::performSpecialAction(int specialId, Being *caster) -{ - if (!_specialCallback.isValid()) - { - LOG_WARN("No callback for specials set! Specials disabled."); - return false; - } - - _currentState->prepare(_specialCallback); - _currentState->push(caster); - _currentState->push(specialId); - _currentState->execute(); - return true; -} - bool ScriptManager::performCraft(Being *crafter, const std::list &recipe) { -- cgit