[game-baker commit] r308 - in trunk/trunk/demos/restaurant: . sprites

0 views
Skip to first unread message

codesite...@google.com

unread,
Mar 1, 2009, 2:53:47 PM3/1/09
to game-ba...@googlegroups.com
Author: kurtwoloch
Date: Sun Mar 1 11:41:04 2009
New Revision: 308

Added:
trunk/trunk/demos/restaurant/Restaurant demo instructions.odt
(contents, props changed)
trunk/trunk/demos/restaurant/changelog.txt
trunk/trunk/demos/restaurant/sprites/dishspaghetti.gbs
Modified:
trunk/trunk/demos/restaurant/restaurant.gb

Log:


Added: trunk/trunk/demos/restaurant/Restaurant demo instructions.odt
==============================================================================
Binary file. No diff available.

Added: trunk/trunk/demos/restaurant/changelog.txt
==============================================================================
--- (empty file)
+++ trunk/trunk/demos/restaurant/changelog.txt Sun Mar 1 11:41:04 2009
@@ -0,0 +1,57 @@
+differences in Restaurant Demo to previous version:
+
+All in all:
+- added an instruction file
+- The status of the cook now gets displayed next to him
+- The order in which items get processed by the cook has been modified:
+ - cook first processes drinks, then foods
+ - cook processes foods of the same type consecutively, saving time
+- additional messages in the status bar, such as when customers have
finished and want to pay
+- additional messeges on the game ending screen, tallying up customer
numbers and tips
+- added an oven and multiple preparation stages for food (preparing by
cook -> oven -> finishing by cook)
+
+Broken down by workstates:
+
+wscookstatus: cookstatus
+ new workstate; displays status of cook (working, idle, cooking etc.)
+
+wsmenusign: menusign
+ new workstate; handles display of the sign displaying today's special
+
+wscook
+ order of dish preperation has been changed from "first in, first out"
to the following:
+ - if multiple orders of the same type have been entered, cook prepares
them consecutively, saving time
+ - next, cook prepares all drinks before food in order to be able to
serve drinks quickly
+
+
+wscustomerconsume
+ additional message when all customers on a table have finished and want
to pay
+
+wscustomerleave
+ tally up number of groups and customers that visited
+
+wscustomerorder:
+ EVENT_INIT: accounted for possible new food_state "cooking"
+
+wscustomerstart: no significant changes
+
+wscustomerwaitforwaiter:
+ EVENT_ITERATION: tally up lost customers
+
+wsmastercustomer
+ EVENT_INIT: initalize oven
+ expanded ingredients table to accomodate multiple preparation stages
for food (cook -> oven -> cook)
+
+wsplayerclose
+ EVENT_INIT: display number of served customers and groups, lost
customers, tips earned
+
+wsplayermenu
+ EVENT_INIT: additional menu item "Place ad" (not used)
+
+wsplayerstart
+ EVENT_INIT: initialize additional variables for customers visited,
groups visited, customers lost and tips
+ EVENT_ITERATION: tally up collected tips
+ Tuned position of empty dishes that get laid off
+
+wsstatusline
+ inserted code for clearing the status line after 2 seconds, but
commented it out
\ No newline at end of file

