Source code for yracing.weapon.weapon.logic

from yyagl.gameobject import LogicColleague


[docs]class WeaponLogic(LogicColleague): def __init__(self, mediator, car, cars, wpn_id): LogicColleague.__init__(self, mediator) self.car = car self.cars = cars self.wpn_id = wpn_id self.has_fired = False
[docs] def update_props(self, pos, fwd): pass
[docs] def fire(self, sfx): if sfx: self.mediator.audio.sfx.play() self.has_fired = True
[docs] def destroy(self): self.car = self.cars = None self.notify('on_weapon_destroyed', self.mediator) LogicColleague.destroy(self)
[docs]class WeaponLogicNetwork(WeaponLogic):
[docs] def update_props(self, pos, fwd): if pos == (0, 0, 0) and fwd == (0, 0, 0): return self.mediator.gfx.update_props(pos, fwd)
[docs] def update_fired_props(self, pos, fwd): if pos == (0, 0, 0) and fwd == (0, 0, 0): return self.mediator.gfx.update_fired_props(pos, fwd)