Skip to content

Commit 152d632

Browse files
committed
stuff'
1 parent 9235448 commit 152d632

7 files changed

Lines changed: 271 additions & 2 deletions

File tree

Arluq-github-social-preview.png

-24.7 KB
Binary file not shown.

Arluq-logo.png

-28 KB
Binary file not shown.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- Include Zoo Tycoon 2 libraries
2+
include "scenario/scripts/entity.lua"
3+
include "scenario/scripts/misc.lua"
4+
include "scenario/scripts/token.lua"
5+
include "scenario/scripts/ui.lua"
6+
7+
--- Service for Radical Remake.
8+
RRService = {}

scripts/ArluqTools2/services/AnimalService.lua

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
--- @todo
2+
-- suppressing rampage
3+
-- get/set variations
4+
-- get/set skin variations
5+
-- get/set deletable
6+
17
-- Include Zoo Tycoon 2 libraries
28
include "scenario/scripts/entity.lua"
39
include "scenario/scripts/misc.lua"
410
include "scenario/scripts/token.lua"
511
include "scenario/scripts/ui.lua"
612

7-
--- Service for modifiying animals.
13+
--- Service for modifiying animals
814
AnimalService = {}
915

1016
---- ADOPTION ----
@@ -202,6 +208,22 @@ function AnimalService.setHygiene (animal, hygiene)
202208
setNeed(animal, "hygiene", hygiene)
203209
end
204210

211+
---- NAME ----
212+
213+
--- Get animal name
214+
--- @param animal animal
215+
--- @return string
216+
function AnimalService.getName (animal)
217+
return animal:BFG_GET_ATTR_STRING("s_name")
218+
end
219+
220+
--- Set animal name
221+
--- @param animal animal
222+
--- @param name string
223+
function AnimalService.setName (animal, name)
224+
animal:BFG_SET_ATTR_STRING("s_name", name)
225+
end
226+
205227
---- PREGNANCY ----
206228

207229
--- Get if animal is pregnant
@@ -313,8 +335,15 @@ end
313335

314336
--- Get animal species
315337
--- @param animal animal
316-
--- @return string
338+
--- @return species
317339
function AnimalService.getSpecies (animal)
340+
return getSpeciesFromType(animal:BFG_GET_BINDER_TYPE())
341+
end
342+
343+
--- Get animal species as string
344+
--- @param animal animal
345+
--- @return string
346+
function AnimalService.getSpeciesString (animal)
318347
return animal:BFG_GET_ATTR_STRING("s_Species")
319348
end
320349

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
-- Include Zoo Tycoon 2 libraries
2+
include "scenario/scripts/entity.lua"
3+
include "scenario/scripts/misc.lua"
4+
include "scenario/scripts/token.lua"
5+
include "scenario/scripts/ui.lua"
6+
7+
--- Service for modifiying lists
8+
CollectionService = {}
9+
10+
--- Get all animals in the zoo
11+
--- @return list
12+
function CollectionService.getAllAnimals()
13+
local list = findType("animal")
14+
if list == nil or type(list) ~= "table" then
15+
return error("No animals found")
16+
end
17+
return list
18+
end
19+
20+
--- Get all fences in the zoo
21+
--- @return list
22+
function CollectionService.getAllFences()
23+
local list = findType("fence")
24+
if list == nil or type(list) ~= "table" then
25+
return error("No fences found")
26+
end
27+
return list
28+
end
29+
30+
--- Get all guests in the zoo
31+
--- @return list
32+
function CollectionService.getAllGuests()
33+
local list = findType("Guest")
34+
if list == nil or type(list) ~= "table" then
35+
return error("No guests found")
36+
end
37+
return list
38+
end
39+
40+
--- Get all staff in the zoo
41+
--- @return list
42+
function CollectionService.getAllStaff()
43+
local list = findType("Staff")
44+
if list == nil or type(list) ~= "table" then
45+
return error("No staff found")
46+
end
47+
return list
48+
end
49+
50+
--- Get all entities that match an entity string
51+
--- @param entityString string
52+
--- @return list
53+
function CollectionService.getMatch(entityString)
54+
local list = findType(entityString)
55+
if list == nil or type(list) ~= "table" then
56+
return error("No entities found")
57+
end
58+
return list
59+
end
60+
61+
--- Append entity to list
62+
--- @param list list
63+
--- @param entity entity
64+
function CollectionService.appendEntity(list, entity)
65+
table.insert(list, entity)
66+
end
67+
68+
--- Append list to list
69+
--- @param baseList list
70+
--- @param addList list
71+
function CollectionService.appendList(baseList, addList)
72+
table.insert(baseList, unpack(addList))
73+
end
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
-- Include Zoo Tycoon 2 libraries
2+
include "scenario/scripts/entity.lua"
3+
include "scenario/scripts/misc.lua"
4+
include "scenario/scripts/token.lua"
5+
include "scenario/scripts/ui.lua"
6+
7+
--- Service for modifiying fences
8+
FenceService = {}
9+
10+
function FenceService.getBreakable (fence)
11+
return fence:BFG_GET_ATTR_STRING("s_Broken")
12+
end
13+
14+
function FenceService.getStrength (fence)
15+
return fence:BFG_GET_ATTR_FLOAT("f_FenceStrength")
16+
end
17+
18+
function FenceService.setStrength (fence, fenceStrength)
19+
return fence:BFG_SET_ATTR_FLOAT("f_FenceStrength", fenceStrength)
20+
end
21+
22+
function FenceService.setBroken (fence)
23+
return fence:BFG_SET_ATTR_FLOAT("f_FenceStrength", 0)
24+
end
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
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

Comments
 (0)