Package horizons :: Package world :: Package disaster :: Module buildinginfluencingdisaster :: Class BuildingInfluencingDisaster
[hide private]
[frames] | no frames]

Class BuildingInfluencingDisaster

source code

util.changelistener.ChangeListener --+        
                                     |        
          util.worldobject.WorldObject --+    
                                         |    
                                  Disaster --+
                                             |
                                            BuildingInfluencingDisaster

Simulates a building influencing disaster.

Starts at a certain building and will spread out over time.

Instance Methods [hide private]
 
__init__(self, settlement, manager) source code
 
save(self, db) source code
 
load(self, db, worldid) source code
 
breakout(self)
Picks (a) object(s) to start a breakout.
source code
 
expand(self)
Called to make the disaster expand further
source code
 
end(self)
End this class, used for cleanup.
source code
 
infect(self, building, load=None)
Used to expand disaster to this building.
source code
 
recover(self, building)
Inverse of infect().
source code
 
evaluate(self)
Called to evaluate if this disaster is still active
source code
 
wreak_havoc(self, building)
The implementation to whatever the disaster does to affected objects goes here
source code
    Inherited from util.worldobject.WorldObject
 
__lt__(self, other) source code
 
remove(self) source code
    Inherited from util.changelistener.ChangeListener
 
_changed(self)
Calls every listener when an object changed
source code
 
add_change_listener(self, listener, call_listener_now=False, no_duplicates=False) source code
 
add_remove_listener(self, listener, no_duplicates=False)
A listener that listens for removal of the object
source code
 
clear_change_listeners(self)
Removes all change listeners
source code
 
discard_change_listener(self, listener)
Remove listener if it's there
source code
 
discard_remove_listener(self, listener) source code
 
has_change_listener(self, listener) source code
 
has_remove_listener(self, listener) source code
 
remove_change_listener(self, listener) source code
 
remove_remove_listener(self, listener) source code
Class Methods [hide private]
 
can_breakout(cls, settlement)
Returns whether or not a disaster can break out in the settlement
source code
    Inherited from util.worldobject.WorldObject
 
get_object_by_id(cls, id)
Returns the worldobject with id id Throws WorldObjectNotFound with the worldid as arg.
source code
 
get_objs(cls) source code
 
reset(cls) source code
Class Variables [hide private]
  BUILDING_TYPE = 3
  MIN_BREAKOUT_TIER = 1
hash(x)
  MIN_INHABITANTS_FOR_BREAKOUT = 5
  STATUS_ICON = None
hash(x)
  RESCUE_BUILDING_TYPE = None
hash(x)
  EXPANSION_RADIUS = 0
  TIME_BEFORE_HAVOC = GAME_SPEED.TICKS_PER_SECOND* 30
  EXPANSION_TIME = TIME_BEFORE_HAVOC// 2-1
    Inherited from Disaster
  DISASTER_RES = None
hash(x)
  SEED_CHANCE = 0.5
  TYPE = None
hash(x)
  log = logging.getLogger("world.disaster")
Method Details [hide private]

__init__(self, settlement, manager)
(Constructor)

source code 
Parameters:
  • settlement - Settlement instance this disaster operates on
  • manager - The disaster manager that initiated this disaster
Overrides: util.changelistener.ChangeListener.__init__

save(self, db)

source code 
Overrides: util.worldobject.WorldObject.save

load(self, db, worldid)

source code 
Overrides: util.changelistener.ChangeListener.load

breakout(self)

source code 

Picks (a) object(s) to start a breakout.

Overrides: Disaster.breakout
(inherited documentation)

can_breakout(cls, settlement)
Class Method

source code 

Returns whether or not a disaster can break out in the settlement

Overrides: Disaster.can_breakout
(inherited documentation)

expand(self)

source code 

Called to make the disaster expand further

Overrides: Disaster.expand
(inherited documentation)

end(self)

source code 

End this class, used for cleanup. Called by the DisasterManager in end_disaster() automatically

Overrides: util.changelistener.ChangeListener.end

infect(self, building, load=None)

source code 

Used to expand disaster to this building. Usually called by expand and breakout

Overrides: Disaster.infect

recover(self, building)

source code 

Inverse of infect(). Is also called when buildings are torn down by the user.

Overrides: Disaster.recover
(inherited documentation)

evaluate(self)

source code 

Called to evaluate if this disaster is still active

Overrides: Disaster.evaluate
(inherited documentation)

wreak_havoc(self, building)

source code 

The implementation to whatever the disaster does to affected objects goes here

Overrides: Disaster.wreak_havoc
(inherited documentation)