Modified: trunk/trunk/demos/restaurant/restaurant.gb
==============================================================================
--- trunk/trunk/demos/restaurant/restaurant.gb (original)
+++ trunk/trunk/demos/restaurant/restaurant.gb Sun Mar 1 11:41:04 2009
@@ -2,7 +2,7 @@
# LEAVE THE FOLLOWING TWO LINES
# GAME BAKER
# yaml
-# 0
+# 1
s = """
!!python/object:game.Game
gameobjects:
@@ -38,6 +38,14 @@
sprite: gb_cook
x: 410
y: 10
+ cookstatus: &id004 !!python/object:game.GameObject
+ baseworkstate: wscookstatus
+ name: cookstatus
+ objtype: Gameobject
+ requires: []
+ sprite: null
+ x: 450
+ y: 0
customer: !!python/object:game.GameObject
baseworkstate: wscustomerstart
name: customer
@@ -78,14 +86,6 @@
sprite: menues
x: 5
y: 80
- menusign: &id004 !!python/object:game.GameObject
- baseworkstate: wsmenusign
- name: menusign
- objtype: Gameobject
- requires: []
- sprite: null
- x: 0
- y: 20
player: &id001 !!python/object:game.GameObject
baseworkstate: wsplayerstart
name: player
@@ -140,6 +140,7 @@
startobjects: []
initcode: ''
objtype: Game
+sounds: {}
sprites:
background: !!python/object:game.Sprite
alphakey: !!python/tuple [0, 255, 0]
@@ -736,6 +737,8 @@

self.returned_orders = []

+ self.cooked_orders = []
+
self.preptime=0

self.minx=460
@@ -744,27 +747,27 @@

self.last_order = -1

- ', 3: "if self.collision_player == 1:\\n\\n#cook takes orders from
waiter\\n\\n\\
- \\ self.collision_player = 0\\n orders_taken = 0\\n ply =
gamescreen.gameobjects[\\"\\
- player\\"]\\n for order in ply.orders:\\n if order[1] ==
\\"ordered\\":\\n\\
- \\ order[1] = \\"entered\\"\\n
self.orders.append(order)\\n \\
- \\ self.sprite = \\"gb_cookworking\\"\\n orders_taken
= orders_taken\\
- \\ + 1\\n\\n #print \\"Cook:\\"\\n #print self.orders\\n
ply.orders = []\\n\\
- \\ if orders_taken > 0:\\n
gamescreen.gameobjects[\\"statusline\\"].new_message\\
- \\ = str(orders_taken) + \\" orders given to cook\\"\\n\\n # for
dishes player\\
- \\ is currently carrying, check if the table they belong to still
have a customer\\
- \\ that ordered them\\n \\n print \\"checking for order
validity\\"\\n for\\
- \\ i in range(0,len(ply.objects)):\\n order_found = 0\\n
if ply.objects[i].sprite\\
- \\ <> \\"menu\\":\\n if ply.objects[i].order[1] ==
\\"carrying\\":\\n \\
- \\ if ply.objects[i].order[2] == -1: # object
has already\\
- \\ been rendered invalid at table\\n order_found =
0\\n \\
- \\ else: \\n tb =
gamescreen.gameobjects[\\"table\\" + str(ply.objects[i].order[2])]\\n\\
- \\ for j in
range(0,len(tb.occupants)):\\n for\\
- \\ k in
range(0,len(tb.occupants[j].orders)):\\n if
tb.occupants[j].orders[k][0]\\
- \\ == ply.objects[i].order[0]:\\n
order_found = 1\\n \\
- \\ break\\n if order_found ==
0:\\n \\
- \\ temptable = ply.objects[i].order[2]\\n
ply.objects[i].order[1]\\
- \\ = \\"cancelled\\"\\n
self.returned_orders.append(ply.objects[i].order)\\n\\
+ ', 3: "# first check for collisions of cook with player\\n\\nif
self.collision_player\\
+ \\ == 1:\\n\\n#cook takes orders from waiter\\n\\n
self.collision_player = 0\\n\\
+ \\ orders_taken = 0\\n ply =
gamescreen.gameobjects[\\"player\\"]\\n for\\
+ \\ order in ply.orders:\\n if order[1] ==
\\"ordered\\":\\n order[1]\\
+ \\ = \\"entered\\"\\n self.orders.append(order)\\n
self.sprite\\
+ \\ = \\"gb_cookworking\\"\\n orders_taken = orders_taken +
1\\n\\n #print\\
+ \\ \\"Cook:\\"\\n #print self.orders\\n ply.orders = []\\n
if orders_taken\\
+ \\ > 0:\\n
gamescreen.gameobjects[\\"statusline\\"].new_message = str(orders_taken)\\
+ \\ + \\" orders given to cook\\"\\n\\n # for dishes player is
currently carrying,\\
+ \\ check if the table they belong to still have a customer that
ordered them\\n\\
+ \\ \\n print \\"checking for order validity\\"\\n for i in
range(0,len(ply.objects)):\\n\\
+ \\ order_found = 0\\n if ply.objects[i].sprite <>
\\"menu\\":\\n \\
+ \\ if ply.objects[i].order[1] == \\"carrying\\":\\n
if ply.objects[i].order[2]\\
+ \\ == -1: # object has already been rendered invalid at
table\\n \\
+ \\ order_found = 0\\n else:
\\n tb = gamescreen.gameobjects[\\"\\
+ table\\" + str(ply.objects[i].order[2])]\\n for j in
range(0,len(tb.occupants)):\\n\\
+ \\ for k in
range(0,len(tb.occupants[j].orders)):\\n \\
+ \\ if tb.occupants[j].orders[k][0] ==
ply.objects[i].order[0]:\\n\\
+ \\ order_found =
1\\n break\\n\\
+ \\ if order_found == 0:\\n temptable =
ply.objects[i].order[2]\\n\\
+ \\ ply.objects[i].order[1] =
\\"cancelled\\"\\n
self.returned_orders.append(ply.objects[i].order)\\n\\
\\ ply.objects[i].destroy()\\n del
ply.objects[i]\\n\\
\\n # if a dish has been cancelled, check other
entered orders\\
\\ if they belong to the same table and are still
valid\\n\\n if\\
@@ -781,74 +784,176 @@
\\ temporder[1] = \\"cancelled\\"\\n print
\\"checking invalid\\
\\ orders complete\\"\\n\\n # stop going through
player objects\\
\\ because the list has changed\\n
break \\n \\
- \\ \\nif self.sprite == \\"gb_cookworking\\":\\n if
self.preptime == 0:\\n\\
- \\n # get new order to prepare if there are any
left\\n\\n temporder\\
- \\ = [\\"no order\\"]\\n\\n # first search for order that is
the same as the\\
- \\ last one\\n\\n for i in range(0,
len(self.orders)):\\n temporder\\
- \\ = self.orders[i] \\n if temporder[1] == \\"entered\\"
and temporder[0]\\
- \\ == self.last_order:\\n temporder[1] =
\\"preparing\\"\\n \\
- \\ break\\n\\n # next search for drinks\\n\\n
else:\\n for\\
- \\ i in range(0, len(self.orders)):\\n temporder =
self.orders[i]\\
- \\ \\n if temporder[1] == \\"entered\\" and
game.menu_content[temporder[0]][3]\\
- \\ == \\"drink\\":\\n temporder[1] =
\\"preparing\\"\\n \\
- \\ break\\n\\n \\n # last look for other open
orders\\n else:\\n\\
- \\ for i in range(0,
len(self.orders)):\\n temporder\\
- \\ = self.orders[i] \\n if temporder[1] ==
\\"entered\\":\\n \\
- \\ temporder[1] = \\"preparing\\"\\n
break\\n\\n \\
- \\ print \\"oders after checking: \\", temporder\\n if
temporder <> [\\"\\
- no order\\"]:\\n if temporder[1] ==
\\"preparing\\":\\n self.prep_order_item\\
- \\ = game.menu_content[temporder[0]]\\n\\n # search
ingredient table\\
- \\ for ingredients for this item\\n # go through
cancelled orders;\\
- \\ if we find one for the same thing, slash ingredient need and
preptime\\n\\
- \\ \\n for j in range(0,
len(self.orders)):\\n temporder2\\
- \\ = self.orders[j]\\n if temporder[1] ==
\\"cancelled\\":\\n \\
- \\ if temporder[0] ==
temporder2[0]:\\n temporder[1]\\
- \\ = \\"used up\\"\\n self.preptime = 0.2 *
game.frames_per_minute\\
- \\ \\n break\\n \\n if
self.preptime\\
- \\ <= 0:\\n for j in
game.ingredients:\\n\\n #\\
- \\ if we found it in that table, go through this
list\\n\\n \\
- \\ if j[0] == self.prep_order_item[0]:\\n for
k in j: #\\
- \\ k loops through every needed ingredient for the item we want to
prepare\\n\\
- \\ for l in range(0,
len(game.storage)):\\n \\
- \\ if game.storage[l][0] ==
k[0]:\\n \\
- \\ game.storage[l][1] = game.storage[l][1] -
k[1]\\n \\
- \\ game.ingredient_costs = game.ingredient_costs
+ k[1] *\\
- \\ game.storage[l][2]\\n # print
\\"ingredient\\
- \\ costs: \\",
game.ingredient_costs\\n break\\n\\
- \\ break\\n\\n self.preptime =
self.prep_order_item[2]\\
- \\ * game.frames_per_minute\\n if temporder[0] ==
self.last_order:\\n\\
- \\ self.preptime = self.preptime *
0.5\\n self.orders[i]\\
- \\ = temporder\\n \\n # get dishes if there are any to
wash\\n\\n \\
- \\ if self.preptime == 0 and len(self.dirty_dishes) > 0: #
only check this\\
- \\ if no orders were found\\n self.last_order =
-1\\n dish = self.dirty_dishes[0]\\n\\
- \\ for check_dish in game.dishlist:\\n if
check_dish[1] == dish.sprite:\\n\\
- \\ self.preptime = check_dish[2] *
game.frames_per_minute\\n \\
- \\ print \\"washing\\", check_dish[0]\\n
self.dirty_dishes[0].destroy()\\n\\
- \\ del self.dirty_dishes[0]\\n break\\n
\\n if\\
- \\ self.preptime == 0:\\n self.sprite =
\\"gb_cook\\"\\n self.last_order\\
- \\ = -1\\n # else:\\n # print self.orders\\n
else:\\n if gamescreen.check_collisions(\\"\\
+ \\ \\n# next check if cook is currently working\\n\\nif
self.sprite == \\"\\
+ gb_cookworking\\":\\n\\n # check if cook has finished working on
an item (or\\
+ \\ has been started)\\n\\n if self.preptime == 0:\\n\\n #
get new order\\
+ \\ to prepare if there are any left\\n\\n temporder = [\\"no
order\\"]\\n\\n\\
+ \\ # first search for orders that have finished
cooking\\n\\n if self.cooked_orders\\
+ \\ <> []:\\n print \\"cooked order detected\\"\\n
temporder = self.cooked_orders.pop(0)\\n\\
+ \\ for i in range(0, len(self.orders)):\\n
temporder = self.orders[i]\\n\\
+ \\ if len(temporder) > 4:\\n if
temporder[4] == -3\\
+ \\ and temporder[1] == \\"cooking\\":\\n\\n # check
if this order\\
+ \\ has another preparation step due\\n # look up
correct preparation\\
+ \\ instructions\\n\\n temporder[1] =
\\"preparing\\"\\n \\
+ \\ dishname =
game.menu_content[temporder[0]][0]\\n \\
+ \\ for j in game.ingredients:\\n if j[0] ==
dishname:\\n\\
+ \\ break\\n\\n # check if
order has reached\\
+ \\ the last preparation stage\\n\\n print
\\"order at stage\\"\\
+ , temporder[3], \\"of \\", str(len(j)-1), j\\n if
temporder[3]\\
+ \\ < (len(j) - 1):\\n\\n # if not, advance
preparation stage\\
+ \\ and check what it is\\n\\n temporder[3] =
temporder[3]\\
+ \\ + 1\\n if j[temporder[3]][0] ==
\\"Cook\\":\\n \\
+ \\ self.preptime = j [temporder[3]][1] *
game.frames_per_minute\\n\\
+ \\
gamescreen.gameobjects[\\"cookstatus\\"].new_message\\
+ \\ = \\"finishing \\" + game.menu_content[temporder[0]][0] + \\"
for table \\"\\
+ \\ + str(temporder[2])\\n
self.prep_order_item = game.menu_content[temporder[0]]\\
+ \\ \\n elif j[temporder[3]][0] ==
\\"Oven\\":\\n \\
+ \\ temporder[1] =
\\"cooking\\"\\n game.ovenlist.append(temporder)\\n\\
+ \\ self.set_timer(temporder[3] *
game.frames_per_minute\\
+ \\ * 0.04)\\n\\n\\n if self.preptime == 0:\\n\\n # if ccok
still has nothing\\
+ \\ to do, search for order that is the same as the last
one\\n\\n for i\\
+ \\ in range(0, len(self.orders)):\\n temporder =
self.orders[i] \\n \\
+ \\ if temporder[1] == \\"entered\\" and temporder[0] ==
self.last_order:\\n\\
+ \\ temporder[1] = \\"preparing\\"\\n
break\\n\\n # next\\
+ \\ search for drinks\\n\\n else:\\n for i in range(0,
len(self.orders)):\\n\\
+ \\ temporder = self.orders[i] \\n if
temporder[1] == \\"\\
+ entered\\" and game.menu_content[temporder[0]][3] ==
\\"drink\\":\\n \\
+ \\ temporder[1] = \\"preparing\\"\\n
break\\n\\n \\n \\
+ \\ # last look for other open orders\\n
else:\\n for i in\\
+ \\ range(0, len(self.orders)):\\n temporder =
self.orders[i] \\n\\
+ \\ if temporder[1] ==
\\"entered\\":\\n temporder[1]\\
+ \\ = \\"preparing\\"\\n break\\n\\n print
\\"orders after checking:\\
+ \\ \\", temporder\\n if temporder <> [\\"no
order\\"]:\\n if temporder[1]\\
+ \\ == \\"preparing\\":\\n self.prep_order_item =
game.menu_content[temporder[0]]\\n\\
+ \\n # search ingredient table for ingredients for this
item\\n \\
+ \\ # go through cancelled orders; if we find one for the
same thing,\\
+ \\ slash ingredient need and preptime\\n \\n for j in
range(0, len(self.orders)):\\n\\
+ \\ temporder2 = self.orders[j]\\n if
temporder2[1]\\
+ \\ == \\"cancelled\\":\\n if temporder[0] ==
temporder2[0]:\\n\\
+ \\ temporder2[1] = \\"used
up\\"\\n\\n \\
+ \\ # search length of ingredient instructions in order to set dish
to the last\\
+ \\ phase of the instructions\\n for k in
game.ingredients:\\n\\
+ \\ if k[0] ==
game.menu_content[temporder[0]][0]:\\n\\
+ \\ ki =
len(k)\\n break\\n\\
+ \\ self.preptime = 0.2 *
game.frames_per_minute \\n \\
+ \\ temporder =
[temporder[0],\\"preparing\\",temporder[2],ki,0.2\\
+ \\ * game.frames_per_minute]\\n
break\\n \\n \\
+ \\ if self.preptime <= 0:\\n for j in
game.ingredients:\\n\\
+ \\n # if we found it in that table, go through
this list\\n\\
+ \\n if j[0] ==
self.prep_order_item[0]:\\n \\
+ \\ for ki in range(0, len(j)):\\n k =
j[ki] # k\\
+ \\ loops through every needed ingredient for the item we want to
prepare\\n\\
+ \\ print \\"ingredient needed:\\",
k[0]\\n \\
+ \\ for l in range(0,
len(game.storage)):\\n \\
+ \\ if game.storage[l][0] ==
k[0]:\\n game.storage[l][1]\\
+ \\ = game.storage[l][1] - k[1]\\n
game.ingredient_costs\\
+ \\ = game.ingredient_costs + k[1] *
game.storage[l][2]\\n \\
+ \\ print \\"ingredient costs: \\",
game.ingredient_costs\\n \\
+ \\ break\\n if
k[0] == \\"Cook\\"\\
+ :\\n temporder =
[temporder[0],\\"preparing\\", temporder[2],\\
+ \\ ki,k[1] * game.frames_per_minute]\\n
# this adds\\
+ \\ dish number, order status, table number, stage number, time
remaining\\n\\
+ \\ self.preptime = k[1] *
game.frames_per_minute\\n\\
+ \\
gamescreen.gameobjects[\\"cookstatus\\"].new_message\\
+ \\ = \\"preparing \\" + game.menu_content[temporder[0]][0] + \\"
for table \\"\\
+ \\ + str(temporder[2])\\n
break\\n\\n \\
+ \\ #self.preptime = self.prep_order_item[2] *
game.frames_per_minute\\n \\
+ \\ #if temporder[0] ==
self.last_order:\\n # self.preptime\\
+ \\ = self.preptime * 0.5\\n #
gamescreen.gameobjects[\\"cookstatus\\"\\
+ ].new_message = \\"preparing another \\" +
game.menu_content[temporder[0]][0]\\
+ \\ + \\" for table \\" + str(temporder[2])\\n
#else:\\n \\
+ \\ # gamescreen.gameobjects[\\"cookstatus\\"].new_message =
\\"preparing\\
+ \\ \\" + game.menu_content[temporder[0]][0] + \\" for table \\" +
str(temporder[2])\\n\\
+ \\ self.orders[i] = temporder\\n \\n # get
dishes if there\\
+ \\ are any to wash\\n\\n if self.preptime == 0 and
len(self.dirty_dishes)\\
+ \\ > 0: # only check this if no orders were found\\n
self.last_order\\
+ \\ = -1\\n dish = self.dirty_dishes[0]\\n for
check_dish in game.dishlist:\\n\\
+ \\ if check_dish[1] == dish.sprite:\\n
self.preptime =\\
+ \\ check_dish[2] * game.frames_per_minute\\n if
len(game.ovenlist)\\
+ \\ == 0:\\n
gamescreen.gameobjects[\\"cookstatus\\"].new_message\\
+ \\ = \\"cleaning dirty dishes\\"\\n
else:\\n gamescreen.gameobjects[\\"\\
+ cookstatus\\"].new_message = \\"cleaning dirty dishes (\\" +
str(len(game.ovenlist))\\
+ \\ + \\" meals are cooking)\\"\\n print \\"washing\\",
check_dish[0]\\n\\
+ \\ self.dirty_dishes[0].destroy()\\n del
self.dirty_dishes[0]\\n\\
+ \\ break\\n \\n if self.preptime ==
0:\\n self.sprite\\
+ \\ = \\"gb_cook\\"\\n if len(game.ovenlist) ==
0:\\n gamescreen.gameobjects[\\"\\
+ cookstatus\\"].new_message = \\"cook is idle\\"\\n
else:\\n \\
+ \\ gamescreen.gameobjects[\\"cookstatus\\"].new_message = \\"cook
is idle (\\"\\
+ \\ + str(len(game.ovenlist)) + \\" meals are
cooking)\\"\\n self.last_order\\
+ \\ = -1\\n # else:\\n # print self.orders\\n\\n
# next comes\\
+ \\ process for the case that cook is still working\\n
else:\\n if gamescreen.check_collisions(\\"\\
player\\",\\"cook\\"):\\n self.preptime = self.preptime -
2\\n else:\\n\\
- \\ self.preptime = self.preptime - 1\\n if
self.preptime <= 0:\\n\\
- \\ self.preptime = 0\\n for i in range(0,
len(self.orders)):\\n\\
- \\ temporder = self.orders[i]\\n if
temporder[1] == \\"\\
- preparing\\":\\n temporder[1] =
\\"ready\\"\\n self.orders[i]\\
- \\ = temporder \\n self.last_order =
temporder[0]\\n \\
- \\ game.number_dishes = game.number_dishes +
1\\n min_free_dish\\
- \\ = game.number_dishes\\n name_order =
temporder[0]\\n \\
- \\ name = \\"dish\\" + str(min_free_dish)\\n
new_dish = gamescreen.add_object(\\"\\
- dish\\", name)\\n \\n if len(game.shelf) ==
0:\\n \\
- \\ self.minx = 460\\n new_dish.y =
30\\n new_dish.x\\
- \\ = (self.minx)\\n new_dish.z =
new_dish.y\\n new_dish.table\\
- \\ = temporder[2]\\n new_dish.state =
0\\n self.minx\\
- \\ = self.minx + 8\\n new_dish.vx=0\\n
new_dish.vy=0\\n\\
- \\ new_dish.ontable = 0\\n
new_dish.order = temporder\\n\\
- \\ new_dish.order.append(new_dish)\\n
game.shelf.append(new_dish)\\n\\
- \\
gamescreen.gameobjects[\\"statusline\\"].new_message = \\"Cook\\
- \\ finished order for table \\" +
str(new_dish.table)\\n\\n new_dish.sprite\\
- \\ = self.prep_order_item[5]\\n for spritesize in
game.spritesizelist:\\n\\
- \\ if spritesize[0] ==
new_dish.sprite:\\n \\
- \\
new_dish.resize(spritesize[1],spritesize[2])\\n \\
- \\ break\\n"}
+ \\ self.preptime = self.preptime - 1\\n\\n # check if
cook is finished\\
+ \\ with current processing step\\n\\n if self.preptime <=
0:\\n\\n \\
+ \\ print \\"finished preparation step\\"\\n self.preptime
= 0\\n \\
+ \\ for i in range(0, len(self.orders)):\\n temporder
= self.orders[i]\\n\\
+ \\n # check for orders which are still
preparing\\n\\n \\
+ \\ print temporder\\n if temporder[1] ==
\\"preparing\\":\\n\\n \\
+ \\ # check if this order has another preparation step
due\\n \\
+ \\ # look up correct preparation
instructions\\n\\n dishname\\
+ \\ = game.menu_content[temporder[0]][0]\\n print
\\"dishname:\\"\\
+ ,dishname\\n for j in
game.ingredients:\\n if\\
+ \\ j[0] == dishname:\\n
break\\n\\n # check\\
+ \\ if order has reached the last preparation
stage\\n\\n print\\
+ \\ \\"order\\", temporder, \\"at stage\\", temporder[3], \\"of\\",
str(len(j)-1),\\
+ \\ j\\n if temporder[3] < (len(j) -
1):\\n\\n #\\
+ \\ if not, advance preparation stage and check what it
is\\n\\n \\
+ \\ temporder[3] = temporder[3] + 1\\n if
j[temporder[3]][0]\\
+ \\ == \\"Cook\\":\\n self.preptime = j
[temporder[3]][1] *\\
+ \\ game.frames_per_minute\\n print \\"started
working on\\
+ \\ order\\"\\n elif j[temporder[3]][0] ==
\\"Oven\\":\\n \\
+ \\
game.ovenlist.append(temporder)\\n
self.set_timer(j[temporder[3]][1]\\
+ \\ * game.frames_per_minute * 0.04)\\n print
\\"put food\\
+ \\ into oven\\"\\n temporder[1] =
\\"cooking\\"\\n \\
+ \\ else:\\n temporder[1] =
\\"ready\\"\\n \\
+ \\ self.orders[i] = temporder \\n
self.last_order = temporder[0]\\n\\
+ \\ game.number_dishes = game.number_dishes +
1\\n \\
+ \\ min_free_dish = game.number_dishes\\n
name_order\\
+ \\ = temporder[0]\\n name = \\"dish\\" +
str(min_free_dish)\\n\\
+ \\ new_dish = gamescreen.add_object(\\"dish\\",
name)\\n \\n \\
+ \\ if len(game.shelf) == 0:\\n
self.minx\\
+ \\ = 460\\n new_dish.y = 30\\n
new_dish.x =\\
+ \\ (self.minx)\\n new_dish.z =
new_dish.y\\n \\
+ \\ new_dish.table = temporder[2]\\n
new_dish.state = 0\\n\\
+ \\ self.minx = self.minx + 8\\n
new_dish.vx=0\\n\\
+ \\ new_dish.vy=0\\n
new_dish.ontable = 0\\n\\
+ \\ new_dish.order =
[temporder[0],temporder[1],temporder[2]]\\n\\
+ \\
new_dish.order.append(new_dish)\\n
game.shelf.append(new_dish)\\n\\
+ \\
gamescreen.gameobjects[\\"statusline\\"].new_message = \\"\\
+ Cook finished order for table \\" +
str(new_dish.table)\\n\\n \\
+ \\ new_dish.sprite = self.prep_order_item[5]\\n
for spritesize\\
+ \\ in game.spritesizelist:\\n if
spritesize[0] == new_dish.sprite:\\n\\
+ \\
new_dish.resize(spritesize[1],spritesize[2])\\n \\
+ \\ break\\n", 11: "# The timer event
usually fires when\\
+ \\ a dish has finished cooking\\n\\n# Note that each dish
generates a timer event,\\
+ \\ the dish that was put into the oven first also comes out
first\\n# This may\\
+ \\ be slightly wrong if the cooking times are different, but at
the moment\\
+ \\ they are not, so it's correct.\\n\\nprint \\"timer of cook
fired\\"\\nif len(game.ovenlist)\\
+ \\ > 0:\\n print \\"fired 1\\"\\n temporder =
game.ovenlist.pop(0)\\n print\\
+ \\ \\"fired 2\\"\\n temporder[4] = -3\\n print \\"fired
3\\"\\n self.cooked_orders.append(temporder)\\n\\
+ \\ print \\"fired 4\\"\\n self.sprite = \\"gb_cookworking\\""}
+ inherits: null
+ objtype: Workstate
+ wscookstatus: !!python/object:game.WorkState
+ actions: {1: 'self.color = (255,255,255)
+
+ self.clear()
+
+ self.resize(350,20)
+
+ self.z = 40
+
+ self.colorcycle = 0
+
+ self.forecolors =
[[255,0,0],[0,128,0],[0,0,255],[255,0,255],[128,128,0],[0,128,128]]
+
+ self.new_message = "cook is idle"
+
+ # self.draw_text("Today''s special: Wiener Schnitzel with potato
salad $ 7.10",20)
+
+ ', 3: "if self.new_message <> \\"\\":\\n self.clear()\\n
self.draw_text(self.new_message,20,(self.forecolors[self.colorcycle][0],self.forecolors[self.colorcycle][1],self.forecolors[self.colorcycle][2]))\\n\\
+ \\ self.new_message = \\"\\"\\n self.colorcycle =
self.colorcycle + 1\\n \\
+ \\ if self.colorcycle == 6:\\n self.colorcycle = 0\\n\\n"}
inherits: null
objtype: Workstate
wscustomerapproach: !!python/object:game.WorkState
@@ -974,32 +1079,40 @@
# self.dly = self.dly * 2 * game.frames_per_minute', 3: "self.dly
= self.dly\\
\\ - 1\\n\\n# if costumer has finished consuming
everything\\n\\nif self.dly <=\\
\\ 0:\\n\\n# put each consumed order to the table\\n# and update
its status\\n\\n\\
- \\ for i in range(0,len(self.objects)):\\n o =
self.objects[i]\\n \\
- \\ if o.sprite <> \\"menu\\":\\n if o.order[1] ==
\\"consuming\\":\\n \\
- \\ o.order[1] = \\"owed\\"\\n print
\\"finished order:\\",o.order\\n\\
- \\ # put dish onto table\\n\\n
self.occupied_table.objects.append(o)\\n\\
- \\ o.x = (self.occupied_table.x + self.x) / 2 +
25\\n \\
- \\ o.y = (self.occupied_table.y + self.y) / 2 +
10\\n\\n # transform\\
- \\ sprite into empty version\\n\\n o.sprite =
game.menu_content[o.order[0]][4]\\n\\
- \\ print \\"new sprite:\\", o.sprite\\n for
spritesize in\\
- \\ game.spritesizelist:\\n if spritesize[0] ==
o.sprite:\\n \\
- \\
o.resize(spritesize[1],spritesize[2])\\n \\
- \\ break\\n\\n o.state = 3\\n del
self.objects[i]\\n\\
+ \\ tb = self.occupied_table\\n for i in
range(0,len(self.objects)):\\n \\
+ \\ o = self.objects[i]\\n if o.sprite <>
\\"menu\\":\\n if o.order[1]\\
+ \\ == \\"consuming\\":\\n o.order[1] =
\\"owed\\"\\n print\\
+ \\ \\"finished order:\\",o.order\\n # put dish onto
table\\n\\n \\
+ \\ tb.objects.append(o)\\n o.x =
(self.occupied_table.x + self.x)\\
+ \\ / 2 + 25\\n o.y = (self.occupied_table.y + self.y) /
2 + 10\\n\\
+ \\n # transform sprite into empty
version\\n\\n o.sprite\\
+ \\ = game.menu_content[o.order[0]][4]\\n print \\"new
sprite:\\", o.sprite\\n\\
+ \\ for spritesize in
game.spritesizelist:\\n if spritesize[0]\\
+ \\ == o.sprite:\\n
o.resize(spritesize[1],spritesize[2])\\n\\
+ \\ break\\n\\n o.state =
3\\n del self.objects[i]\\n\\
\\ self.contention = self.contention + 200 *
self.group_size_factor\\n\\
\\ if len(self.objects) == 0:\\n
self.workstate = \\"\\
- wscustomerwaitforwaiter\\"\\n break"}
+ wscustomerwaitforwaiter\\"\\n break\\n\\n # check if
all customers\\
+ \\ on that table are finished and issue message in that
case\\n\\n print \\"\\
+ checking orders...\\"\\n unfilled_order = 0\\n for c in
range(0,len(tb.occupants)):\\n\\
+ \\ cust = tb.occupants[c] \\n for o in
cust.orders:\\n if\\
+ \\ o[1] <> \\"owed\\":\\n unfilled_order =
1\\n break\\n \\
+ \\ if unfilled_order == 0:\\n print \\"all orders of table
filled\\"\\n \\
+ \\ gamescreen.gameobjects[\\"statusline\\"].new_message =
\\"Customers on\\
+ \\ table \\" + str(tb.number) + \\" want to pay\\"\\n\\n"}
inherits: null
objtype: Workstate
wscustomerleave: !!python/object:game.WorkState
actions: {1: "self.state = 0\\nself.sprite =
\\"soldier_runright\\"\\nself.vx = 4\\n\\
self.vy = 0\\nself.oldx = 0\\nself.oldy = 0\\n\\nself.path.points
= [] \\nself.path.new_path(style=\\"\\
linear\\")\\n\\nself.path.add_point(self.x,self.y)\\n\\nng =
self.number_in_group\\n\\
- if ng == 0 or ng == 2 or ng == 4:\\n if ng ==
self.occupied_table.size -\\
- \\ 2:\\n motx = -10\\n else:\\n motx =
-35\\nelse:\\n if ng ==\\
- \\ self.occupied_table.size - 1:\\n motx = 30\\n
else:\\n motx\\
- \\ = 55\\n\\nif ng == 0 or ng == 1:\\n moty = 0\\nelif ng == 2
or ng == 3:\\n\\
- \\ moty = 18\\nelif ng == 4 or ng == 5:\\n moty = 36\\n\\nif
motx == -10 or\\
- \\ motx == 30:\\n pass\\n #
self.path.add_point(self.occupied_table.x+motx,self.occupied_table.y-15+moty)\\n\\
+ game.customers_visited = game.customers_visited + 1\\nif ng ==
0:\\n game.groups_visited\\
+ \\ = game.groups_visited + 1\\n\\nif ng == 0 or ng == 2 or ng ==
4:\\n if ng\\
+ \\ == self.occupied_table.size - 2:\\n motx = -10\\n
else:\\n motx\\
+ \\ = -35\\nelse:\\n if ng == self.occupied_table.size -
1:\\n motx =\\
+ \\ 30\\n else:\\n motx = 55\\n\\nif ng == 0 or ng ==
1:\\n moty = 0\\n\\
+ elif ng == 2 or ng == 3:\\n moty = 18\\nelif ng == 4 or ng ==
5:\\n moty\\
+ \\ = 36\\n\\nif motx == -10 or motx == 30:\\n pass\\n #
self.path.add_point(self.occupied_table.x+motx,self.occupied_table.y-15+moty)\\n\\
elif motx == -35:\\n
self.path.add_point(self.occupied_table.x+motx+15,self.occupied_table.y-10+moty)\\n\\
\\
self.path.add_point(self.occupied_table.x+motx+5,self.occupied_table.y+moty)\\n\\
\\
self.path.add_point(self.occupied_table.x+motx,self.occupied_table.y+10+moty)\\n\\
@@ -1040,15 +1153,15 @@
if new_message == \\"ordered: \\":\\n new_message = \\"still
waiting for: \\"\\
\\n print \\"checking orders of customer\\"\\n for i in
self.orders:\\n \\
\\ print i[1]\\n if i[1] == \\"ordered\\" or i[1] ==
\\"entered\\" or i[1]\\
- \\ == \\"preparing\\" or i[1] == \\"carrying\\" or i[1] ==
\\"ready\\":\\n \\
- \\ new_message = new_message + game.menu_content[i[0]] [0] + \\"
\\"\\n\\nif new_message\\
- \\ <> \\"ordered: \\" and new_message <> \\"still waiting for:
\\":\\n gamescreen.gameobjects[\\"\\
- statusline\\"].new_message = new_message\\n\\npass\\n#
self.has_drink = 1",
- 3: "for i in range(0,len(self.orders)):\\n order = self.orders[i]
\\n if order[1]\\
- \\ == \\"in_customer\\":\\n # game.score = game.score +
1\\n\\n order[1]\\
- \\ = \\"ordered\\"\\n ply =
gamescreen.gameobjects[\\"player\\"]\\n ply.orders.append([order[0]\\
- \\ * 1,\\"ordered\\",self.occupied_table.number])\\n #
ply.orders[len(ply.orders)-1].append(\\"\\
- )\\n #
ply.orders[len(ply.orders)-1].append(self.occupied_table.number)\\n\\
+ \\ == \\"preparing\\" or i[1] == \\"carrying\\" or i[1] ==
\\"ready\\" or i[1] ==\\
+ \\ \\"cooking\\":\\n new_message = new_message +
game.menu_content[i[0]]\\
+ \\ [0] + \\" \\"\\n\\nif new_message <> \\"ordered: \\" and
new_message <> \\"still\\
+ \\ waiting for: \\":\\n
gamescreen.gameobjects[\\"statusline\\"].new_message\\
+ \\ = new_message\\n\\npass\\n# self.has_drink = 1", 3: "for i in
range(0,len(self.orders)):\\n\\
+ \\ order = self.orders[i] \\n if order[1] ==
\\"in_customer\\":\\n # game.score\\
+ \\ = game.score + 1\\n\\n order[1] = \\"ordered\\"\\n
ply = gamescreen.gameobjects[\\"\\
+ player\\"]\\n ply.orders.append([order[0] *
1,\\"ordered\\",self.occupied_table.number])\\n\\
+ \\ # ply.orders[len(ply.orders)-1].append(\\")\\n #
ply.orders[len(ply.orders)-1].append(self.occupied_table.number)\\n\\
\\ print ply.orders\\n\\n \\nself.workstate =
\\"wscustomerwaitforwaiter\\""}
inherits: null
objtype: Workstate
@@ -1101,97 +1214,97 @@
\\ = 0\\nself.ay = 0\\nself.resize(38,48)\\nself.has_drink =
0\\nself.path.points\\
\\ = [] \\nself.orders = []\\nself.objects = []\\nself.dly =
1\\nself.needs_menu\\
\\ = 0\\nself.state = 0\\nprint \\"new customer
started\\"\\nself.dist_obst = [1,1]\\n\\
- self.check_dist = 0.5\\nself.path_found = 0\\nself.control_phase =
4\\n", 3: "print\\
- \\ \\"customer iteration\\", self.state\\n\\nif self.state == 0: #
state 0 = waiting\\
- \\ for something to happen\\n self.dly=self.dly - 1\\n\\n if
self.dly <= 0:\\n\\
- \\ self.workstate = \\"wscustomerapproach\\"\\n\\n # the
following code\\
- \\ doesn't get used; it was supposed to be a pathfinding algorithm
that goes\\
- \\ around obstructions\\n # and also other customers, but it
turned out\\
- \\ to be too slow.\\n\\n self.state = 1\\nelif self.state ==
1: # state 1\\
- \\ = generate path to the restaurant\\n\\n self.obstructions =
game.obstructions\\n\\
- \\ # self.goal = [500,480]\\n self.goal = [20,54]\\n
self.goaldescription\\
- \\ = \\"restaurant\\"\\n self.state = 2\\n self.vx = 100\\n
self.vy = 0\\n\\
- \\ self.control_phase = -2\\n self.path_found = 1\\n
game.running_customers.append(self)\\n\\
- \\nelif self.state == 2: # state 2 = run to restaurant (or
anywhere)\\n \\n\\
- \\ # generate line of form y = a1+b1x that's normal to runner's
direction\\n\\
- \\n speed = pow(self.vx * self.vx + self.vy * self.vy,
0.5)\\n\\n# check distance\\
- \\ to goal\\n\\n distance_goal = pow((self.goal[0] - self.x) *
(self.goal[0]\\
- \\ - self.x) + (self.goal[1] - self.y) * (self.goal[1] -
self.y),0.5)\\n print\\
- \\ \\"distance to goal: \\", distance_goal\\n if distance_goal <
80:\\n \\
- \\ target_speed = distance_goal + 20\\n if distance_goal < 10
and self.number_in_group\\
- \\ == 0:\\n self.workstate = \\"wscustomerapproach\\"\\n
else:\\n \\
- \\ target_speed = 100\\n line_x = self.x\\n line_y =
self.y\\n\\n print\\
- \\ \\"check control phase\\", self.control_phase\\n if
self.control_phase ==\\
- \\ 3:\\n line_vx = self.vy / speed * target_speed *
self.check_dist\\n \\
- \\ line_vy = -self.vx / speed * target_speed *
self.check_dist\\n self.control_phase\\
- \\ = 0\\n elif self.control_phase == 0:\\n line_vx =
-self.vy / speed\\
- \\ * target_speed * self.check_dist\\n line_vy = self.vx /
speed * target_speed\\
- \\ * self.check_dist\\n self.control_phase = 1\\n elif
self.control_phase\\
- \\ == 1:\\n self.control_phase = 2\\n elif
self.control_phase == 2:\\n\\
- \\ self.control_phase = 3\\n \\n print \\"check
obstructions\\"\\n \\n if\\
- \\ self.control_phase == 0 or self.control_phase == 1:\\n
min_ua = 1000\\n\\
- \\n for i in self.obstructions:\\n # print
\\"obstruction \\", i\\n\\
- \\ denom = ((game.points[i[1]][1] -
game.points[i[0]][1])*(line_vx))\\
- \\ - ((game.points[i[1]][0] - game.points[i[0]][0])*(line_vy))\\n
\\n \\
- \\ nume_a = ((game.points[i[1]][0] -
game.points[i[0]][0])*(line_y - game.points[i[0]][1]))\\
- \\ - ((game.points[i[1]][1] - game.points[i[0]][1])*(line_x -
game.points[i[0]][0]))\\n\\
- \\n nume_b = ((line_vx)*(line_y - game.points[i[0]][1])) -
((line_vy)*(line_x\\
- \\ - game.points[i[0]][0]))\\n\\n coincedent =
0\\n parallel =\\
- \\ 0\\n\\n if denom == 0:\\n if nume_a == 0 and
nume_b == 0:\\n\\
- \\ coincedent = 1\\n
else:\\n parallel\\
- \\ = 1\\n\\n # print \\"determining ua and
ub\\"\\n if coincedent\\
- \\ == 0 and parallel == 0:\\n ua = nume_a /
denom\\n ub\\
- \\ = nume_b / denom\\n\\n if (ua >= 0 and ua < 1 and ub
> 0 and ub\\
- \\ < 1):\\n # Get the intersection point.\\n
intersection_x\\
- \\ = line_x + ua*line_vx\\n intersection_y = line_y
+ ua*line_vy\\n\\
- \\ intersecting = 1\\n if ua <
min_ua:\\n \\
- \\ min_intersection = [intersection_x,
intersection_y]\\n \\
- \\ min_ua = ua\\n else:\\n
intersecting = 0\\n\\
- \\n # if character is near the wall, steer him left or
right\\n\\n self.dist_obst[self.control_phase]\\
- \\ = min_ua\\n if min_ua < 1:\\n steer_force = 2 /
(min_ua + 0.2)\\n\\
- \\ print \\"steer_force / line_vx / line_vy: \\",
steer_force, line_vx,\\
- \\ line_vy\\n # if self.control_phase == 0: # control line
to the left\\n\\
- \\ self.vy = self.vy - steer_force * line_vy\\n
self.vx = self.vx\\
- \\ - steer_force * line_vx\\n # else:\\n #
self.vy = self.vy\\
- \\ - steer_force * line_vx\\n # self.vx = self.vx +
steer_force *\\
- \\ line_vy\\n \\n print \\"new self.vx / vy: \\",
self.vx, self.vy\\n\\
- \\ speed = pow(self.vx * self.vx + self.vy * self.vy,
0.5)\\n \\
- \\ self.vx = (self.vx * target_speed / speed) / 2 + self.vx /
2\\n \\
- \\ self.vy = (self.vy * target_speed / speed) / 2 + self.vy /
2\\n elif self.control_phase\\
- \\ == 2: #phase 2 - steer character towards the goal\\n \\n
if self.dist_obst[0]\\
- \\ < 1 and self.dist_obst[1] < 1:\\n self.check_dist =
self.check_dist\\
- \\ - 0.01\\n if self.check_dist < ((self.dist_obst[0] +
self.dist_obst[1])\\
- \\ / 2):\\n self.check_dist = ((self.dist_obst[0] +
self.dist_obst[1])\\
- \\ / 2)\\n if self.check_dist < 0.2:\\n
self.check_dist =\\
- \\ 0.2\\n elif self.check_dist < 1:\\n
self.check_dist = self.check_dist\\
- \\ + 0.01\\n if self.check_dist > 1:\\n
self.check_dist =\\
- \\ 1\\n # if not first in the group, change goal to first
character in\\
- \\ group\\n\\n if self.number_in_group > 0:\\n
self.goal = [self.first_customer.x,\\
- \\ self.first_customer.y]\\n print self.goal\\n
line_vx = self.goal[0]\\
- \\ - self.x\\n line_vy = self.goal[1] - self.y\\n print
\\"hop 1\\"\\n\\
- \\ tempspeed = pow(line_vx * line_vx + line_vy *
line_vy,0.5)\\n line_vx\\
- \\ = line_vx / tempspeed * 25\\n line_vy = line_vy /
tempspeed * 25\\n \\
- \\ self.vx = self.vx * 0.75 + line_vx\\n self.vy =
self.vy * 0.75 +\\
- \\ line_vy\\n print \\"hop 2\\"\\n speed = pow(self.vx *
self.vx + self.vy\\
- \\ * self.vy, 0.5)\\n self.vx = (self.vx * target_speed /
speed) / 2 +\\
- \\ self.vx / 2\\n self.vy = (self.vy * target_speed / speed)
/ 2 + self.vy\\
- \\ / 2\\n\\n elif self.control_phase == 3: #phase 3 - steer
character away\\
- \\ from other customers\\n for i in
game.running_customers:\\n if\\
- \\ i <> self:\\n dist = pow((i.x-self.x) * (i.x-self.x)
+ (i.y-self.y)\\
- \\ * (i.y-self.y),0.5)\\n if dist <
60:\\n dist = ((60\\
- \\ - dist) / 50) * ((60 - dist) / 50) * 100\\n
self.vx = self.vx\\
- \\ - (dist / 50) * (i.x-self.x)\\n self.vy = self.vy
- (dist /\\
- \\ 50) * (i.y-self.y)\\n speed = pow(self.vx *
self.vx + self.vy\\
- \\ * self.vy, 0.5)\\n self.vx = (self.vx *
target_speed / speed)\\
- \\ / 2 + self.vx / 2\\n self.vy = (self.vy *
target_speed / speed)\\
- \\ / 2 + self.vy / 2\\n\\n elif self.control_phase == 4: #phase
4 - find path\\
- \\ to goal\\n if self.path_found == 1:\\n print
\\"initializing\\"\\
- \\n self.path_found = 0\\n
self.mindistance_to_goal = 10000\\n\\
- \\ self.mindist2 = self.mindistance_to_goal *
self.mindistance_to_goal\\n\\
- \\ self.pointlist = [[self.x,self.y,-1,0,0]] # format: x,
y, state\\
- \\ (examined / to examine), minimum distance,
sourcepoint\\n for i in\\
- \\ game.waypoints:\\n
self.pointlist.append([i[0],i[1],-2,10000,0])\\
- \\ \\n
self.pointlist.append([self.goal[0],self.goal[1],-2,10000,0])\\n\\
+ self.check_dist = 0.5\\nself.path_found = 0\\nself.control_phase =
4\\nself.message_issued\\
+ \\ = 0\\n", 3: "print \\"customer iteration\\", self.state\\n\\nif
self.state ==\\
+ \\ 0: # state 0 = waiting for something to happen\\n
self.dly=self.dly - 1\\n\\
+ \\n if self.dly <= 0:\\n self.workstate =
\\"wscustomerapproach\\"\\n\\n\\
+ \\ # the following code doesn't get used; it was supposed to
be a pathfinding\\
+ \\ algorithm that goes around obstructions\\n # and also
other customers,\\
+ \\ but it turned out to be too slow.\\n\\n self.state =
1\\nelif self.state\\
+ \\ == 1: # state 1 = generate path to the restaurant\\n\\n
self.obstructions\\
+ \\ = game.obstructions\\n # self.goal = [500,480]\\n self.goal
= [20,54]\\n\\
+ \\ self.goaldescription = \\"restaurant\\"\\n self.state =
2\\n self.vx =\\
+ \\ 100\\n self.vy = 0\\n self.control_phase = -2\\n
self.path_found = 1\\n\\
+ \\ game.running_customers.append(self)\\n\\nelif self.state ==
2: # state 2\\
+ \\ = run to restaurant (or anywhere)\\n \\n # generate line of
form y = a1+b1x\\
+ \\ that's normal to runner's direction\\n\\n speed = pow(self.vx
* self.vx\\
+ \\ + self.vy * self.vy, 0.5)\\n\\n# check distance to goal\\n\\n
distance_goal\\
+ \\ = pow((self.goal[0] - self.x) * (self.goal[0] - self.x) +
(self.goal[1]\\
+ \\ - self.y) * (self.goal[1] - self.y),0.5)\\n print \\"distance
to goal: \\"\\
+ , distance_goal\\n if distance_goal < 80:\\n target_speed =
distance_goal\\
+ \\ + 20\\n if distance_goal < 10 and self.number_in_group ==
0:\\n \\
+ \\ self.workstate = \\"wscustomerapproach\\"\\n else:\\n
target_speed\\
+ \\ = 100\\n line_x = self.x\\n line_y = self.y\\n\\n print
\\"check control\\
+ \\ phase\\", self.control_phase\\n if self.control_phase ==
3:\\n line_vx\\
+ \\ = self.vy / speed * target_speed * self.check_dist\\n
line_vy = -self.vx\\
+ \\ / speed * target_speed * self.check_dist\\n
self.control_phase = 0\\n\\
+ \\ elif self.control_phase == 0:\\n line_vx = -self.vy /
speed * target_speed\\
+ \\ * self.check_dist\\n line_vy = self.vx / speed *
target_speed * self.check_dist\\n\\
+ \\ self.control_phase = 1\\n elif self.control_phase ==
1:\\n self.control_phase\\
+ \\ = 2\\n elif self.control_phase == 2:\\n
self.control_phase = 3\\n \\n\\
+ \\ print \\"check obstructions\\"\\n \\n if self.control_phase
== 0 or self.control_phase\\
+ \\ == 1:\\n min_ua = 1000\\n\\n for i in
self.obstructions:\\n \\
+ \\ # print \\"obstruction \\", i\\n denom =
((game.points[i[1]][1] -\\
+ \\ game.points[i[0]][1])*(line_vx)) - ((game.points[i[1]][0] -
game.points[i[0]][0])*(line_vy))\\n\\
+ \\ \\n nume_a = ((game.points[i[1]][0] -
game.points[i[0]][0])*(line_y\\
+ \\ - game.points[i[0]][1])) - ((game.points[i[1]][1] -
game.points[i[0]][1])*(line_x\\
+ \\ - game.points[i[0]][0]))\\n\\n nume_b =
((line_vx)*(line_y - game.points[i[0]][1]))\\
+ \\ - ((line_vy)*(line_x - game.points[i[0]][0]))\\n\\n
coincedent = 0\\n\\
+ \\ parallel = 0\\n\\n if denom == 0:\\n
if nume_a ==\\
+ \\ 0 and nume_b == 0:\\n coincedent =
1\\n else:\\n \\
+ \\ parallel = 1\\n\\n # print \\"determining
ua and ub\\"\\n\\
+ \\ if coincedent == 0 and parallel == 0:\\n ua
= nume_a /\\
+ \\ denom\\n ub = nume_b / denom\\n\\n if (ua
>= 0 and ua\\
+ \\ < 1 and ub > 0 and ub < 1):\\n # Get the intersection
point.\\n \\
+ \\ intersection_x = line_x +
ua*line_vx\\n intersection_y\\
+ \\ = line_y + ua*line_vy\\n intersecting =
1\\n if\\
+ \\ ua < min_ua:\\n min_intersection =
[intersection_x, intersection_y]\\n\\
+ \\ min_ua = ua\\n
else:\\n intersecting\\
+ \\ = 0\\n\\n # if character is near the wall, steer him left or
right\\n\\n \\
+ \\ self.dist_obst[self.control_phase] = min_ua\\n if
min_ua < 1:\\n\\
+ \\ steer_force = 2 / (min_ua + 0.2)\\n print
\\"steer_force /\\
+ \\ line_vx / line_vy: \\", steer_force, line_vx,
line_vy\\n # if self.control_phase\\
+ \\ == 0: # control line to the left\\n self.vy = self.vy -
steer_force\\
+ \\ * line_vy\\n self.vx = self.vx - steer_force *
line_vx\\n \\
+ \\ # else:\\n # self.vy = self.vy - steer_force *
line_vx\\n \\
+ \\ # self.vx = self.vx + steer_force * line_vy\\n
\\n print \\"\\
+ new self.vx / vy: \\", self.vx, self.vy\\n speed =
pow(self.vx * self.vx\\
+ \\ + self.vy * self.vy, 0.5)\\n self.vx = (self.vx *
target_speed /\\
+ \\ speed) / 2 + self.vx / 2\\n self.vy = (self.vy *
target_speed / speed)\\
+ \\ / 2 + self.vy / 2\\n elif self.control_phase == 2: #phase 2 -
steer character\\
+ \\ towards the goal\\n \\n if self.dist_obst[0] < 1 and
self.dist_obst[1]\\
+ \\ < 1:\\n self.check_dist = self.check_dist -
0.01\\n if self.check_dist\\
+ \\ < ((self.dist_obst[0] + self.dist_obst[1]) / 2):\\n
self.check_dist\\
+ \\ = ((self.dist_obst[0] + self.dist_obst[1]) / 2)\\n if
self.check_dist\\
+ \\ < 0.2:\\n self.check_dist = 0.2\\n elif
self.check_dist <\\
+ \\ 1:\\n self.check_dist = self.check_dist +
0.01\\n if self.check_dist\\
+ \\ > 1:\\n self.check_dist = 1\\n # if not first
in the group,\\
+ \\ change goal to first character in group\\n\\n if
self.number_in_group\\
+ \\ > 0:\\n self.goal = [self.first_customer.x,
self.first_customer.y]\\n\\
+ \\ print self.goal\\n line_vx = self.goal[0] -
self.x\\n line_vy\\
+ \\ = self.goal[1] - self.y\\n print \\"hop 1\\"\\n
tempspeed = pow(line_vx\\
+ \\ * line_vx + line_vy * line_vy,0.5)\\n line_vx = line_vx /
tempspeed\\
+ \\ * 25\\n line_vy = line_vy / tempspeed * 25\\n self.vx
= self.vx\\
+ \\ * 0.75 + line_vx\\n self.vy = self.vy * 0.75 +
line_vy\\n print\\
+ \\ \\"hop 2\\"\\n speed = pow(self.vx * self.vx + self.vy *
self.vy, 0.5)\\n\\
+ \\ self.vx = (self.vx * target_speed / speed) / 2 + self.vx /
2\\n \\
+ \\ self.vy = (self.vy * target_speed / speed) / 2 + self.vy /
2\\n\\n elif\\
+ \\ self.control_phase == 3: #phase 3 - steer character away from
other customers\\n\\
+ \\ for i in game.running_customers:\\n if i <>
self:\\n \\
+ \\ dist = pow((i.x-self.x) * (i.x-self.x) + (i.y-self.y) *
(i.y-self.y),0.5)\\n\\
+ \\ if dist < 60:\\n dist = ((60 - dist) /
50) * ((60\\
+ \\ - dist) / 50) * 100\\n self.vx = self.vx - (dist
/ 50) * (i.x-self.x)\\n\\
+ \\ self.vy = self.vy - (dist / 50) *
(i.y-self.y)\\n \\
+ \\ speed = pow(self.vx * self.vx + self.vy * self.vy,
0.5)\\n \\
+ \\ self.vx = (self.vx * target_speed / speed) / 2 + self.vx /
2\\n \\
+ \\ self.vy = (self.vy * target_speed / speed) / 2 +
self.vy / 2\\n\\
+ \\n elif self.control_phase == 4: #phase 4 - find path to
goal\\n if\\
+ \\ self.path_found == 1:\\n print
\\"initializing\\"\\n self.path_found\\
+ \\ = 0\\n self.mindistance_to_goal = 10000\\n
self.mindist2 =\\
+ \\ self.mindistance_to_goal * self.mindistance_to_goal\\n
self.pointlist\\
+ \\ = [[self.x,self.y,-1,0,0]] # format: x, y, state (examined / to
examine),\\
+ \\ minimum distance, sourcepoint\\n for i in
game.waypoints:\\n \\
+ \\ self.pointlist.append([i[0],i[1],-2,10000,0]) \\n
self.pointlist.append([self.goal[0],self.goal[1],-2,10000,0])\\n\\
\\ # print \\"initialization complete\\",
self.pointlist\\n else:\\n\\
\\n # go through saved list of points and see which points
are yet\\
\\ to be examined as starting point\\n\\n print \\"go
through saved list\\"\\
@@ -1290,8 +1403,9 @@
\\ == 0 or self.number_in_group == 2 or self.number_in_group ==
4:\\n self.sprite\\
\\ = \\"soldier_idle\\"\\n else:\\n self.sprite =
\\"soldier_idle_left\\"\\n\\
\\nif self.contention <= 0:\\n
gamescreen.gameobjects[\\"statusline\\"].new_message\\
- \\ = \\"customer waited enough... leaving\\"\\n self.workstate =
\\"wscustomerleave\\"\\
- \\n", 5: '# self.workstate = "wscustomerleave"
+ \\ = \\"customer waited enough... leaving\\"\\n
game.customers_lost = game.customers_lost\\
+ \\ + 1\\n self.workstate = \\"wscustomerleave\\"\\n", 5: '#
self.workstate =
+ "wscustomerleave"


print "state of customer:"
@@ -1317,10 +1431,10 @@
objtype: Workstate
wsmastercustomer: !!python/object:game.WorkState
actions: {1: "game.gameseconds_per_minute =
12\\ngame.frames_per_minute = game.gameseconds_per_minute\\
- \\ * 25\\nself.x = 0\\nself.y =
0\\nself.resize(0,0)\\n\\nself.set_timer(3)\\n\\n\\
- self.number_customers = 0\\ngame.number_tables =
0\\ngame.number_orders = 0\\n\\
- game.number_dishes = 0\\ngame.number_menues =
0\\n\\ngame.case_clear_dishes =\\
- \\
[[\\"plate\\",20],[\\"glass_softdrink\\",10],[\\"glass_beer\\",10],[\\"glass_wine\\"\\
+ \\ * 25\\ngame.ovenlist = []\\n\\nself.x = 0\\nself.y =
0\\nself.resize(0,0)\\n\\n\\
+ self.set_timer(3)\\n\\nself.number_customers =
0\\ngame.number_tables = 0\\ngame.number_orders\\
+ \\ = 0\\ngame.number_dishes = 0\\ngame.number_menues =
0\\n\\ngame.case_clear_dishes\\
+ \\ =
[[\\"plate\\",20],[\\"glass_softdrink\\",10],[\\"glass_beer\\",10],[\\"glass_wine\\"\\
,10]]\\n\\ngame.menu_content = [] #this holds the menu content as
written in\\
\\ the restaurant menu\\n#format: 0=name, 1=price, 2=preptime
(sec), 3=type,\\
\\ 4=emptysprite, 5=fullsprite\\n\\ngame.obstructions =
[]\\ngame.points = []\\n\\
@@ -1349,36 +1463,38 @@
Orange juice\\", [\\"Orange
juice\\",0.25],[\\"glass_softdrink\\",1],[\\"Cook\\"\\
,0.7]])\\ngame.ingredients.append([\\"Wine\\",
[\\"Wine\\",0.25],[\\"glass_wine\\"\\
,1],[\\"Cook\\",0.75]])\\ngame.ingredients.append([\\"Wiener
Schnitzel\\", [\\"\\
- Baked Schnitzel\\",0.16],[\\"Potato
salad\\",0.125],[\\"Cook\\",5.0]])\\ngame.ingredients.append([\\"\\
- Fish & Chips\\", [\\"Baked Fish\\",0.15],[\\"Pommes
Frites\\",0.125],[\\"Cook\\"\\
- ,5.0]])\\ngame.ingredients.append([\\"Spaghetti Bolognese\\",
[\\"Noodles\\",0.15],[\\"\\
- Sauce Bolognese\\",0.125],[\\"Cook\\",5.0]])\\n\\ngame.dishlist =
[]\\n#format:\\
- \\ [name of dish, name of sprite (empty dish), time to wash (in
minutes)]\\n\\
-
game.dishlist.append([\\"glass_softdrink\\",\\"softdrinkempty\\",0.5])\\ngame.dishlist.append([\\"\\
-
glass_beer\\",\\"drinkbeerempty\\",0.6])\\ngame.dishlist.append([\\"glass_wine\\"\\
- ,\\"drinkwineempty\\",0.5])\\ngame.dishlist.append([\\"plate\\",\\"dishempty\\",1.0])\\n\\
- \\n\\ngame.storage = [] # list of ingredients in storage, along
with amount\\n\\
- #format: [name of ingredient, amount of ingredient stored, value
of each unit\\
- \\ of ingredient]\\ngame.storage.append([\\"Coca
Cola\\",12.0,0.79])\\ngame.storage.append([\\"\\
- Mineral
water\\",12.0,0.36])\\ngame.storage.append([\\"Beer\\",10.0,1.12])\\ngame.storage.append([\\"\\
- Orange
juice\\",12.0,0.65])\\ngame.storage.append([\\"Wine\\",2.0,2.5])\\ngame.storage.append([\\"\\
- Baked Schnitzel\\",6.4,5.39])\\ngame.storage.append([\\"Potato
salad\\",10.0,1.58])\\n\\
- game.storage.append([\\"Baked
Fish\\",7.5,5.5])\\ngame.storage.append([\\"Pommes\\
- \\
Frites\\",12.5,0.89])\\ngame.storage.append([\\"Noodles\\",10.0,1.58])\\ngame.storage.append([\\"\\
- Sauce Bolognese\\",7.5,4.00])\\ngame.shelf = [] # list of dishes
and drinks\\
- \\ ready for taking by the waiter\\ngame.storage_startofday =
game.storage\\n\\
- \\n# create 3 x 3 tables\\nfor game.number_tables in
range(1,10):\\n name =\\
- \\ \\"table\\" + str(game.number_tables)\\n a =
gamescreen.add_object(\\"table\\"\\
- , name)\\n\\n if game.number_tables < 4: \\n a.x =
100\\n a.y = (game.number_tables)\\
- \\ * 100 \\n elif game.number_tables < 7:\\n a.x =
210\\n a.y = (game.number_tables-3)\\
- \\ * 100\\n else:\\n a.x = 320\\n a.y =
(game.number_tables-6) * 100\\n\\
- \\ a.z = a.y\\n if name == \\"table4\\" or name ==
\\"table7\\" or name == \\"\\
- table8\\":\\n a.sprite = \\"table_6top\\"\\n
a.resize(62,74)\\n a.height\\
- \\ = 74\\n a.size = 6\\n elif name == \\"table1\\" or name
== \\"table5\\"\\
- \\ or name == \\"table9\\":\\n a.sprite =
\\"table_4top\\"\\n a.resize(62,56)\\n\\
- \\ a.height = 56\\n a.size = 4\\n else:\\n
a.resize(62,36)\\n\\
- \\ a.height = 36\\n a.size = 2\\n a.vx=0\\n
a.vy=0\\n a.occupied=0\\n\\
- \\ a.has_menu = 0\\n a.number = game.number_tables\\n\\n
game.points.append([a.x,a.y])\\n\\
+ Baked Schnitzel\\",0.16],[\\"Potato
salad\\",0.125],[\\"Cook\\",2.0],[\\"Oven\\"\\
+ ,5.0],[\\"Cook\\",1.5]])\\ngame.ingredients.append([\\"Fish &
Chips\\", [\\"Baked\\
+ \\ Fish\\",0.15],[\\"Pommes
Frites\\",0.125],[\\"Cook\\",2.0],[\\"Oven\\",5.0],[\\"\\
+ Cook\\",1.5]])\\ngame.ingredients.append([\\"Spaghetti
Bolognese\\", [\\"Noodles\\"\\
+ ,0.15],[\\"Sauce
Bolognese\\",0.125],[\\"Cook\\",1.5],[\\"Oven\\",4.5],[\\"Cook\\"\\
+ ,1.5]])\\n\\ngame.dishlist = []\\n#format: [name of dish, name of
sprite (empty\\
+ \\ dish), time to wash (in
minutes)]\\ngame.dishlist.append([\\"glass_softdrink\\"\\
+ ,\\"softdrinkempty\\",0.5])\\ngame.dishlist.append([\\"glass_beer\\",\\"drinkbeerempty\\"\\
+ ,0.6])\\ngame.dishlist.append([\\"glass_wine\\",\\"drinkwineempty\\",0.5])\\ngame.dishlist.append([\\"\\
+ plate\\",\\"dishempty\\",1.0])\\n\\n\\ngame.storage = [] # list of
ingredients in\\
+ \\ storage, along with amount\\n#format: [name of ingredient,
amount of ingredient\\
+ \\ stored, value of each unit of
ingredient]\\ngame.storage.append([\\"Coca Cola\\"\\
+ ,12.0,0.79])\\ngame.storage.append([\\"Mineral
water\\",12.0,0.36])\\ngame.storage.append([\\"\\
+ Beer\\",10.0,1.12])\\ngame.storage.append([\\"Orange
juice\\",12.0,0.65])\\ngame.storage.append([\\"\\
+ Wine\\",2.0,2.5])\\ngame.storage.append([\\"Baked
Schnitzel\\",6.4,5.39])\\ngame.storage.append([\\"\\
+ Potato salad\\",10.0,1.58])\\ngame.storage.append([\\"Baked
Fish\\",7.5,5.5])\\n\\
+ game.storage.append([\\"Pommes
Frites\\",12.5,0.89])\\ngame.storage.append([\\"\\
+ Noodles\\",10.0,1.58])\\ngame.storage.append([\\"Sauce
Bolognese\\",7.5,4.00])\\n\\
+ game.shelf = [] # list of dishes and drinks ready for taking by
the waiter\\n\\
+ game.storage_startofday = game.storage\\n\\n# create 3 x 3
tables\\nfor game.number_tables\\
+ \\ in range(1,10):\\n name = \\"table\\" +
str(game.number_tables)\\n a = gamescreen.add_object(\\"\\
+ table\\", name)\\n\\n if game.number_tables < 4: \\n a.x =
100\\n a.y\\
+ \\ = (game.number_tables) * 100 \\n elif game.number_tables <
7:\\n a.x\\
+ \\ = 210\\n a.y = (game.number_tables-3) * 100\\n
else:\\n a.x = 320\\n\\
+ \\ a.y = (game.number_tables-6) * 100\\n a.z = a.y\\n if
name == \\"\\
+ table4\\" or name == \\"table7\\" or name == \\"table8\\":\\n
a.sprite = \\"\\
+ table_6top\\"\\n a.resize(62,74)\\n a.height =
74\\n a.size = 6\\n\\
+ \\ elif name == \\"table1\\" or name == \\"table5\\" or name ==
\\"table9\\":\\n\\
+ \\ a.sprite = \\"table_4top\\"\\n
a.resize(62,56)\\n a.height =\\
+ \\ 56\\n a.size = 4\\n else:\\n
a.resize(62,36)\\n a.height =\\
+ \\ 36\\n a.size = 2\\n a.vx=0\\n a.vy=0\\n
a.occupied=0\\n a.has_menu\\
+ \\ = 0\\n a.number = game.number_tables\\n\\n
game.points.append([a.x,a.y])\\n\\
\\ game.points.append([a.x,a.y+a.height])\\n
game.points.append([a.x+62,a.y])\\n\\
\\ game.points.append([a.x+62,a.y+a.height])\\n\\n
game.waypoints.append([a.x-10,a.y-10])\\n\\
\\ game.waypoints.append([a.x-10,a.y+a.height+10])\\n
game.waypoints.append([a.x+72,a.y-10])\\n\\
@@ -1447,20 +1563,6 @@
'}
inherits: null
objtype: Workstate
- wsmenusign: !!python/object:game.WorkState
- actions: {1: 'self.color = (255,255,255)
-
- self.clear()
-
- self.resize(400,25)
-
- self.z = 40
-
- # self.draw_text("Today''s special: Wiener Schnitzel with potato
salad $ 7.10",20)
-
- '}
- inherits: null
- objtype: Workstate
wsplayercelebrate: !!python/object:game.WorkState
actions: {1: '

@@ -1505,11 +1607,15 @@
salary_per_hour = gain / (clock_final * 0.016667)\\nmessage =
\\"Your salary\\
\\ per hour: \\" +
str(salary_per_hour)\\nself.final_messages.append(message)\\n\\
message = \\"Final customer satisfaction: \\" +
str(int(game.customer_satisfaction\\
- \\ * 10000)*0.01) +
\\"%\\"\\nself.final_messages.append(message)\\n\\nfor i in\\
- \\ range(0,len(self.final_messages)):\\n name =
\\"finalmessage\\" + str(i)\\n\\
- \\ a = gamescreen.add_object(\\"playermenu\\", name)\\n a.x =
50\\n a.y =\\
- \\ 100 + i * 20\\n a.z = 1003\\n a.resize(600,20)\\n a.color
= (0,0,0)\\n\\
- \\ a.clear()\\n
a.draw_text(self.final_messages[i],20,(255,255,255))\\n"}
+ \\ * 10000)*0.01) +
\\"%\\"\\nself.final_messages.append(message)\\nmessage = \\"\\
+ Served \\" + str(game.customers_visited) + \\" customers in \\" +
str(game.groups_visited)\\
+ \\ + \\" groups; \\" + str(game.customers_lost) + \\" customers
lost\\"\\nself.final_messages.append(message)\\n\\
+ message = \\"Tips earned: \\" + str(game.tips)\\nif game.score >
0:\\n message\\
+ \\ = message + \\"(\\" + str(int(game.tips * 10000 / (game.score -
game.tips))*0.01)\\
+ \\ + \\"%)\\"\\nself.final_messages.append(message)\\n\\nfor i in
range(0,len(self.final_messages)):\\n\\
+ \\ name = \\"finalmessage\\" + str(i)\\n a =
gamescreen.add_object(\\"playermenu\\"\\
+ , name)\\n a.x = 50\\n a.y = 100 + i * 20\\n a.z = 1003\\n
a.resize(600,20)\\n\\
+ \\ a.color = (0,0,0)\\n a.clear()\\n
a.draw_text(self.final_messages[i],20,(255,255,255))\\n"}
inherits: null
objtype: Workstate
wsplayermenu: !!python/object:game.WorkState
@@ -1520,7 +1626,7 @@


self.menu_structure = ["View menu", "View storage", "Order
ingredients", "Offer
- special", "Retract special", "Place ad", "Close
restaurant", "Exit"]
+ special", "Retract special", "Prepare dishes", "Close
restaurant", "Exit"]


self.current_menu_item = 0
@@ -1582,7 +1688,7 @@
\\ \\n self.menu_level = self.menu_level - 1\\n
self.current_menu_item =\\
\\ 0\\n self.previous_menu_item = 0\\n\\n if self.menu_level
== 1:\\n \\
\\ self.menu_structure = [\\"View menu\\", \\"View storage\\",
\\"Order ingredients\\"\\
- , \\"Offer special\\", \\"Retract special\\", \\"Place ad\\",
\\"Close restaurant\\"\\
+ , \\"Offer special\\", \\"Retract special\\", \\"Prepare
dishes\\", \\"Close restaurant\\"\\
, \\"Exit\\"]\\n\\n self.menu_changed = 1\\n\\n# Decrease price
of a menu item\\n\\
\\nif self.menu_level == 2 and self.submenu == 2 and
self.menu_structure[self.current_menu_item]\\
\\ <> \\"Back\\":\\n if
game.menu_content[self.current_menu_item][1] > 0.1:\\n\\
@@ -1600,13 +1706,14 @@
\\nself.vx=0\\nself.vy=0\\nself.ax=0\\nself.ay=0\\n\\n# initialize
only if accessing\\
\\ an attribute of the player fails\\n\\ntry:\\n test =
self.menu_structure\\n\\
except:\\n game.customer_satisfaction = 0.5\\n
game.ingredient_costs = 0\\n\\
- \\ game.tax_drinks = 0\\n game.tax_dishes = 0\\n
self.resize(38,48)\\n \\
- \\ self.number_orders = 0\\n self.number_full_dishes = 0\\n
self.number_empty_dishes\\
- \\ = 0\\n self.has_menu = 0\\n self.previous_collision =
0\\n self.displacement_object\\
- \\ = 5\\n self.orders = []\\n self.objects = []\\n
self.menu_structure =\\
- \\ []\\n\\n# Note: objects only lists the visible objects the
player carries;\\n\\
- # orders the player \\"carries\\" are invisible and thus not
listed here.\\n\\n\\
- # Move the game screen\\n\\n
gamescreen.move_gamescreen([0,0],gradual=True,acceleration=1)\\n",
+ \\ game.tax_drinks = 0\\n game.tax_dishes = 0\\n
game.customers_visited\\
+ \\ = 0\\n game.groups_visited = 0\\n game.customers_lost =
0\\n game.tips\\
+ \\ = 0.0\\n self.resize(38,48)\\n self.number_orders = 0\\n
self.number_full_dishes\\
+ \\ = 0\\n self.number_empty_dishes = 0\\n self.has_menu =
0\\n self.previous_collision\\
+ \\ = 0\\n self.displacement_object = 5\\n self.orders =
[]\\n self.objects\\
+ \\ = []\\n self.menu_structure = []\\n\\n# Note: objects only
lists the visible\\
+ \\ objects the player carries;\\n# orders the player \\"carries\\"
are invisible\\
+ \\ and thus not listed here.\\n\\n# Move the game screen\\n\\n
gamescreen.move_gamescreen([0,0],gradual=True,acceleration=1)\\n",
3: "# A few comments won't hurt!\\n\\n# Check if the player is on
any surface\\
\\ (table, that is)\\n\\nself.onsurface=False\\n\\nself.vytemp =
self.vy\\nself.vxtemp\\
\\ = self.vx\\n\\n# Check if the player is at the table with the
menus\\n\\nif\\
@@ -1783,15 +1890,18 @@
\\ game.tax_dishes = game.tax_dishes +
game.menu_content[cust.orders[o2][0]][1]\\
\\ / 11\\n
\\n \\
\\ cust.workstate =
\\"wscustomerleave\\" \\
- \\ \\n game.score =
game.score +\\
- \\ int(cust.contention / game.frames_per_minute * 0.24) *
0.1\\n \\
- \\ satisfaction = cust.contention /
game.frames_per_minute\\
- \\ / len(cust.orders) *
0.05\\n message\\
- \\ = message + \\" \\" + str(int(satisfaction * 100)) +
\\"%\\"\\n \\
- \\ game.customer_satisfaction =
game.customer_satisfaction\\
+ \\ \\n tips =
int(cust.contention\\
+ \\ / game.frames_per_minute * 0.24) *
0.1\\n \\
+ \\ game.tips = game.tips +
tips\\n \\
+ \\ game.score = game.score +
tips\\n \\
+ \\ if len(cust.orders) > 0:
\\n \\
+ \\ satisfaction = cust.contention /
game.frames_per_minute / len(cust.orders)\\
+ \\ * 0.05\\n message =
message +\\
+ \\ \\" \\" + str(int(satisfaction * 100)) +
\\"%\\"\\n \\
+ \\ game.customer_satisfaction =
game.customer_satisfaction\\
\\ * 0.999 + (satisfaction /
1000)\\n \\
- \\ gamescreen.gameobjects[\\"statusline\\"].new_message =
message\\n\\n \\
- \\ print \\"new overall customer
satisfaction:\\"\\
+ \\ gamescreen.gameobjects[\\"statusline\\"].new_message =
message\\n\\n \\
+ \\ print \\"new overall customer
satisfaction:\\"\\
, game.customer_satisfaction\\n\\n
# remove\\
\\ that object from the table (but take glasses only if customer
has already\\
\\ paid)\\n
\\n \\
@@ -1826,8 +1936,8 @@
\\ if o.sprite <>
\\"menu\\": \\
\\ \\n if o.state == 4:\\n o.state =
-1\\n \\
\\ self.number_empty_dishes = 0\\n o.x =
self.x + 15\\n\\
- \\ o.y = self.y - 10\\n o.z = self.z
- 2\\n \\
- \\ print \\"layed off\\", o.sprite\\n
gamescreen.gameobjects[\\"\\
+ \\ o.y = self.y + 5\\n o.z = self.z
- 2\\n \\
+ \\ print \\"layed off\\", o.sprite\\n
gamescreen.gameobjects[\\"\\
cook\\"].dirty_dishes.append(o)\\n
gamescreen.gameobjects[\\"\\
cook\\"].sprite = \\"gb_cookworking\\"\\n del
self.objects[i]\\n\\
\\ break\\n else:\\n
self.number_full_dishes\\
@@ -1889,8 +1999,11 @@


', 3: "if self.new_message <> \\"\\":\\n self.clear()\\n
self.draw_text(self.new_message,20,(self.forecolors[self.colorcycle][0],self.forecolors[self.colorcycle][1],self.forecolors[self.colorcycle][2]))\\n\\
- \\ self.new_message = \\"\\"\\n self.colorcycle =
self.colorcycle + 1\\n \\
- \\ if self.colorcycle == 6:\\n self.colorcycle = 0\\n"}
+ \\ self.new_message = \\"\\"\\n # self.set_timer(2)\\n
self.colorcycle =\\
+ \\ self.colorcycle + 1\\n if self.colorcycle == 6:\\n
self.colorcycle\\
+ \\ = 0\\n", 11: 'pass
+
+ # self.clear()'}
inherits: null
objtype: Workstate
wstable: !!python/object:game.WorkState

Added: trunk/trunk/demos/restaurant/sprites/dishspaghetti.gbs
==============================================================================
--- (empty file)
+++ trunk/trunk/demos/restaurant/sprites/dishspaghetti.gbs Sun Mar 1
11:41:04 2009
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+# LEAVE THE FOLLOWING TWO LINES
+# GAME BAKER SPRITE
+# yaml
+# 0
+s = """
+!!python/object:game.Sprite
+alphakey: !!python/tuple [0, 0, 255]
+framerate: 100
+imagefiles:
+- bottomright: !!python/tuple [11, 61]
+ filename: sprites/images/drinksanddishes.bmp
+ topleft: !!python/tuple [0, 54]
+name: dishspaghetti
+objtype: Sprite
+
+"""
+if __name__ == "__main__":
+ import gbfileio,sys,runtime
+ game = gbfileio.loadgame(sys.argv[0])
+ runtime.run_game(game)

Reply all
Reply to author
Forward
0 new messages