1+ --- @todo
2+ -- get/set inventory
3+ -- get/set favourite animal type
4+ -- get/set cash
5+
6+ -- Include Zoo Tycoon 2 libraries
7+ include " scenario/scripts/entity.lua"
8+ include " scenario/scripts/misc.lua"
9+ include " scenario/scripts/token.lua"
10+ include " scenario/scripts/ui.lua"
11+
12+ --- Service for modifiying guests
13+ GuestService = {}
14+
15+ ---- DELETE ----
16+
17+ --- Delete guest
18+ --- @param guest guest
19+ function GuestService .delete (guest )
20+ deleteEntity (guest )
21+ end
22+
23+ ---- FAVORITE ----
24+
25+ --- Set favorite animal
26+ --- @param guest guest
27+ --- @param species species
28+ function GuestService .setFavorite (guest , species )
29+ if species == nil then
30+ species = getSpeciesFromType (getRandomAnimalType ())
31+ end
32+ guest :sendMessage (" ZTAI_SET_FAVORITE_ANIMAL" , species )
33+ end
34+
35+ ---- GENDER ----
36+
37+ --- Get guest gender, returns true if male, false if female
38+ --- @param guest guest
39+ --- @return bool
40+ function GuestService .getGender (guest )
41+ return guest :BFG_GET_ATTR_BOOLEAN (" b_Male" )
42+ end
43+
44+ --- Get guest gender as sting
45+ --- @param guest guest
46+ --- @return string
47+ function GuestService .getGenderString (guest )
48+ local isMale = guest :BFG_GET_ATTR_BOOLEAN (" b_Male" )
49+ if isMale then
50+ return " M"
51+ end
52+ return " F"
53+ end
54+
55+ ---- VARIANTS ----
56+
57+ --- Morph into businessman
58+ --- @param guest guest
59+ function GuestService .morphBusiness (guest )
60+ guest :BFG_ENTITY_MORPH_TO_NEW_ENTITY (" Guest_Adult_M_Business" )
61+ end
62+
63+ --- Morph into caveman
64+ --- @param guest guest
65+ function GuestService .morphCaveman (guest )
66+ guest :BFG_ENTITY_MORPH_TO_NEW_ENTITY (" Guest_Adult_M_Caveman" )
67+ end
68+
69+ --- Morph into hippie
70+ --- @param guest guest
71+ function GuestService .morphHippie (guest )
72+ guest :BFG_ENTITY_MORPH_TO_NEW_ENTITY (" Guest_Adult_M_Photographer" )
73+ end
74+
75+ --- Morph into oceanographer
76+ --- @param guest guest
77+ function GuestService .morphOceanographer (guest )
78+ guest :BFG_ENTITY_MORPH_TO_NEW_ENTITY (" Guest_Adult_M_Oceanographer" )
79+ end
80+
81+ --- Morph into photographer
82+ --- @param guest guest
83+ function GuestService .morphPhotographer (guest )
84+ guest :BFG_ENTITY_MORPH_TO_NEW_ENTITY (" Guest_Adult_M_Photographer" )
85+ end
86+
87+ --- Morph into pirate
88+ --- @param guest guest
89+ function GuestService .morphPirate (guest )
90+ guest :BFG_ENTITY_MORPH_TO_NEW_ENTITY (" Guest_Adult_M_Pirate" )
91+ end
92+
93+ --- Morph into rockstar
94+ --- @param guest guest
95+ function GuestService .morphRockstar (guest )
96+ guest :BFG_ENTITY_MORPH_TO_NEW_ENTITY (" Guest_Adult_F_Rockstar" )
97+ end
98+
99+ --- Morph into scientist
100+ --- @param guest guest
101+ function GuestService .morphScientist (guest )
102+ guest :BFG_ENTITY_MORPH_TO_NEW_ENTITY (" Guest_Adult_M_Scientist" )
103+ end
104+
105+ ---- NAME ----
106+
107+ --- Get guest name
108+ --- @param guest guest
109+ --- @return string
110+ function GuestService .getName (guest )
111+ return guest :BFG_GET_ATTR_STRING (" s_name" )
112+ end
113+
114+ --- Set guest name
115+ --- @param guest guest
116+ --- @param name string
117+ function GuestService .setName (guest , name )
118+ guest :BFG_SET_ATTR_STRING (" s_name" , name )
119+ end
120+
121+ ---- THIRST ----
122+
123+ --- Get guest thirst
124+ --- @param guest guest
125+ --- @return float
126+ function GuestService .getThirst (guest )
127+ return guest :BFG_GET_ATTR_FLOAT (" thirst" )
128+ end
129+
130+ --- Set guest thirst
131+ --- @param guest guest
132+ --- @param thirst float
133+ function GuestService .setThirst (guest , thirst )
134+ setNeed (guest , " thirst" , thirst )
135+ end
0 commit comments