@@ -3,6 +3,7 @@ include "scenario/scripts/entity.lua"
33include " scenario/scripts/misc.lua"
44include " scenario/scripts/token.lua"
55include " scenario/scripts/ui.lua"
6+ include " scripts/canreproduce.lua"
67
78--- Service for modifiying animals.
89AnimalService = {}
@@ -70,6 +71,22 @@ function AnimalService.setBathroom (animal, bathroom)
7071 setNeed (animal , " bathroom" , bathroom )
7172end
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
84101end
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 )
124155end
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 )
203246end
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
230289end
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 )
278344end
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
0 commit comments