# HG changeset patch # User Beliar # Date 1330215873 -3600 # Node ID 565ffdd98d68e3c1b3daea0e6c0fc218c982e1cf # Parent 0296f5f74a0f1a79cae656cc6d73d8ede92ec589 Added math functions to the scripting system functions. diff -r 0296f5f74a0f -r 565ffdd98d68 systems/scriptingsystem.py --- a/systems/scriptingsystem.py Sat Feb 25 22:05:39 2012 +0100 +++ b/systems/scriptingsystem.py Sun Feb 26 01:24:33 2012 +0100 @@ -13,6 +13,7 @@ from collections import deque from copy import deepcopy +import math from parpg.bGrease import System @@ -83,7 +84,11 @@ def __init__(self, commands, actions): """Constructor""" - self.funcs = {} + self.funcs = {} + self.common_funcs = { + "sqrt":math.sqrt, + "log":math.log, + } self.vals = {} self.commands = commands self.actions = actions @@ -110,6 +115,7 @@ ) self.funcs.clear() self.funcs.update(self.game_state.funcs) + self.funcs.update(self.common_funcs) for condition_data in self.conditions: condition = condition_data[0] script_name = condition_data[1] @@ -152,4 +158,4 @@ if self.scripts.has_key(name): self.scripts[name].running = True - \ No newline at end of file +