Package horizons :: Package world :: Package units :: Module weaponholder :: Class MovingWeaponHolder
[hide private]
[frames] | no frames]

Class MovingWeaponHolder

source code

WeaponHolder --+
               |
              MovingWeaponHolder

Instance Methods [hide private]
 
__init__(self, **kwargs) source code
 
__init(self) source code
 
_stance_tick(self)
Executes every few seconds, doing movement depending on the stance.
source code
 
stop_for(self, ticks)
Delays movement for a number of ticks.
source code
 
_move_and_attack(self, destination, not_possible_action=None, in_range_callback=None)
Callback for moving to a destination, then attack
source code
 
try_attack_target(self)
Attacking loop
source code
 
set_stance(self, stance)
Sets the stance to a specific one and passes the current state
source code
 
go(self, x, y) source code
 
save(self, db) source code
 
load(self, db, worldid) source code
 
user_attack(self, targetid)
Called when the user triggeres the attack, executes the user_attack_issued callbacks
source code
    Inherited from WeaponHolder
 
_add_to_fireable(self, weapon)
Callback executed when weapon attack is ready
source code
 
_increase_fired_weapons_number(self, caller=None)
Callback that helps keeping tack of successful weapon fire number
source code
 
_remove_from_fireable(self, weapon)
Callback executed when weapon is fired
source code
 
act_attack(self, dest)
Override in subclasses for action code
source code
 
add_weapon_to_storage(self, weapon_id)
adds weapon to storage
source code
 
attack(self, target)
Triggers attack on target
source code
 
attack_in_range(self)
Returns True if the target is in range, False otherwise
source code
 
can_attack_position(self, position)
Returns True if the holder can attack position at call time
source code
 
create_weapon_storage(self) source code
 
equip_from_inventory(self, weapon_id, number)
Equips weapon if present in inventory
source code
 
fire_all_weapons(self, dest, rotated=False)
Fires all weapons in storage at a given position
source code
 
get_attack_target(self) source code
 
get_status(self)
Return the current status of the ship.
source code
 
get_weapon_storage(self)
Returns storage object for self._weapon_storage
source code
 
is_attacking(self)
Returns True if the WeaponHolder is trying to attack a target
source code
 
load_target(self, db)
Loads target from database
source code
 
remove(self) source code
 
remove_target(self)
Removes reference from target, this happens when the attack is stopped or the target is dead either way the refs are checked using gc module this is used because after unit death it's possbile that it still has refs
source code
 
remove_weapon_from_storage(self, weapon_id)
removes weapon to storage
source code
 
stop_attack(self) source code
 
unequip_to_inventory(self, weapon_id, number)
Unequips weapon and adds it to inventory
source code
 
update_range(self, caller=None) source code
Class Variables [hide private]
    Inherited from WeaponHolder
  log = logging.getLogger("world.combat")
Method Details [hide private]

__init__(self, **kwargs)
(Constructor)

source code 
Overrides: WeaponHolder.__init__

_stance_tick(self)

source code 

Executes every few seconds, doing movement depending on the stance.

Overrides: WeaponHolder._stance_tick

stop_for(self, ticks)

source code 

Delays movement for a number of ticks. Used when shooting in specialized unit code.

_move_and_attack(self, destination, not_possible_action=None, in_range_callback=None)

source code 

Callback for moving to a destination, then attack

Parameters:
  • destination - moving destination
  • not_possible_action - execute if MoveNotPossible is thrown
  • in_range_callback - sets up a conditional callback that is executed if the target is in range

try_attack_target(self)

source code 

Attacking loop

Overrides: WeaponHolder.try_attack_target

save(self, db)

source code 
Overrides: WeaponHolder.save

load(self, db, worldid)

source code 
Overrides: WeaponHolder.load

user_attack(self, targetid)

source code 

Called when the user triggeres the attack, executes the user_attack_issued callbacks

Parameters:
  • targetid - world id of the unit that is to be attacked
Overrides: WeaponHolder.user_attack
(inherited documentation)