-
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
setCollision
method for ObjectReference
collision manag…
…ement (#2333)
- Loading branch information
Showing
10 changed files
with
105 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Added a `setCollision` method to enable or disable an `ObjectReference`'s collision, serving as a binding for a method from CommonLibSSE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
skyrim-platform/src/platform_se/skyrim_platform/ObjectReferenceApi.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include "ObjectReferenceApi.h" | ||
|
||
#include "NullPointerException.h" | ||
|
||
RE::TESObjectREFR* GetArgObjectReference(const JsValue& arg) | ||
{ | ||
auto formId = static_cast<uint32_t>(static_cast<double>(arg)); | ||
auto refr = RE::TESForm::LookupByID<RE::TESObjectREFR>(formId); | ||
|
||
if (!refr) { | ||
throw NullPointerException("refr"); | ||
} | ||
|
||
return refr; | ||
} | ||
|
||
JsValue ObjectReferenceApi::SetCollision(const JsFunctionArguments& args) | ||
{ | ||
auto refr = GetArgObjectReference(args[1]); | ||
refr->SetCollision(static_cast<bool>(args[2])); | ||
return JsValue::Undefined(); | ||
} |
11 changes: 11 additions & 0 deletions
11
skyrim-platform/src/platform_se/skyrim_platform/ObjectReferenceApi.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#pragma once | ||
|
||
namespace ObjectReferenceApi { | ||
|
||
JsValue SetCollision(const JsFunctionArguments& args); | ||
|
||
inline void Register(JsValue& exports) | ||
{ | ||
exports.SetProperty("setCollision", JsValue::Function(SetCollision)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters