Ensure all scripting messages are written to script debug channel
This commit is contained in:
parent
40e48cc02c
commit
a52e914b1b
13 changed files with 141 additions and 141 deletions
|
@ -59,7 +59,7 @@ Variable Routines::assignCommand(const VariablesList &args, ExecutionContext &ct
|
|||
auto objectAction = make_unique<CommandAction>(move(action));
|
||||
subject->actionQueue().add(move(objectAction));
|
||||
} else {
|
||||
debug("Script: assignCommand: subject is invalid");
|
||||
debug("Script: assignCommand: subject is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -83,7 +83,7 @@ Variable Routines::actionMoveToObject(const VariablesList &args, ExecutionContex
|
|||
auto action = make_unique<MoveToObjectAction>(move(moveTo), run, range);
|
||||
getCaller(ctx)->actionQueue().add(move(action));
|
||||
} else {
|
||||
debug("Script: actionMoveToObject: moveTo is invalid");
|
||||
debug("Script: actionMoveToObject: moveTo is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -103,7 +103,7 @@ Variable Routines::actionStartConversation(const VariablesList &args, ExecutionC
|
|||
auto action = make_unique<StartConversationAction>(move(objectToConverse), move(dialogResRef), ignoreStartRange);
|
||||
caller->actionQueue().add(move(action));
|
||||
} else {
|
||||
debug("Script: actionStartConversation: objectToConverse is invalid");
|
||||
debug("Script: actionStartConversation: objectToConverse is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -127,7 +127,7 @@ Variable Routines::actionOpenDoor(const VariablesList &args, ExecutionContext &c
|
|||
auto action = make_unique<ObjectAction>(ActionType::OpenDoor, door);
|
||||
getCaller(ctx)->actionQueue().add(move(action));
|
||||
} else {
|
||||
debug("Script: actionOpenDoor: door is invalid");
|
||||
debug("Script: actionOpenDoor: door is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
return Variable();
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ Variable Routines::actionCloseDoor(const VariablesList &args, ExecutionContext &
|
|||
auto action = make_unique<ObjectAction>(ActionType::CloseDoor, door);
|
||||
getCaller(ctx)->actionQueue().add(move(action));
|
||||
} else {
|
||||
debug("Script: actionCloseDoor: door is invalid");
|
||||
debug("Script: actionCloseDoor: door is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
return Variable();
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ Variable Routines::actionJumpToObject(const VariablesList &args, ExecutionContex
|
|||
auto action = make_unique<ObjectAction>(ActionType::JumpToObject, move(jumpTo));
|
||||
getCaller(ctx)->actionQueue().add(move(action));
|
||||
} else {
|
||||
debug("Script: actionJumpToObject: jumpTo is invalid");
|
||||
debug("Script: actionJumpToObject: jumpTo is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -169,7 +169,7 @@ Variable Routines::actionJumpToLocation(const VariablesList &args, ExecutionCont
|
|||
auto action = make_unique<LocationAction>(ActionType::JumpToLocation, move(location));
|
||||
getCaller(ctx)->actionQueue().add(move(action));
|
||||
} else {
|
||||
debug("Script: actionJumpToLocation: location is invalid");
|
||||
debug("Script: actionJumpToLocation: location is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
return Variable();
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ Variable Routines::actionForceMoveToObject(const VariablesList &args, ExecutionC
|
|||
auto action = make_unique<MoveToObjectAction>(move(moveTo), run, range);
|
||||
getCaller(ctx)->actionQueue().add(move(action));
|
||||
} else {
|
||||
debug("Script: actionForceMoveToObject: moveTo is invalid");
|
||||
debug("Script: actionForceMoveToObject: moveTo is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -201,7 +201,7 @@ Variable Routines::actionForceMoveToLocation(const VariablesList &args, Executio
|
|||
auto action = make_unique<MoveToLocationAction>(move(destination));
|
||||
getCaller(ctx)->actionQueue().add(move(action));
|
||||
} else {
|
||||
debug("Script: actionForceMoveToLocation: destination is invalid");
|
||||
debug("Script: actionForceMoveToLocation: destination is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -216,7 +216,7 @@ Variable Routines::jumpToObject(const VariablesList &args, ExecutionContext &ctx
|
|||
auto action = make_unique<ObjectAction>(ActionType::JumpToObject, move(jumpTo));
|
||||
getCaller(ctx)->actionQueue().addToTop(move(action));
|
||||
} else {
|
||||
debug("Script: jumpToObject: jumpTo is invalid");
|
||||
debug("Script: jumpToObject: jumpTo is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -228,7 +228,7 @@ Variable Routines::jumpToLocation(const VariablesList &args, ExecutionContext &c
|
|||
auto action = make_unique<LocationAction>(ActionType::JumpToLocation, move(destination));
|
||||
getCaller(ctx)->actionQueue().addToTop(move(action));
|
||||
} else {
|
||||
debug("Script: jumpToLocation: destination is invalid");
|
||||
debug("Script: jumpToLocation: destination is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
return Variable();
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ Variable Routines::actionMoveToLocation(const VariablesList &args, ExecutionCont
|
|||
auto action = make_unique<MoveToLocationAction>(move(destination), run);
|
||||
getCaller(ctx)->actionQueue().add(move(action));
|
||||
} else {
|
||||
debug("Script: actionMoveToLocation: destination is invalid");
|
||||
debug("Script: actionMoveToLocation: destination is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -263,7 +263,7 @@ Variable Routines::actionMoveAwayFromObject(const VariablesList &args, Execution
|
|||
auto action = make_unique<Action>(ActionType::MoveAwayFromObject);
|
||||
getCaller(ctx)->actionQueue().add(move(action));
|
||||
} else {
|
||||
debug("Script: actionMoveAwayFromObject: fleeFrom is invalid");
|
||||
debug("Script: actionMoveAwayFromObject: fleeFrom is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -279,7 +279,7 @@ Variable Routines::actionEquipItem(const VariablesList &args, ExecutionContext &
|
|||
auto action = make_unique<Action>(ActionType::EquipItem);
|
||||
getCaller(ctx)->actionQueue().add(move(action));
|
||||
} else {
|
||||
debug("Script: actionEquipItem: item is invalid");
|
||||
debug("Script: actionEquipItem: item is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -294,7 +294,7 @@ Variable Routines::actionUnequipItem(const VariablesList &args, ExecutionContext
|
|||
auto action = make_unique<Action>(ActionType::UnequipItem);
|
||||
getCaller(ctx)->actionQueue().add(move(action));
|
||||
} else {
|
||||
debug("Script: actionUnequipItem: item is invalid");
|
||||
debug("Script: actionUnequipItem: item is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -307,7 +307,7 @@ Variable Routines::actionPickUpItem(const VariablesList &args, ExecutionContext
|
|||
auto action = make_unique<Action>(ActionType::PickUpItem);
|
||||
getCaller(ctx)->actionQueue().add(move(action));
|
||||
} else {
|
||||
debug("Script: actionPickUpItem: item is invalid");
|
||||
debug("Script: actionPickUpItem: item is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
return Variable();
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ Variable Routines::actionPutDownItem(const VariablesList &args, ExecutionContext
|
|||
auto action = make_unique<Action>(ActionType::DropItem);
|
||||
getCaller(ctx)->actionQueue().add(move(action));
|
||||
} else {
|
||||
debug("Script: actionPutDownItem: item is invalid");
|
||||
debug("Script: actionPutDownItem: item is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
return Variable();
|
||||
}
|
||||
|
@ -334,9 +334,9 @@ Variable Routines::actionAttack(const VariablesList &args, ExecutionContext &ctx
|
|||
auto action = make_unique<AttackAction>(attackee, caller->getAttackRange());
|
||||
caller->actionQueue().add(move(action));
|
||||
} else if (!caller) {
|
||||
debug("Script: actionAttack: caller is invalid");
|
||||
debug("Script: actionAttack: caller is invalid", 1, DebugChannels::script);
|
||||
} else if (!attackee) {
|
||||
debug("Script: actionAttack: attackee is invalid");
|
||||
debug("Script: actionAttack: attackee is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -389,9 +389,9 @@ Variable Routines::actionGiveItem(const VariablesList &args, ExecutionContext &c
|
|||
auto action = make_unique<Action>(ActionType::GiveItem);
|
||||
getCaller(ctx)->actionQueue().add(move(action));
|
||||
} else if (!item) {
|
||||
debug("Script: actionGiveItem: item is invalid");
|
||||
debug("Script: actionGiveItem: item is invalid", 1, DebugChannels::script);
|
||||
} else if (!giveTo) {
|
||||
debug("Script: actionGiveItem: giveTo is invalid");
|
||||
debug("Script: actionGiveItem: giveTo is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -406,9 +406,9 @@ Variable Routines::actionTakeItem(const VariablesList &args, ExecutionContext &c
|
|||
auto action = make_unique<Action>(ActionType::TakeItem);
|
||||
getCaller(ctx)->actionQueue().add(move(action));
|
||||
} else if (!item) {
|
||||
debug("Script: actionTakeItem: item is invalid");
|
||||
debug("Script: actionTakeItem: item is invalid", 1, DebugChannels::script);
|
||||
} else if (!takeFrom) {
|
||||
debug("Script: actionTakeItem: takeFrom is invalid");
|
||||
debug("Script: actionTakeItem: takeFrom is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -423,7 +423,7 @@ Variable Routines::actionForceFollowObject(const VariablesList &args, ExecutionC
|
|||
auto action = make_unique<Action>(ActionType::ForceFollowObject);
|
||||
getCaller(ctx)->actionQueue().add(move(action));
|
||||
} else {
|
||||
debug("Script: actionForceFollowObject: follow is invalid");
|
||||
debug("Script: actionForceFollowObject: follow is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -451,7 +451,7 @@ Variable Routines::actionCastSpellAtLocation(const VariablesList &args, Executio
|
|||
auto action = make_unique<Action>(ActionType::CastSpellAtLocation);
|
||||
getCaller(ctx)->actionQueue().add(move(action));
|
||||
} else {
|
||||
debug("Script: actionCastSpellAtLocation: targetLocation is invalid");
|
||||
debug("Script: actionCastSpellAtLocation: targetLocation is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -477,7 +477,7 @@ Variable Routines::actionUseFeat(const VariablesList &args, ExecutionContext &ct
|
|||
auto action = make_unique<Action>(ActionType::UseFeat);
|
||||
getCaller(ctx)->actionQueue().add(move(action));
|
||||
} else {
|
||||
debug("Script: actionUseFeat: target is invalid");
|
||||
debug("Script: actionUseFeat: target is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -494,7 +494,7 @@ Variable Routines::actionUseSkill(const VariablesList &args, ExecutionContext &c
|
|||
auto action = make_unique<Action>(ActionType::UseSkill);
|
||||
getCaller(ctx)->actionQueue().add(move(action));
|
||||
} else {
|
||||
debug("Script: actionUseSkill: target is invalid");
|
||||
debug("Script: actionUseSkill: target is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -509,7 +509,7 @@ Variable Routines::actionUseTalentOnObject(const VariablesList &args, ExecutionC
|
|||
auto action = make_unique<Action>(ActionType::UseTalentOnObject);
|
||||
getCaller(ctx)->actionQueue().add(move(action));
|
||||
} else {
|
||||
debug("Script: actionUseTalentOnObject: target is invalid");
|
||||
debug("Script: actionUseTalentOnObject: target is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -524,7 +524,7 @@ Variable Routines::actionUseTalentAtLocation(const VariablesList &args, Executio
|
|||
auto action = make_unique<Action>(ActionType::UseTalentAtLocation);
|
||||
getCaller(ctx)->actionQueue().add(move(action));
|
||||
} else {
|
||||
debug("Script: actionUseTalentAtLocation: targetLocation is invalid");
|
||||
debug("Script: actionUseTalentAtLocation: targetLocation is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
|
|
@ -42,7 +42,7 @@ Variable Routines::getNPCAIStyle(const VariablesList &args, ExecutionContext &ct
|
|||
if (creature) {
|
||||
result = creature->aiStyle();
|
||||
} else {
|
||||
debug("Script: getNPCAIStyle: creature is invalid");
|
||||
debug("Script: getNPCAIStyle: creature is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
@ -55,7 +55,7 @@ Variable Routines::setNPCAIStyle(const VariablesList &args, ExecutionContext &ct
|
|||
if (creature) {
|
||||
creature->setAIStyle(style);
|
||||
} else {
|
||||
debug("Script: setNPCAIStyle: creature is invalid");
|
||||
debug("Script: setNPCAIStyle: creature is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -68,7 +68,7 @@ Variable Routines::getAttackTarget(const VariablesList &args, ExecutionContext &
|
|||
if (creature) {
|
||||
result = creature->combat().attackTarget;
|
||||
} else {
|
||||
debug("Script: getAttackTarget: creature is invalid");
|
||||
debug("Script: getAttackTarget: creature is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofObject(move(result));
|
||||
|
@ -81,7 +81,7 @@ Variable Routines::getAttemptedAttackTarget(const VariablesList &args, Execution
|
|||
if (caller) {
|
||||
result = caller->combat().attemptedAttackTarget;
|
||||
} else {
|
||||
debug("Script: getAttemptedAttackTarget: caller is invalid");
|
||||
debug("Script: getAttemptedAttackTarget: caller is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofObject(move(result));
|
||||
|
@ -94,7 +94,7 @@ Variable Routines::getSpellTarget(const VariablesList &args, ExecutionContext &c
|
|||
if (creature) {
|
||||
result = creature->combat().spellTarget;
|
||||
} else {
|
||||
debug("Script: getSpellTarget: creature is invalid");
|
||||
debug("Script: getSpellTarget: creature is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofObject(move(result));
|
||||
|
@ -107,7 +107,7 @@ Variable Routines::getAttemptedSpellTarget(const VariablesList &args, ExecutionC
|
|||
if (caller) {
|
||||
result = caller->combat().attemptedSpellTarget;
|
||||
} else {
|
||||
debug("Script: getAttemptedSpellTarget: caller is invalid");
|
||||
debug("Script: getAttemptedSpellTarget: caller is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofObject(move(result));
|
||||
|
@ -120,7 +120,7 @@ Variable Routines::getIsDebilitated(const VariablesList &args, ExecutionContext
|
|||
if (creature) {
|
||||
result = creature->combat().debilitated;
|
||||
} else {
|
||||
debug("Script: getIsDebilitated: creature is invalid");
|
||||
debug("Script: getIsDebilitated: creature is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
@ -133,7 +133,7 @@ Variable Routines::getLastHostileTarget(const VariablesList &args, ExecutionCont
|
|||
if (attacker) {
|
||||
result = attacker->combat().lastHostileTarget;
|
||||
} else {
|
||||
debug("Script: getIsDebilitated: attacker is invalid");
|
||||
debug("Script: getIsDebilitated: attacker is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofObject(result);
|
||||
|
|
|
@ -103,7 +103,7 @@ Variable Routines::executeScript(const VariablesList &args, ExecutionContext &ct
|
|||
_game->setRunScriptVar(scriptVar);
|
||||
_game->scriptRunner().run(script, target->id());
|
||||
} else {
|
||||
debug("Script: executeScript: target is invalid");
|
||||
debug("Script: executeScript: target is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
|
|
@ -141,7 +141,7 @@ Variable Routines::getGender(const VariablesList &args, ExecutionContext &ctx) {
|
|||
if (creature) {
|
||||
result = creature->gender();
|
||||
} else {
|
||||
debug("Script: getGender: creature is invalid");
|
||||
debug("Script: getGender: creature is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
@ -154,7 +154,7 @@ Variable Routines::getHitDice(const VariablesList &args, ExecutionContext &ctx)
|
|||
if (creature) {
|
||||
result = creature->attributes().getAggregateLevel();
|
||||
} else {
|
||||
debug("Script: getGender: creature is invalid");
|
||||
debug("Script: getGender: creature is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(result);
|
||||
|
@ -168,7 +168,7 @@ Variable Routines::getClassByPosition(const VariablesList &args, ExecutionContex
|
|||
if (creature) {
|
||||
result = creature->attributes().getClassByPosition(position);
|
||||
} else {
|
||||
debug("Script: getClassByPosition: creature is invalid");
|
||||
debug("Script: getClassByPosition: creature is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
@ -182,7 +182,7 @@ Variable Routines::getLevelByClass(const VariablesList &args, ExecutionContext &
|
|||
if (creature) {
|
||||
result = creature->attributes().getClassLevel(clazz);
|
||||
} else {
|
||||
debug("Script: getLevelByClass: creature is invalid");
|
||||
debug("Script: getLevelByClass: creature is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(result);
|
||||
|
@ -196,7 +196,7 @@ Variable Routines::getHasSkill(const VariablesList &args, ExecutionContext &ctx)
|
|||
if (creature) {
|
||||
result = creature->attributes().skills().contains(skill);
|
||||
} else {
|
||||
debug("Script: getHasSkill: creature is invalid");
|
||||
debug("Script: getHasSkill: creature is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
@ -209,7 +209,7 @@ Variable Routines::getCurrentHitPoints(const VariablesList &args, ExecutionConte
|
|||
if (object) {
|
||||
result = object->currentHitPoints();
|
||||
} else {
|
||||
debug("Script: getCurrentHitPoints: object is invalid");
|
||||
debug("Script: getCurrentHitPoints: object is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(result);
|
||||
|
@ -222,7 +222,7 @@ Variable Routines::getMaxHitPoints(const VariablesList &args, ExecutionContext &
|
|||
if (object) {
|
||||
result = object->maxHitPoints();
|
||||
} else {
|
||||
debug("Script: getMaxHitPoints: object is invalid");
|
||||
debug("Script: getMaxHitPoints: object is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(result);
|
||||
|
@ -235,7 +235,7 @@ Variable Routines::getMinOneHP(const VariablesList &args, ExecutionContext &ctx)
|
|||
if (object) {
|
||||
result = object->isMinOneHP();
|
||||
} else {
|
||||
debug("Script: getMinOneHP: object is invalid");
|
||||
debug("Script: getMinOneHP: object is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
@ -248,7 +248,7 @@ Variable Routines::setMaxHitPoints(const VariablesList &args, ExecutionContext &
|
|||
if (object) {
|
||||
object->setMaxHitPoints(maxHP);
|
||||
} else {
|
||||
debug("Script: setMaxHitPoints: object is invalid");
|
||||
debug("Script: setMaxHitPoints: object is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
return Variable();
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ Variable Routines::setMinOneHP(const VariablesList &args, ExecutionContext &ctx)
|
|||
if (object) {
|
||||
object->setMinOneHP(minOneHP);
|
||||
} else {
|
||||
debug("Script: setMinOneHP: object is invalid");
|
||||
debug("Script: setMinOneHP: object is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -274,7 +274,7 @@ Variable Routines::getAbilityScore(const VariablesList &args, ExecutionContext &
|
|||
if (creature) {
|
||||
result = creature->attributes().abilities().getScore(type);
|
||||
} else {
|
||||
debug("Script: getAbilityScore: creature is invalid");
|
||||
debug("Script: getAbilityScore: creature is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(result);
|
||||
|
@ -288,7 +288,7 @@ Variable Routines::getLevelByPosition(const VariablesList &args, ExecutionContex
|
|||
if (creature) {
|
||||
result = creature->attributes().getLevelByPosition(position);
|
||||
} else {
|
||||
debug("Script: getLevelByPosition: creature is invalid");
|
||||
debug("Script: getLevelByPosition: creature is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(result);
|
||||
|
@ -302,7 +302,7 @@ Variable Routines::getSkillRank(const VariablesList &args, ExecutionContext &ctx
|
|||
if (object) {
|
||||
result = object->attributes().skills().getRank(skill);
|
||||
} else {
|
||||
debug("Script: getSkillRank: object is invalid");
|
||||
debug("Script: getSkillRank: object is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(result);
|
||||
|
@ -315,7 +315,7 @@ Variable Routines::getXP(const VariablesList &args, ExecutionContext &ctx) {
|
|||
if (creature) {
|
||||
result = creature->xp();
|
||||
} else {
|
||||
debug("Script: getXP: creature is invalid");
|
||||
debug("Script: getXP: creature is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(result);
|
||||
|
@ -328,7 +328,7 @@ Variable Routines::setXP(const VariablesList &args, ExecutionContext &ctx) {
|
|||
if (creature) {
|
||||
creature->setXP(xpAmount);
|
||||
} else {
|
||||
debug("Script: setXP: creature is invalid");
|
||||
debug("Script: setXP: creature is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -341,7 +341,7 @@ Variable Routines::giveXPToCreature(const VariablesList &args, ExecutionContext
|
|||
if (creature) {
|
||||
creature->giveXP(xpAmount);
|
||||
} else {
|
||||
debug("Script: giveXPToCreature: creature is invalid");
|
||||
debug("Script: giveXPToCreature: creature is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -354,7 +354,7 @@ Variable Routines::getRacialType(const VariablesList &args, ExecutionContext &ct
|
|||
if (creature) {
|
||||
result = creature->racialType();
|
||||
} else {
|
||||
debug("Script: getRacialType: creature is invalid");
|
||||
debug("Script: getRacialType: creature is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
@ -367,7 +367,7 @@ Variable Routines::getSubRace(const VariablesList &args, ExecutionContext &ctx)
|
|||
if (creature) {
|
||||
result = creature->subrace();
|
||||
} else {
|
||||
debug("Script: getSubRace: creature is invalid");
|
||||
debug("Script: getSubRace: creature is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
@ -381,7 +381,7 @@ Variable Routines::getHasSpell(const VariablesList &args, ExecutionContext &ctx)
|
|||
if (creature) {
|
||||
// TODO: Force Powers, aka spells, are not supported at the moment
|
||||
} else {
|
||||
debug("Script: getHasSpell: creature is invalid");
|
||||
debug("Script: getHasSpell: creature is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
|
|
@ -484,7 +484,7 @@ Variable Routines::clearAllEffects(const VariablesList &args, ExecutionContext &
|
|||
if (caller) {
|
||||
caller->clearAllEffects();
|
||||
} else {
|
||||
debug("Script: clearAllEffects: caller is invalid");
|
||||
debug("Script: clearAllEffects: caller is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
return Variable();
|
||||
}
|
||||
|
@ -498,7 +498,7 @@ Variable Routines::applyEffectToObject(const VariablesList &args, ExecutionConte
|
|||
if (target) {
|
||||
target->applyEffect(effect, durationType, duration);
|
||||
} else {
|
||||
debug("Script: applyEffectToObject: target is invalid");
|
||||
debug("Script: applyEffectToObject: target is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
|
|
@ -48,9 +48,9 @@ Variable Routines::signalEvent(const VariablesList &args, ExecutionContext &ctx)
|
|||
debug(boost::format("Event signalled: %s %s") % object->tag() % toRun->number(), 2);
|
||||
_game->scriptRunner().run(object->getOnUserDefined(), object->id(), kObjectInvalid, toRun->number());
|
||||
} else if (!object) {
|
||||
debug("Script: signalEvent: object is invalid");
|
||||
debug("Script: signalEvent: object is invalid", 1, DebugChannels::script);
|
||||
} else if (!toRun) {
|
||||
debug("Script: signalEvent: toRun is invalid");
|
||||
debug("Script: signalEvent: toRun is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
|
|
@ -40,9 +40,9 @@ Variable Routines::changeFaction(const VariablesList &args, ExecutionContext &ct
|
|||
if (objectToChangeFaction && memberOfFactionToJoin) {
|
||||
objectToChangeFaction->setFaction(memberOfFactionToJoin->faction());
|
||||
} else if (!objectToChangeFaction) {
|
||||
debug("Script: changeFaction: objectToChangeFaction is invalid");
|
||||
debug("Script: changeFaction: objectToChangeFaction is invalid", 1, DebugChannels::script);
|
||||
} else if (!memberOfFactionToJoin) {
|
||||
debug("Script: changeFaction: memberOfFactionToJoin is invalid");
|
||||
debug("Script: changeFaction: memberOfFactionToJoin is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -55,7 +55,7 @@ Variable Routines::changeToStandardFaction(const VariablesList &args, ExecutionC
|
|||
if (creatureToChange) {
|
||||
creatureToChange->setFaction(faction);
|
||||
} else {
|
||||
debug("Script: changeToStandardFaction: creatureToChange is invalid");
|
||||
debug("Script: changeToStandardFaction: creatureToChange is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -69,9 +69,9 @@ Variable Routines::getFactionEqual(const VariablesList &args, ExecutionContext &
|
|||
if (firstObject && secondObject) {
|
||||
result = firstObject->faction() == secondObject->faction();
|
||||
} else if (!firstObject) {
|
||||
debug("Script: getStandardFaction: firstObject is invalid");
|
||||
debug("Script: getStandardFaction: firstObject is invalid", 1, DebugChannels::script);
|
||||
} else if (!secondObject) {
|
||||
debug("Script: getStandardFaction: secondObject is invalid");
|
||||
debug("Script: getStandardFaction: secondObject is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
@ -84,7 +84,7 @@ Variable Routines::getStandardFaction(const VariablesList &args, ExecutionContex
|
|||
if (object) {
|
||||
result = object->faction();
|
||||
} else {
|
||||
debug("Script: getStandardFaction: object is invalid");
|
||||
debug("Script: getStandardFaction: object is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
@ -98,9 +98,9 @@ Variable Routines::getIsEnemy(const VariablesList &args, ExecutionContext &ctx)
|
|||
if (target && source) {
|
||||
result = Reputes::instance().getIsEnemy(*target, *source);
|
||||
} else if (!target) {
|
||||
debug("Script: getIsEnemy: target is invalid");
|
||||
debug("Script: getIsEnemy: target is invalid", 1, DebugChannels::script);
|
||||
} else if (!source) {
|
||||
debug("Script: getIsEnemy: source is invalid");
|
||||
debug("Script: getIsEnemy: source is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
@ -114,9 +114,9 @@ Variable Routines::getIsFriend(const VariablesList &args, ExecutionContext &ctx)
|
|||
if (target && source) {
|
||||
result = Reputes::instance().getIsFriend(*target, *source);
|
||||
} else if (!target) {
|
||||
debug("Script: getIsFriend: target is invalid");
|
||||
debug("Script: getIsFriend: target is invalid", 1, DebugChannels::script);
|
||||
} else if (!source) {
|
||||
debug("Script: getIsFriend: source is invalid");
|
||||
debug("Script: getIsFriend: source is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
@ -130,9 +130,9 @@ Variable Routines::getIsNeutral(const VariablesList &args, ExecutionContext &ctx
|
|||
if (target && source) {
|
||||
result = Reputes::instance().getIsNeutral(*target, *source);
|
||||
} else if (!target) {
|
||||
debug("Script: getIsNeutral: target is invalid");
|
||||
debug("Script: getIsNeutral: target is invalid", 1, DebugChannels::script);
|
||||
} else if (!source) {
|
||||
debug("Script: getIsNeutral: source is invalid");
|
||||
debug("Script: getIsNeutral: source is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
|
|
@ -43,7 +43,7 @@ Variable Routines::getItemInSlot(const VariablesList &args, ExecutionContext &ct
|
|||
if (creature) {
|
||||
result = creature->getEquippedItem(slot);
|
||||
} else {
|
||||
debug("Script: getItemInSlot: creature is invalid");
|
||||
debug("Script: getItemInSlot: creature is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofObject(move(result));
|
||||
|
@ -58,9 +58,9 @@ Variable Routines::createItemOnObject(const VariablesList &args, ExecutionContex
|
|||
if (!itemTemplate.empty() && target) {
|
||||
result = target->addItem(itemTemplate, stackSize, true);
|
||||
} else if (itemTemplate.empty()) {
|
||||
debug("Script: createItemOnObject: itemTemplate is invalid");
|
||||
debug("Script: createItemOnObject: itemTemplate is invalid", 1, DebugChannels::script);
|
||||
} else if (!target) {
|
||||
debug("Script: createItemOnObject: target is invalid");
|
||||
debug("Script: createItemOnObject: target is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofObject(move(result));
|
||||
|
@ -73,7 +73,7 @@ Variable Routines::getFirstItemInInventory(const VariablesList &args, ExecutionC
|
|||
if (target) {
|
||||
result = target->getFirstItem();
|
||||
} else {
|
||||
debug("Script: getFirstItemInInventory: target is invalid");
|
||||
debug("Script: getFirstItemInInventory: target is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofObject(move(result));
|
||||
|
@ -86,7 +86,7 @@ Variable Routines::getNextItemInInventory(const VariablesList &args, ExecutionCo
|
|||
if (target) {
|
||||
result = target->getNextItem();
|
||||
} else {
|
||||
debug("Script: getNextItemInInventory: target is invalid");
|
||||
debug("Script: getNextItemInInventory: target is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofObject(move(result));
|
||||
|
@ -99,7 +99,7 @@ Variable Routines::getItemStackSize(const VariablesList &args, ExecutionContext
|
|||
if (item) {
|
||||
result = item->stackSize();
|
||||
} else {
|
||||
debug("Script: getItemStackSize: item is invalid");
|
||||
debug("Script: getItemStackSize: item is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(result);
|
||||
|
@ -112,7 +112,7 @@ Variable Routines::setItemStackSize(const VariablesList &args, ExecutionContext
|
|||
if (item) {
|
||||
item->setStackSize(stackSize);
|
||||
} else {
|
||||
debug("Script: setItemStackSize: item is invalid");
|
||||
debug("Script: setItemStackSize: item is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -125,7 +125,7 @@ Variable Routines::getIdentified(const VariablesList &args, ExecutionContext &ct
|
|||
if (item) {
|
||||
result = item->isIdentified();
|
||||
} else {
|
||||
debug("Script: getIdentified: item is invalid");
|
||||
debug("Script: getIdentified: item is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
@ -138,7 +138,7 @@ Variable Routines::setIdentified(const VariablesList &args, ExecutionContext &ct
|
|||
if (item) {
|
||||
item->setIdentified(identified);
|
||||
} else {
|
||||
debug("Script: setIdentified: item is invalid");
|
||||
debug("Script: setIdentified: item is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -152,9 +152,9 @@ Variable Routines::getItemPossessedBy(const VariablesList &args, ExecutionContex
|
|||
if (creature && !itemTag.empty()) {
|
||||
result = creature->getItemByTag(itemTag);
|
||||
} else if (!creature) {
|
||||
debug("Script: getItemPossessedBy: creature is invalid");
|
||||
debug("Script: getItemPossessedBy: creature is invalid", 1, DebugChannels::script);
|
||||
} else if (itemTag.empty()) {
|
||||
debug("Script: getItemPossessedBy: itemTag is invalid");
|
||||
debug("Script: getItemPossessedBy: itemTag is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofObject(move(result));
|
||||
|
@ -167,7 +167,7 @@ Variable Routines::getBaseItemType(const VariablesList &args, ExecutionContext &
|
|||
if (item) {
|
||||
result = item->baseItemType();
|
||||
} else {
|
||||
debug("Script: getBaseItemType: item is invalid");
|
||||
debug("Script: getBaseItemType: item is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(result);
|
||||
|
|
|
@ -43,7 +43,7 @@ Variable Routines::getFacingFromLocation(const VariablesList &args, ExecutionCon
|
|||
if (location) {
|
||||
result = glm::degrees(location->facing());
|
||||
} else {
|
||||
debug("Script: getFacingFromLocation: location is invalid");
|
||||
debug("Script: getFacingFromLocation: location is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofFloat(result);
|
||||
|
@ -58,7 +58,7 @@ Variable Routines::getLocation(const VariablesList &args, ExecutionContext &ctx)
|
|||
float facing = object->facing();
|
||||
result = make_shared<Location>(move(position), facing);
|
||||
} else {
|
||||
debug("Script: getLocation: object is invalid");
|
||||
debug("Script: getLocation: object is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofLocation(move(result));
|
||||
|
@ -71,7 +71,7 @@ Variable Routines::getPositionFromLocation(const VariablesList &args, ExecutionC
|
|||
if (location) {
|
||||
result = location->position();
|
||||
} else {
|
||||
debug("Script: getPositionFromLocation: location is invalid");
|
||||
debug("Script: getPositionFromLocation: location is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofVector(move(result));
|
||||
|
@ -93,9 +93,9 @@ Variable Routines::getDistanceBetweenLocations(const VariablesList &args, Execut
|
|||
if (locationA && locationB) {
|
||||
result = glm::distance(locationA->position(), locationB->position());
|
||||
} else if (!locationA) {
|
||||
debug("Script: getDistanceBetweenLocations: locationA is invalid");
|
||||
debug("Script: getDistanceBetweenLocations: locationA is invalid", 1, DebugChannels::script);
|
||||
} else if (!locationB) {
|
||||
debug("Script: getDistanceBetweenLocations: locationB is invalid");
|
||||
debug("Script: getDistanceBetweenLocations: locationB is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofFloat(result);
|
||||
|
@ -109,9 +109,9 @@ Variable Routines::getDistanceBetweenLocations2D(const VariablesList &args, Exec
|
|||
if (locationA && locationB) {
|
||||
result = glm::distance(glm::vec2(locationA->position()), glm::vec2(locationB->position()));
|
||||
} else if (!locationA) {
|
||||
debug("Script: getDistanceBetweenLocations2D: locationA is invalid");
|
||||
debug("Script: getDistanceBetweenLocations2D: locationA is invalid", 1, DebugChannels::script);
|
||||
} else if (!locationB) {
|
||||
debug("Script: getDistanceBetweenLocations2D: locationB is invalid");
|
||||
debug("Script: getDistanceBetweenLocations2D: locationB is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofFloat(result);
|
||||
|
|
|
@ -43,7 +43,7 @@ Variable Routines::destroyObject(const VariablesList &args, ExecutionContext &ct
|
|||
if (destroy) {
|
||||
_game->module()->area()->destroyObject(*destroy);
|
||||
} else {
|
||||
debug("Script: destroyObject: destroy is invalid");
|
||||
debug("Script: destroyObject: destroy is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
return Variable();
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ Variable Routines::setLocked(const VariablesList &args, ExecutionContext &ctx) {
|
|||
if (target) {
|
||||
target->setLocked(locked);
|
||||
} else {
|
||||
debug("Script: setLocked: target is invalid");
|
||||
debug("Script: setLocked: target is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -110,7 +110,7 @@ Variable Routines::getLocked(const VariablesList &args, ExecutionContext &ctx) {
|
|||
if (target) {
|
||||
result = target->isLocked();
|
||||
} else {
|
||||
debug("Script: getLocked: target is invalid");
|
||||
debug("Script: getLocked: target is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
@ -127,7 +127,7 @@ Variable Routines::getTag(const VariablesList &args, ExecutionContext &ctx) {
|
|||
if (object) {
|
||||
result = object->tag();
|
||||
} else {
|
||||
debug("Script: getTag: object is invalid");
|
||||
debug("Script: getTag: object is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofString(move(result));
|
||||
|
@ -141,9 +141,9 @@ Variable Routines::getDistanceToObject(const VariablesList &args, ExecutionConte
|
|||
if (caller && object) {
|
||||
result = caller->getDistanceTo(*object);
|
||||
} else if (!caller) {
|
||||
debug("Script: getDistanceToObject: caller is invalid");
|
||||
debug("Script: getDistanceToObject: caller is invalid", 1, DebugChannels::script);
|
||||
} else if (!object) {
|
||||
debug("Script: getDistanceToObject: object is invalid");
|
||||
debug("Script: getDistanceToObject: object is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofFloat(result);
|
||||
|
@ -157,9 +157,9 @@ Variable Routines::getDistanceToObject2D(const VariablesList &args, ExecutionCon
|
|||
if (caller && object) {
|
||||
result = caller->getDistanceTo(glm::vec2(object->position()));
|
||||
} else if (!caller) {
|
||||
debug("Script: getDistanceToObject2D: caller is invalid");
|
||||
debug("Script: getDistanceToObject2D: caller is invalid", 1, DebugChannels::script);
|
||||
} else if (!object) {
|
||||
debug("Script: getDistanceToObject2D: object is invalid");
|
||||
debug("Script: getDistanceToObject2D: object is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofFloat(result);
|
||||
|
@ -176,7 +176,7 @@ Variable Routines::getFacing(const VariablesList &args, ExecutionContext &ctx) {
|
|||
if (target) {
|
||||
result = glm::degrees(target->facing());
|
||||
} else {
|
||||
debug("Script: getFacing: target is invalid");
|
||||
debug("Script: getFacing: target is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofFloat(result);
|
||||
|
@ -189,7 +189,7 @@ Variable Routines::getPosition(const VariablesList &args, ExecutionContext &ctx)
|
|||
if (target) {
|
||||
result = target->position();
|
||||
} else {
|
||||
debug("Script: getPosition: target is invalid");
|
||||
debug("Script: getPosition: target is invalid", 1, DebugChannels::script);
|
||||
return Variable::ofVector(glm::vec3(0.0f));
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ Variable Routines::soundObjectPlay(const VariablesList &args, ExecutionContext &
|
|||
if (sound) {
|
||||
sound->play();
|
||||
} else {
|
||||
debug("Script: soundObjectPlay: sound is invalid");
|
||||
debug("Script: soundObjectPlay: sound is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
return Variable();
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ Variable Routines::soundObjectStop(const VariablesList &args, ExecutionContext &
|
|||
if (sound) {
|
||||
sound->stop();
|
||||
} else {
|
||||
debug("Script: soundObjectStop: sound is invalid");
|
||||
debug("Script: soundObjectStop: sound is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
return Variable();
|
||||
}
|
||||
|
@ -224,9 +224,9 @@ Variable Routines::getDistanceBetween(const VariablesList &args, ExecutionContex
|
|||
if (objectA && objectB) {
|
||||
result = objectA->getDistanceTo(*objectB);
|
||||
} else if (!objectA) {
|
||||
debug("Script: getDistanceBetween: objectA is invalid");
|
||||
debug("Script: getDistanceBetween: objectA is invalid", 1, DebugChannels::script);
|
||||
} else if (!objectB) {
|
||||
debug("Script: getDistanceBetween: objectB is invalid");
|
||||
debug("Script: getDistanceBetween: objectB is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofFloat(result);
|
||||
|
@ -240,9 +240,9 @@ Variable Routines::getDistanceBetween2D(const VariablesList &args, ExecutionCont
|
|||
if (objectA && objectB) {
|
||||
result = objectA->getDistanceTo(glm::vec2(objectB->position()));
|
||||
} else if (!objectA) {
|
||||
debug("Script: getDistanceBetween2D: objectA is invalid");
|
||||
debug("Script: getDistanceBetween2D: objectA is invalid", 1, DebugChannels::script);
|
||||
} else if (!objectB) {
|
||||
debug("Script: getDistanceBetween2D: objectB is invalid");
|
||||
debug("Script: getDistanceBetween2D: objectB is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofFloat(result);
|
||||
|
@ -255,7 +255,7 @@ Variable Routines::getIsDead(const VariablesList &args, ExecutionContext &ctx) {
|
|||
if (creature) {
|
||||
result = creature->isDead();
|
||||
} else {
|
||||
debug("Script: getIsDead: creature is invalid");
|
||||
debug("Script: getIsDead: creature is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
@ -268,7 +268,7 @@ Variable Routines::getIsInCombat(const VariablesList &args, ExecutionContext &ct
|
|||
if (creature) {
|
||||
result = creature->isInCombat();
|
||||
} else {
|
||||
debug("Script: getIsInCombat: creature is invalid");
|
||||
debug("Script: getIsInCombat: creature is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
@ -281,7 +281,7 @@ Variable Routines::getIsOpen(const VariablesList &args, ExecutionContext &ctx) {
|
|||
if (object) {
|
||||
result = object->isOpen();
|
||||
} else {
|
||||
debug("Script: getIsOpen: object is invalid");
|
||||
debug("Script: getIsOpen: object is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
@ -294,7 +294,7 @@ Variable Routines::setFacing(const VariablesList &args, ExecutionContext &ctx) {
|
|||
if (caller) {
|
||||
caller->setFacing(glm::radians(direction));
|
||||
} else {
|
||||
debug("Script: setFacing: caller is invalid");
|
||||
debug("Script: setFacing: caller is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -306,7 +306,7 @@ Variable Routines::setFacingPoint(const VariablesList &args, ExecutionContext &c
|
|||
glm::vec3 target(getVector(args, 0));
|
||||
caller->face(target);
|
||||
} else {
|
||||
debug("Script: setFacingPoint: caller is invalid");
|
||||
debug("Script: setFacingPoint: caller is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
return Variable();
|
||||
}
|
||||
|
@ -318,7 +318,7 @@ Variable Routines::getName(const VariablesList &args, ExecutionContext &ctx) {
|
|||
if (object) {
|
||||
result = object->name();
|
||||
} else {
|
||||
debug("Script: getName: object is invalid");
|
||||
debug("Script: getName: object is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofString(move(result));
|
||||
|
@ -331,7 +331,7 @@ Variable Routines::getObjectType(const VariablesList &args, ExecutionContext &ct
|
|||
if (target) {
|
||||
result = target->type();
|
||||
} else {
|
||||
debug("Script: getObjectType: target is invalid");
|
||||
debug("Script: getObjectType: target is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
@ -344,7 +344,7 @@ Variable Routines::getPlotFlag(const VariablesList &args, ExecutionContext &ctx)
|
|||
if (target) {
|
||||
result = target->plotFlag();
|
||||
} else {
|
||||
debug("Script: getPlotFlag: target is invalid");
|
||||
debug("Script: getPlotFlag: target is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(result);
|
||||
|
@ -357,7 +357,7 @@ Variable Routines::setPlotFlag(const VariablesList &args, ExecutionContext &ctx)
|
|||
if (target) {
|
||||
target->setPlotFlag(plotFlag);
|
||||
} else {
|
||||
debug("Script: setPlotFlag: target is invalid");
|
||||
debug("Script: setPlotFlag: target is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -370,9 +370,9 @@ Variable Routines::faceObjectAwayFromObject(const VariablesList &args, Execution
|
|||
if (facer && objectToFaceAwayFrom) {
|
||||
facer->faceAwayFrom(*objectToFaceAwayFrom);
|
||||
} else if (!facer) {
|
||||
debug("Script: faceObjectAwayFromObject: facer is invalid");
|
||||
debug("Script: faceObjectAwayFromObject: facer is invalid", 1, DebugChannels::script);
|
||||
} else if (!objectToFaceAwayFrom) {
|
||||
debug("Script: faceObjectAwayFromObject: objectToFaceAwayFrom is invalid");
|
||||
debug("Script: faceObjectAwayFromObject: objectToFaceAwayFrom is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -385,7 +385,7 @@ Variable Routines::getCommandable(const VariablesList &args, ExecutionContext &c
|
|||
if (target) {
|
||||
result = target->isCommandable();
|
||||
} else {
|
||||
debug("Script: getCommandable: target is invalid");
|
||||
debug("Script: getCommandable: target is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
@ -398,7 +398,7 @@ Variable Routines::setCommandable(const VariablesList &args, ExecutionContext &c
|
|||
if (target) {
|
||||
target->setCommandable(commandable);
|
||||
} else {
|
||||
debug("Script: setCommandable: target is invalid");
|
||||
debug("Script: setCommandable: target is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -415,7 +415,7 @@ Variable Routines::playAnimation(const VariablesList &args, ExecutionContext &ct
|
|||
properties.speed = speed;
|
||||
caller->playAnimation(animType, move(properties));
|
||||
} else {
|
||||
debug("Script: playAnimation: caller is invalid");
|
||||
debug("Script: playAnimation: caller is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -445,9 +445,9 @@ Variable Routines::cutsceneAttack(const VariablesList &args, ExecutionContext &c
|
|||
if (caller && target) {
|
||||
_game->combat().addAttack(caller, target, nullptr, attackResult, damage);
|
||||
} else if (!caller) {
|
||||
debug("Script: cutsceneAttack: caller is invalid");
|
||||
debug("Script: cutsceneAttack: caller is invalid", 1, DebugChannels::script);
|
||||
} else if (!target) {
|
||||
debug("Script: cutsceneAttack: target is invalid");
|
||||
debug("Script: cutsceneAttack: target is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
|
|
@ -67,7 +67,7 @@ Variable Routines::getIsPC(const VariablesList &args, ExecutionContext &ctx) {
|
|||
if (creature) {
|
||||
result = creature == _game->party().player();
|
||||
} else {
|
||||
debug("Script: getIsPC: creature is invalid");
|
||||
debug("Script: getIsPC: creature is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
@ -86,7 +86,7 @@ Variable Routines::isObjectPartyMember(const VariablesList &args, ExecutionConte
|
|||
if (creature) {
|
||||
result = _game->party().isMember(*creature);
|
||||
} else {
|
||||
debug("Script: isObjectPartyMember: creature is invalid");
|
||||
debug("Script: isObjectPartyMember: creature is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
@ -121,7 +121,7 @@ Variable Routines::addPartyMember(const VariablesList &args, ExecutionContext &c
|
|||
if (creature) {
|
||||
_game->party().addAvailableMember(npc, creature->blueprintResRef());
|
||||
} else {
|
||||
debug("Script: addPartyMember: creature is invalid");
|
||||
debug("Script: addPartyMember: creature is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
|
|
@ -41,7 +41,7 @@ Variable Routines::getLastPerceived(const VariablesList &args, ExecutionContext
|
|||
if (caller) {
|
||||
result = caller->perception().lastPerceived;
|
||||
} else {
|
||||
debug("Script: getLastPerceived: caller is invalid");
|
||||
debug("Script: getLastPerceived: caller is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofObject(move(result));
|
||||
|
@ -54,7 +54,7 @@ Variable Routines::getLastPerceptionSeen(const VariablesList &args, ExecutionCon
|
|||
if (caller) {
|
||||
result = caller->perception().lastPerception == PerceptionType::Seen;
|
||||
} else {
|
||||
debug("Script: getLastPerceptionSeen: caller is invalid");
|
||||
debug("Script: getLastPerceptionSeen: caller is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
@ -67,7 +67,7 @@ Variable Routines::getLastPerceptionVanished(const VariablesList &args, Executio
|
|||
if (caller) {
|
||||
result = caller->perception().lastPerception == PerceptionType::NotSeen;
|
||||
} else {
|
||||
debug("Script: getLastPerceptionVanished: caller is invalid");
|
||||
debug("Script: getLastPerceptionVanished: caller is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
@ -80,7 +80,7 @@ Variable Routines::getLastPerceptionHeard(const VariablesList &args, ExecutionCo
|
|||
if (caller) {
|
||||
result = caller->perception().lastPerception == PerceptionType::Heard;
|
||||
} else {
|
||||
debug("Script: getLastPerceptionHeard: caller is invalid");
|
||||
debug("Script: getLastPerceptionHeard: caller is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
@ -93,7 +93,7 @@ Variable Routines::getLastPerceptionInaudible(const VariablesList &args, Executi
|
|||
if (caller) {
|
||||
result = caller->perception().lastPerception == PerceptionType::NotHeard;
|
||||
} else {
|
||||
debug("Script: getLastPerceptionInaudible: caller is invalid");
|
||||
debug("Script: getLastPerceptionInaudible: caller is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
@ -107,9 +107,9 @@ Variable Routines::getObjectSeen(const VariablesList &args, ExecutionContext &ct
|
|||
if (target && source) {
|
||||
result = source->perception().seen.count(target) > 0;
|
||||
} else if (!target) {
|
||||
debug("Script: getObjectSeen: target is invalid");
|
||||
debug("Script: getObjectSeen: target is invalid", 1, DebugChannels::script);
|
||||
} else if (!source) {
|
||||
debug("Script: getObjectSeen: source is invalid");
|
||||
debug("Script: getObjectSeen: source is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
@ -123,9 +123,9 @@ Variable Routines::getObjectHeard(const VariablesList &args, ExecutionContext &c
|
|||
if (target && source) {
|
||||
result = source->perception().heard.count(target) > 0;
|
||||
} else if (!target) {
|
||||
debug("Script: getObjectHeard: target is invalid");
|
||||
debug("Script: getObjectHeard: target is invalid", 1, DebugChannels::script);
|
||||
} else if (!source) {
|
||||
debug("Script: getObjectHeard: source is invalid");
|
||||
debug("Script: getObjectHeard: source is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(move(result)));
|
||||
|
|
|
@ -84,7 +84,7 @@ Variable Routines::getLocalBoolean(const VariablesList &args, ExecutionContext &
|
|||
if (object) {
|
||||
result = _game->getLocalBoolean(object->id(), index);
|
||||
} else {
|
||||
debug("Script: getLocalBoolean: object is invalid");
|
||||
debug("Script: getLocalBoolean: object is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
|
@ -98,7 +98,7 @@ Variable Routines::setLocalBoolean(const VariablesList &args, ExecutionContext &
|
|||
if (object) {
|
||||
_game->setLocalBoolean(object->id(), index, value);
|
||||
} else {
|
||||
debug("Script: setLocalBoolean: object is invalid");
|
||||
debug("Script: setLocalBoolean: object is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -112,7 +112,7 @@ Variable Routines::getLocalNumber(const VariablesList &args, ExecutionContext &c
|
|||
if (object) {
|
||||
result = _game->getLocalNumber(object->id(), index);
|
||||
} else {
|
||||
debug("Script: getLocalNumber: object is invalid");
|
||||
debug("Script: getLocalNumber: object is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(result);
|
||||
|
@ -126,7 +126,7 @@ Variable Routines::setLocalNumber(const VariablesList &args, ExecutionContext &c
|
|||
if (object) {
|
||||
_game->setLocalNumber(object->id(), index, value);
|
||||
} else {
|
||||
debug("Script: setLocalNumber: object is invalid");
|
||||
debug("Script: setLocalNumber: object is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
@ -144,7 +144,7 @@ Variable Routines::setGlobalLocation(const VariablesList &args, ExecutionContext
|
|||
if (value) {
|
||||
_game->setGlobalLocation(id, value);
|
||||
} else {
|
||||
debug("Script: setGlobalLocation: value is invalid");
|
||||
debug("Script: setGlobalLocation: value is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable();
|
||||
|
|
Loading…
Reference in a new issue