Add scripts for a few wild creatures (#1051)

ignore frog script
This commit is contained in:
Aaron Kimbrell
2023-04-09 10:17:05 -05:00
committed by GitHub
parent 33f9e9c8cb
commit 2cf92a16d2
10 changed files with 127 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
#include "WildGfGlowbug.h"
#include "GameMessages.h"
void WildGfGlowbug::OnStartup(Entity* self){
self->SetVar(u"switch", false);
}
void WildGfGlowbug::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
if (args == "physicsReady") {
auto switchState = self->GetVar<bool>(u"switch");
if (!switchState) {
GameMessages::SendStopFXEffect(self, true, "glowlight");
} else if (switchState) {
GameMessages::SendPlayFXEffect(self, -1, u"light", "glowlight", LWOOBJID_EMPTY);
}
}
}
void WildGfGlowbug::OnUse(Entity* self, Entity* user) {
auto switchState = self->GetVar<bool>(u"switch");
if (switchState) {
GameMessages::SendStopFXEffect(self, true, "glowlight");
self->SetVar(u"switch", false);
} else if (!switchState) {
GameMessages::SendPlayFXEffect(self, -1, u"light", "glowlight", LWOOBJID_EMPTY);
self->SetVar(u"switch", true);
}
}