Skip to content

Commit 0c80296

Browse files
committed
added disease
1 parent 218783a commit 0c80296

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

castor.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"ArchiveName": "zzz-ArluqTools",
33
"RepoName": "ZtModArchive/ArluqTools",
44
"Author": "Apodemus",
5-
"Version": "v2.2",
5+
"Version": "v2.3",
66
"Type": "package",
77
"License": "MIT License",
88
"Description": "This is a lua library that is an abstraction layer around ZT2's libraries.",

scripts/services/AnimalService.lua

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,29 @@ function AnimalService.delete (animal)
167167
deleteEntity(animal)
168168
end
169169

170+
---- DISEASE ----
171+
172+
--- Get if animal has a disease
173+
--- @param animal animal
174+
--- @return bool
175+
function AnimalService.isDiseased (animal)
176+
return animal:BFG_GET_ATTR_BOOLEAN("b_Disease")
177+
end
178+
179+
180+
--- Give animal a disease
181+
--- @param animal animal
182+
--- @param diseaseName string
183+
function AnimalService.giveDisease (animal, diseaseName)
184+
local diseaseManager = queryObject("ZTDiseaseMgr")
185+
local animalName = getName(animal)
186+
local diseaseSeed = {
187+
key = diseaseName,
188+
val = animalName
189+
}
190+
diseaseManager:ZT_FORCE_DISEASE(diseaseSeed)
191+
end
192+
170193
---- ENVIROMENT ----
171194

172195
--- Get animal enviroment suitability

0 commit comments

Comments
 (0)