changeset 171:565ffdd98d68

Added math functions to the scripting system functions.
author Beliar <KarstenBock@gmx.net>
date Sun, 26 Feb 2012 01:24:33 +0100
parents 0296f5f74a0f
children 5d47ad053aef
files systems/scriptingsystem.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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
+