MCPcopy Create free account
hub / github.com/WarmUpTill/SceneSwitcher / DeregisterScriptAction

Method DeregisterScriptAction

plugins/scripting/macro-script-handler.cpp:315–348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

313}
314
315void ScriptHandler::DeregisterScriptAction(void *, calldata_t *data)
316{
317 const char *actionName;
318 if (!calldata_get_string(data, nameParam.data(), &actionName) ||
319 strlen(actionName) == 0) {
320 blog(LOG_WARNING, "[%s] failed! \"%s\" parameter missing!",
321 deregisterActionFuncName.data(), nameParam.data());
322 RETURN_FAILURE();
323 }
324
325 const std::string id = nameToScriptID(actionName);
326 std::lock_guard<std::mutex> lock(_mutex);
327
328 if (_actions.count(id) == 0) {
329 blog(LOG_WARNING,
330 "[%s] failed! Action \"%s\" was never registered!",
331 deregisterActionFuncName.data(), id.c_str());
332 RETURN_FAILURE();
333 }
334
335 if (!MacroActionFactory::Deregister(id)) {
336 blog(LOG_WARNING,
337 "[%s] failed! Action id \"%s\" does not exist!",
338 deregisterActionFuncName.data(), id.c_str());
339 RETURN_FAILURE();
340 }
341
342 auto it = _actions.find(id);
343 if (it != _actions.end()) {
344 _actions.erase(it);
345 }
346
347 RETURN_SUCCESS();
348}
349
350void ScriptHandler::RegisterScriptCondition(void *, calldata_t *data)
351{

Callers

nothing calls this directly

Calls 6

nameToScriptIDFunction · 0.85
countMethod · 0.80
findMethod · 0.80
dataMethod · 0.45
c_strMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected