mirror of
https://github.com/worldforge/cyphesis
synced 2026-08-13 12:26:04 -04:00
* rulesets/basic/mind/goals/animal/domestic.py, rulesets/basic/mind/goals/animal/herd.py, rulesets/basic/mind/goals/common/misc_goal.py, rulesets/basic/mind/goals/common/trigger.py, rulesets/basic/mind/goals/dynamic/add_unique_goal.py, rulesets/basic/mind/goals/humanoid/construction.py, rulesets/basic/mind/goals/humanoid/fire.py, rulesets/basic/mind/goals/humanoid/mason.py, rulesets/basic/mind/goals/humanoid/transaction.py: Add nominal doc strings to some goal classes.
31 lines
1.3 KiB
Python
31 lines
1.3 KiB
Python
#This file is distributed under the terms of the GNU General Public license.
|
|
#Copyright (C) 1999 Aloril (See the file COPYING for details).
|
|
|
|
from mind.Goal import Goal
|
|
from mind.goals.common.move import move_me
|
|
from mind.goals.dynamic.add_unique_goal import add_unique_goal_by_perception
|
|
|
|
class extinguish_fire(Goal):
|
|
"""Put out a specified fire."""
|
|
def __init__(self, what):
|
|
Goal.__init__(self,"extinguish fire",
|
|
self.fire_extinguished,
|
|
[move_me(what.location),self.extinguish])
|
|
self.what=what
|
|
self.vars=["what"]
|
|
def fire_extinguished(self, me):
|
|
fire=me.map.get(self.what.id)
|
|
if not fire:
|
|
self.irrelevant=1 #remove this goal
|
|
return 1
|
|
return 0
|
|
def extinguish(self, me):
|
|
return Operation("extinguish",Entity(self.what.id),to=self.what)
|
|
|
|
class add_extinguish_fire(add_unique_goal_by_perception):
|
|
"""Respond to spotting a fire by adding a goal to extinguish it."""
|
|
def __init__(self, desc="add extinguish fire goal"):
|
|
add_unique_goal_by_perception.__init__(self,
|
|
extinguish_fire,
|
|
trigger="sight_burn",
|
|
desc=desc)
|