Skip to content

Commit

Permalink
added some debug print statements, actions seem to work
Browse files Browse the repository at this point in the history
  • Loading branch information
bitcraft committed Apr 23, 2013
1 parent 9b83fd0 commit 2c9134b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
11 changes: 7 additions & 4 deletions npc/pirate/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ def update(self, time):
pos = self.path.pop()
self.parent.environment.set_position(self.parent,
(self.parent.environment, pos))
else:

if not self.path:
self.finish()

def setStartpoint(self, pos):
Expand All @@ -58,11 +59,13 @@ class PickupAction(CalledOnceContext):

class DrinkRumAction(ActionContext):
def enter(self):
print "drinking!"
self.drunkness = 1

def update(self, time):
self.drunkness += 1
if self.drunkness == 5:
if self.drunkness >= 3:
print "DRUNK!"
self.finish()

exported_actions = []
Expand Down Expand Up @@ -90,7 +93,6 @@ def get_actions(self, caller, memory):
action.setStartpoint(here)
action.setEndpoint(pct.position[1])
action.effects.append(PositionGoal(caller, pct.position))
print ">>> MOVE >>>", action, action.startpoint, action.endpoint
yield action

exported_actions.append(move_to_entity)
Expand Down Expand Up @@ -118,10 +120,11 @@ class drink_rum(ActionBuilder):
"""
def get_actions(self, caller, memory):
for pct in memory.of_class(PositionPrecept):
print "looking for rum", pct
if pct.position[0] == 'self' and pct.entity.name == "rum":
action = DrinkRumAction(caller)
action.effects.append(SimpleGoal(is_drunk=True))
action.effects.append(EvalGoal("charisma = charisma + 10"))
#action.effects.append(EvalGoal("charisma = charisma + 10"))
yield action


Expand Down
1 change: 0 additions & 1 deletion pathfinding/astar.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ def search(start, finish, factory):

finishNode = factory(finish)
startNode = factory(start)
print finishNode, startNode
startNode.h = calcH(startNode, finishNode)

# used to locate nodes in the heap and modify their f scores
Expand Down
2 changes: 1 addition & 1 deletion pygoap/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def replan(self):
s = [ g for g in s if g[0] > 0.0 ]
s.sort(reverse=True)

debug("[agent] goals %s", s)
debug("[agent] %s goals %s", self, s)

start_action = NullAction

Expand Down
1 change: 0 additions & 1 deletion pygoap/tiledenvironment.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def render(self, surface):

for t in self.entities:
env, (x, y) = self.get_position(t)
print env, x, y
x *= self.tiledmap.tilewidth
y *= self.tiledmap.tileheight

Expand Down

0 comments on commit 2c9134b

Please sign in to comment.