def task_work_report(self,task,dt):
     if not task: return
     need = need_from_task(task.name)
     
     if need == 'Charge':
         available = 0 if not hasattr(task.target, 'charge') else max(task.target.charge,0)
         used=self.needs['Charge'].supply( available, dt )
         task.target.charge -= used
 def task_finished(self,task):
     if not task: return
     need = need_from_task(task.name)
     if need:             
         if need == 'Food' and self.needs['Food'].severity == 'HIGH':
             amt=self.needs[need].amt
             self.needs['Food']=Need('Food', self, 0.62, 0.62/86400.0, 0.62/1800.0, self.new_dinner_task, self.hunger_hit,severity='HUMAN_BIOLOGICAL')
             self.needs[need].amt=amt
         elif need == 'Water' and self.needs['Water'].severity == 'CRITICAL':
             amt=self.needs[need].amt
             self.needs['Water']=Need('Water', self, 3.52, 3.52/86400.0, 3.52/60.0, self.new_drink_task, self.dehydration_hit,severity='HUMAN_BIOLOGICAL')
             self.needs[need].amt=amt
         elif need == 'WasteCapacitySolid' and isinstance(task.target,lifesupport.UniversalToilet):
             task.target.deposit(amt2 = self.needs[need].max_amt - self.needs[need].amt)
             self.needs[need].set_amt_to_severity('IGNORABLE')     
         if need in ['WasteCapacityLiquid', 'WasteCapacitySolid'] and isinstance(task.target,lifesupport.UniversalToilet):
             task.target.deposit(amt1 = self.needs['WasteCapacityLiquid'].max_amt - self.needs['WasteCapacityLiquid'].amt)
             self.needs['WasteCapacityLiquid'].set_amt_to_severity('IGNORABLE')  
 def task_work_report(self,task,dt):
     if not task: return
     need = need_from_task(task.name)
     need_pristines = {  'Food':'Edible Food', 
                         'Water':'Potable Water'}
     
     if need in need_pristines.keys():
         target=task.target
         if isinstance(task.target, Storage):
             target = task.target.stowage.search(ClutterFilter(need_pristines[need]))
         if not target: return                        
             
         #"eat" - TODO make a more detailed nutrition model for things like scurvy            
         eaten = self.needs[need].supply( target.mass , dt )
         if need == 'Food':
             self.nutrition = [util.quad_mean(self.nutrition[eu],target.quality['Nutrient'][eu],10,eaten) for eu,u in enumerate(self.nutrition)]
             #print 'New Nutrition!' ,self.nutrition, target.mass, eaten, self.needs['Food'].max_amt
         target.mass -= eaten
         
         if self.needs[need].status()[0] > 0.98: task.flag('COMPLETED')