From 4c11ea4b779470d67cad2f6a060a51424625cff9 Mon Sep 17 00:00:00 2001 From: Joe Wreschnig Date: Sat, 24 Apr 2010 01:43:07 -0700 Subject: [PATCH] FireDef.__call__: Minor optimizations. --- bulletml/parser.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/bulletml/parser.py b/bulletml/parser.py index 150ca45..1470ed3 100644 --- a/bulletml/parser.py +++ b/bulletml/parser.py @@ -816,15 +816,15 @@ class FireDef(object): def __call__(self, owner, action, params, rank, created): direction, speed, tags, appearance, actions = self.bullet( owner, action, params, rank, created) - if self.direction: + if self.direction is not None: direction = self.direction(params, rank) - if self.speed: + if self.speed is not None: speed = self.speed(params, rank) tags = tags.union(self.tags) - if self.appearance: + if self.appearance is not None: appearance = self.appearance - if direction: + if direction is not None: direction, type = direction if type == "aim" or type is None: direction += owner.aim @@ -836,7 +836,7 @@ class FireDef(object): direction = owner.aim action.previous_fire_direction = direction - if speed: + if speed is not None: speed, type = speed if type == "sequence": speed += action.previous_fire_speed @@ -851,8 +851,9 @@ class FireDef(object): speed = 1 action.previous_fire_speed = speed - x, y = owner.x, owner.y - if self.offset: + x = owner.x + y = owner.y + if self.offset is not None: off_x, off_y = self.offset(params, rank) if self.offset.type == "relative": s = sin(direction) -- 2.20.1