mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 10:53:44 +00:00
feat: switch trigger physics volumes on and off at runtime
The ActivatePhysics trigger command was a TODO. The client activates or deactivates the object's physics component (LWOPhysicsSystemComponent::msgActivatePhysics, 1.10.64 0x00ccf970); the server now does the same to phantom physics: switching it off takes the volume out of the physics world (dpWorld::DetachEntity, without deleting it) and makes whatever was inside leave, switching it on adds it back and whatever is inside enters on the next step. This lets trigger driven volumes like the monument lasers turn on and off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -467,13 +467,18 @@ void TriggerComponent::HandleDestroySpawnerNetworkObjects(std::string args) {
|
||||
}
|
||||
|
||||
void TriggerComponent::HandleActivatePhysics(Entity* targetEntity, std::string args) {
|
||||
if (args == "true") {
|
||||
// TODO add physics entity if there isn't one
|
||||
} else if (args == "false") {
|
||||
// TODO remove Phsyics entity if there is one
|
||||
} else {
|
||||
if (args != "true" && args != "false") {
|
||||
LOG_DEBUG("Invalid argument for ActivatePhysics Trigger: %s", args.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
auto* const phantomPhysicsComponent = targetEntity->GetComponent<PhantomPhysicsComponent>();
|
||||
if (!phantomPhysicsComponent) {
|
||||
LOG_DEBUG("ActivatePhysics on %llu:%i which has no phantom physics", targetEntity->GetObjectID(), targetEntity->GetLOT());
|
||||
return;
|
||||
}
|
||||
|
||||
phantomPhysicsComponent->SetPhysicsActive(args == "true");
|
||||
}
|
||||
|
||||
void TriggerComponent::HandleSetPath(Entity* targetEntity, std::vector<std::string> argArray) {
|
||||
|
||||
Reference in New Issue
Block a user