From 85fd2f60a0c6d6e620cf749d127229ac06e152af Mon Sep 17 00:00:00 2001 From: jadis0x <49281043+jadis0x@users.noreply.github.com> Date: Mon, 3 Oct 2022 19:25:20 +0300 Subject: [PATCH] add: SpawnAnimal function --- DevourClient/Features/Misc/Misc.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/DevourClient/Features/Misc/Misc.cpp b/DevourClient/Features/Misc/Misc.cpp index f3f8c34..01054ac 100644 --- a/DevourClient/Features/Misc/Misc.cpp +++ b/DevourClient/Features/Misc/Misc.cpp @@ -216,3 +216,30 @@ void Misc::PlayerSpeed(int speed) { //print("[ERROR] speed error\n"); } } + +void Misc::SpawnAnimal(const char* animalName) { + std::string AnimalId = ""; + + if (animalName == "Goat") { + AnimalId = "SurvivalGoat"; + } + if (animalName == "Rat") { + AnimalId = "SurvivalRat"; + } + if (animalName == "Spider") { + // spawn spider + return; + } + + try { + Unity::CComponent* NolanBehaviour = Players::LocalPlayer->GetComponent("NolanBehaviour"); + if (!NolanBehaviour) { + return; + } + + NolanBehaviour->CallMethod("StartCarry", IL2CPP::String::New(AnimalId)); + } + catch (...) { + return; + } +}