Skip to content

Commit

Permalink
NWN2: getTrapBaseType scripting function
Browse files Browse the repository at this point in the history
  • Loading branch information
rjshae authored and DrMcCoy committed Feb 23, 2019
1 parent 7da634d commit 2af62c6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/engines/nwn2/script/function_tables.h
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ const Functions::FunctionPointer Functions::kFunctionPointers[] = {
{ 528, "GetTrapDetectable" , 0 },
{ 529, "GetTrapDetectedBy" , 0 },
{ 530, "GetTrapFlagged" , 0 },
{ 531, "GetTrapBaseType" , 0 },
{ 531, "GetTrapBaseType" , &Functions::getTrapBaseType },
{ 532, "GetTrapOneShot" , 0 },
{ 533, "GetTrapCreator" , 0 },
{ 534, "GetTrapKeyTag" , 0 },
Expand Down
5 changes: 3 additions & 2 deletions src/engines/nwn2/script/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,9 @@ class Functions {
void getCurrentHitPoints(Aurora::NWScript::FunctionContext &ctx);
void getMaxHitPoints (Aurora::NWScript::FunctionContext &ctx);

void getIsTrapped (Aurora::NWScript::FunctionContext &ctx);
void getTrapActive(Aurora::NWScript::FunctionContext &ctx);
void getIsTrapped (Aurora::NWScript::FunctionContext &ctx);
void getTrapActive (Aurora::NWScript::FunctionContext &ctx);
void getTrapBaseType(Aurora::NWScript::FunctionContext &ctx);

void setTrapActive(Aurora::NWScript::FunctionContext &ctx);

Expand Down
9 changes: 9 additions & 0 deletions src/engines/nwn2/script/functions_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,15 @@ void Functions::getTrapActive(Aurora::NWScript::FunctionContext &ctx) {
ctx.getReturn() = (trigger) ? trigger->getTrapActive() : 0;
}

void Functions::getTrapBaseType(Aurora::NWScript::FunctionContext &ctx) {
NWN2::Object *object = NWN2::ObjectContainer::toObject(getParamObject(ctx, 0));
if (!object)
return;

Trigger *trigger = NWN2::ObjectContainer::toTrigger(object);
ctx.getReturn() = trigger->getTrapBaseType();
}

void Functions::setTrapActive(Aurora::NWScript::FunctionContext &ctx) {
NWN2::Object *object = NWN2::ObjectContainer::toObject(getParamObject(ctx, 0));
if (!object)
Expand Down

0 comments on commit 2af62c6

Please sign in to comment.