Skip to content

Commit 2c9134b

Browse files
committed
added some debug print statements, actions seem to work
1 parent 9b83fd0 commit 2c9134b

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

npc/pirate/actions.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ def update(self, time):
3939
pos = self.path.pop()
4040
self.parent.environment.set_position(self.parent,
4141
(self.parent.environment, pos))
42-
else:
42+
43+
if not self.path:
4344
self.finish()
4445

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

5960
class DrinkRumAction(ActionContext):
6061
def enter(self):
62+
print "drinking!"
6163
self.drunkness = 1
6264

6365
def update(self, time):
6466
self.drunkness += 1
65-
if self.drunkness == 5:
67+
if self.drunkness >= 3:
68+
print "DRUNK!"
6669
self.finish()
6770

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

9698
exported_actions.append(move_to_entity)
@@ -118,10 +120,11 @@ class drink_rum(ActionBuilder):
118120
"""
119121
def get_actions(self, caller, memory):
120122
for pct in memory.of_class(PositionPrecept):
123+
print "looking for rum", pct
121124
if pct.position[0] == 'self' and pct.entity.name == "rum":
122125
action = DrinkRumAction(caller)
123126
action.effects.append(SimpleGoal(is_drunk=True))
124-
action.effects.append(EvalGoal("charisma = charisma + 10"))
127+
#action.effects.append(EvalGoal("charisma = charisma + 10"))
125128
yield action
126129

127130

pathfinding/astar.py

-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ def search(start, finish, factory):
6060

6161
finishNode = factory(finish)
6262
startNode = factory(start)
63-
print finishNode, startNode
6463
startNode.h = calcH(startNode, finishNode)
6564

6665
# used to locate nodes in the heap and modify their f scores

pygoap/agent.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def replan(self):
9797
s = [ g for g in s if g[0] > 0.0 ]
9898
s.sort(reverse=True)
9999

100-
debug("[agent] goals %s", s)
100+
debug("[agent] %s goals %s", self, s)
101101

102102
start_action = NullAction
103103

pygoap/tiledenvironment.py

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def render(self, surface):
2929

3030
for t in self.entities:
3131
env, (x, y) = self.get_position(t)
32-
print env, x, y
3332
x *= self.tiledmap.tilewidth
3433
y *= self.tiledmap.tileheight
3534

0 commit comments

Comments
 (0)