Skip to content

Commit f39c8ff

Browse files
authored
Merge pull request #14 from ZtModArchive/develop
Develop
2 parents a6f5052 + 4f8b143 commit f39c8ff

File tree

14 files changed

+1054
-1
lines changed

14 files changed

+1054
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# exclude file types
2+
*.zip
3+
*.z2f

Arluq-github-social-preview.png

-24.7 KB
Binary file not shown.

Arluq-logo.png

-28 KB
Binary file not shown.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<img src="Arluq-github-social-preview.png" alt="Arluq logo"/>
1+
<img src="arluq2-github-social-preview.png" alt="Arluq logo"/>
22

33
# ArluqTools
44
Abstraction layer for Zoo Tycoon 2's Lua libraries. Modify your entities in a way that makes sense.

arluq2-github-social-preview.png

121 KB
Loading

castor.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"ArchiveName": "ArluqTools",
3+
"Z2f": true,
4+
"IncludeFolders": [
5+
"scripts"
6+
],
7+
"ExcludeFolders": []
8+
}
File renamed without changes.

scripts/ArluqTools1-1/services/AnimalService.lua renamed to scripts/modules/ArluqTools/ArluqTools1/services/AnimalService.lua

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ include "scenario/scripts/entity.lua"
33
include "scenario/scripts/misc.lua"
44
include "scenario/scripts/token.lua"
55
include "scenario/scripts/ui.lua"
6+
include "scripts/canreproduce.lua"
67

78
--- Service for modifiying animals.
89
AnimalService = {}
@@ -70,6 +71,22 @@ function AnimalService.setBathroom (animal, bathroom)
7071
setNeed(animal, "bathroom", bathroom)
7172
end
7273

74+
---- BREATH ----
75+
76+
--- Get animal breath
77+
--- @param animal animal
78+
--- @return float
79+
function AnimalService.getBreath (animal)
80+
return animal:BFG_GET_ATTR_FLOAT("breath")
81+
end
82+
83+
--- Set animal breath
84+
--- @param animal animal
85+
--- @param breath float
86+
function AnimalService.setBreath (animal, breath)
87+
setNeed(animal, "breath", breath)
88+
end
89+
7390
---- CRATE ----
7491

7592
--- Set animal crated status
@@ -83,6 +100,20 @@ function AnimalService.setCrated (animal, isCrated)
83100
end
84101
end
85102

103+
--- Get whether or not an animal can be crated
104+
--- @param animal animal
105+
--- @return bool
106+
function AnimalService.getCrateOption (animal)
107+
return animal:BFG_GET_ATTR_BOOLEAN("b_showCrate")
108+
end
109+
110+
--- Set whether or not an animal can be crated
111+
--- @param animal animal
112+
--- @param canBeCrated bool
113+
function AnimalService.setCrateOption (animal, canBeCrated)
114+
animal:BFG_SET_ATTR_BOOLEAN("b_showCrate", canBeCrated)
115+
end
116+
86117
---- DELETE ----
87118

88119
--- Delete animal
@@ -123,6 +154,18 @@ function AnimalService.setExercise (animal, exercise)
123154
setNeed(animal, "exercise", exercise)
124155
end
125156

157+
---- FAMILY ----
158+
159+
--- Get an animal's children
160+
--- @param animal animal
161+
--- @return animalList
162+
function AnimalService.getChildren (animal)
163+
local childrenList = animal:sendMessage("BFAI_GET_RELATED_ENTITIES", "child")
164+
if childrenList ~= nil and type(childrenList) == "table" then
165+
return childrenList
166+
end
167+
end
168+
126169
---- GENDER ----
127170

128171
--- Get animal gender, returns true if male, false if female
@@ -202,6 +245,22 @@ function AnimalService.setHygiene (animal, hygiene)
202245
setNeed(animal, "hygiene", hygiene)
203246
end
204247

248+
---- LIFESPAN ----
249+
250+
--- Get animal lifespan
251+
--- @param animal animal
252+
--- @return float
253+
function AnimalService.getLifespan (animal)
254+
return animal:BFG_GET_ATTR_FLOAT("lifespan")
255+
end
256+
257+
--- Set animal lifespan
258+
--- @param animal animal
259+
--- @param lifespan float
260+
function AnimalService.setLifespan (animal, lifespan)
261+
setNeed(animal, "lifespan", lifespan)
262+
end
263+
205264
---- PREGNANCY ----
206265

207266
--- Get if animal is pregnant
@@ -229,6 +288,13 @@ function AnimalService.setPregnant (animal, isPregnant)
229288
end
230289
end
231290

291+
--- Get if animal has pregnancy token
292+
--- @param animal animal
293+
--- @return bool
294+
function AnimalService.getPregnancyToken (animal)
295+
return checkforpregnant(animal)
296+
end
297+
232298
---- PRIVACY ----
233299

234300
--- Get animal privacy
@@ -277,6 +343,29 @@ function AnimalService.setReleaseOption (animal, canBeReleased)
277343
animal:BFG_SET_ATTR_BOOLEAN("b_showRelease", canBeReleased)
278344
end
279345

346+
---- REPRODUCTION ----
347+
348+
--- Get animal reproduction stat
349+
--- @param animal animal
350+
--- @return float
351+
function AnimalService.getReproduction (animal)
352+
return animal:BFG_GET_ATTR_FLOAT("reproduction")
353+
end
354+
355+
--- Set animal reproduction stat
356+
--- @param animal animal
357+
--- @param reproduction float
358+
function AnimalService.setReproduction (animal, reproduction)
359+
setNeed(animal, "reproduction", reproduction)
360+
end
361+
362+
--- Get if animal can reproduce
363+
--- @param animal animal
364+
--- @return bool
365+
function AnimalService.getCanReproduce (animal)
366+
return canreproduce(animal)
367+
end
368+
280369
---- REST ----
281370

282371
--- Get animal rest status
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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 = {}
9+
10+
RRService.AnimalGetAge() {
11+
12+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
--- Function for try-catching
2+
--- @param func function
3+
function try(func)
4+
-- Try
5+
local status, exception = pcall(func)
6+
-- Catch
7+
if not status then
8+
-- Show exception in the message panel in-game
9+
local increment = 50
10+
for i = 0, string.len(exception), increment
11+
do
12+
displayZooMessageTextWithZoom(string.sub(exception, i, i+increment-1), 1, 30)
13+
end
14+
end
15+
end
16+
17+
--- Function for try-catching with a custom callback
18+
--- @param func function
19+
--- @param callback function
20+
function tryCatch(func, callback)
21+
-- Try
22+
local status, exception = pcall(func)
23+
-- Catch
24+
if not status then
25+
-- Call callback function
26+
callback(exception)
27+
end
28+
end

0 commit comments

Comments
 (0)