| 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; |
nothing calls this directly
no test coverage detected