MCPcopy Create free account
hub / github.com/Norbyte/ositools / CreateGameObjectMove

Function CreateGameObjectMove

OsiInterface/Functions/GameActionFunctions.cpp:179–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177 }
178
179 bool CreateGameObjectMove(OsiArgumentDesc & args)
180 {
181 ObjectHandle objectHandle;
182
183 auto character = FindCharacterByNameGuid(args[0].String);
184 if (character != nullptr) {
185 character->GetObjectHandle(&objectHandle);
186 } else {
187 auto item = FindItemByNameGuid(args[0].String);
188 if (item != nullptr) {
189 item->GetObjectHandle(&objectHandle);
190 } else {
191 OsiError("Game object '" << args[0].String << "' does not exist!");
192 return false;
193 }
194 }
195
196 auto beamEffectName = args[4].String;
197 FixedString beamEffectFs;
198 esv::Character * caster{ nullptr };
199 if (beamEffectName != nullptr && strlen(beamEffectName) > 0) {
200 beamEffectFs = ToFixedString(beamEffectName);
201
202 if (!beamEffectFs) {
203 OsiError("Beam effect is not a valid FixedString!");
204 return false;
205 }
206
207 auto casterGuid = args[5].String;
208 caster = FindCharacterByNameGuid(casterGuid);
209 if (caster == nullptr) {
210 OsiError("Caster character '" << casterGuid << "' does not exist!");
211 return false;
212 }
213 }
214
215 auto const & lib = gOsirisProxy->GetLibraryManager();
216 auto actionMgr = lib.GetGameActionManager();
217
218 if (lib.GameObjectMoveActionSetup == nullptr) {
219 OsiError("GameObjectMove symbols not available in library manager");
220 return false;
221 }
222
223 if (lib.CreateGameAction == nullptr || lib.AddGameAction == nullptr || actionMgr == nullptr) {
224 OsiError("Game Action maanger not available");
225 return false;
226 }
227
228 auto action = (esv::GameObjectMoveAction *)lib.CreateGameAction(actionMgr, GameActionType::GameObjectMoveAction, 0);
229
230 glm::vec3 targetPosition = args.GetVector(1);
231
232 if (caster != nullptr) {
233 ObjectHandle casterHandle;
234 caster->GetObjectHandle(&casterHandle);
235 action->CasterCharacterHandle = casterHandle;
236 action->BeamEffectName = beamEffectFs;

Callers

nothing calls this directly

Calls 5

FindCharacterByNameGuidFunction · 0.85
FindItemByNameGuidFunction · 0.85
ToFixedStringFunction · 0.85
GetGameActionManagerMethod · 0.80
GetVectorMethod · 0.80

Tested by

no test coverage detected