Ejemplo n.º 1
0
 def __init__(self, *args):
     """Init the RoutingShowcaseWiggler person."""
     Person.__init__(self, *args)
     self.dest_node = self.next_node
     self.p_color_rgba = COLOR[self.p_id]
     self.routed = True
     self.next_target = self.next_target_routed
Ejemplo n.º 2
0
    def handle_interrupts(self):
        """Find out, what caused an interrupt and act accordingly.

        This method is called whenever a person is interrupted.
        This is the place to implement own reactions to interrupts. Calling methods that were send via a send() call is done BEFORE this method is called. Handling pause, stop, removal and change of movement speed is done automatically AFTER this method is called. Removing the corresponding flag (setting it to False) in this method allows for handling these things on your own.
        @note: This method does nothing per default. Implement it to react to interrupts. If you do not want or need to react to interrupts, ignore this method.
        """
        Person.handle_interrupts(self)
Ejemplo n.º 3
0
 def pause_movement(self, duration, location_offset_xy=0, deactivateActions=False):
     """Stops movement of person. Currently only works with passivating at next_node.  
     Currently cannot be used to stop on a way like after infect!
     @param duration: pause duration
     @param location_offset_xy: optional random offset to be added to current location when stopping.
     @param deactivateActions: deactive actions while pausing?
     
     """
     Person.pause_movement(self, duration, location_offset_xy=0, deactivateActions=False)
Ejemplo n.º 4
0
 def __init__(self, *args, **kwargs):
     """Inits the PoiWiggler person."""
     super(PoiWiggler, self).__init__(*args, **kwargs)
     Person.__init__(self, *args)
     self.dest_node = self.next_node
     if kwargs.get("cafes"):
         self.cafes = kwargs["cafes"]    #: list of all cafes in osm data
     else:
         self.cafes = None               #: list of all cafes in osm data
     self.p_state = GO_SOMEWHERE
     self.p_cafe = None
     self.p_color = self.p_id
     self.p_color_rgba = COLOR[self.p_id]
     self.next_target = self.next_target_routed
Ejemplo n.º 5
0
    def receive(self, message, sender):
        """Receive a message and handle it.

        Removal from the message queue and earliest arrival time are handled automatically.

        @param message: a message from the persons message queue.
        @param sender: the sender of the message.
        @return: True if the message should be removed from the queue, False else. It will then be delivered again in the next cycle.

        """
        return Person.receive(self, message, sender)
Ejemplo n.º 6
0
    def __init__(self, *args):
        """Inits the working man."""
        Person.__init__(self, *args)

        w_id = self._random.choice(WORKPLACES)
        for node in self.sim.geo.way_nodes:
            if node.id == w_id:
                self.p_workplace_node = node
                break
        else:
            raise Exception('No workplace found')

        self.p_wakeup_time = self._random.randint(6000, 8000)
        self.p_home_time = self._random.randint(16000, 18000)
        
        self.dest_node = self.next_node
        self.home_node = self.last_node
        self.p_state = 'SLEEP'
        self.p_color = 2
        self.p_color_rgba = (0.1, 1.0, 0.1, 1.0)
Ejemplo n.º 7
0
 def reactivate(self, at = 'undefined', delay = 'undefined', prior = False):
     """Reactivates passivated person and optionally restarts stopped actions."""
     Person.reactivate(self)