Skip to content

Commit

Permalink
Update PlayerCreatureController.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
AconiteX authored Sep 28, 2021
1 parent 8ed0a7c commit 61070d8
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1524,6 +1524,24 @@ void PlayerCreatureController::handleMessage (const int message, const float val
std::vector<NetworkId> const & chipsToAdd = inMsg->getChipsToAdd();
std::vector<NetworkId> const & chipsToRemove = inMsg->getChipsToRemove();
NetworkId const & droidControlDevice = inMsg->getDroidControlDevice();

// validate network IDs passed via DroidCommandProgrammingMessage to ensure all
// objects are contained by the player & have the droid command objVar
for(const auto & i : chipsToRemove)
{
Object* obj = NetworkIdManager::getObjectById(i);
ServerObject * const sObj = ServerWorld::findObjectByNetworkId(i);
if(!obj ||
!sObj ||
!ContainerInterface::isNestedWithin(*obj, getCreature()->getInventory()->getNetworkId()) ||
!sObj->getObjVars().hasItem("strDroidCommand"))
{
LOG("SuspectedCheaterChannel", ("Player %s tried to delete an object (%s) they aren't allowed to delete using DroidCommandProgrammingMessage.",
getCreature()->getNetworkId().getValueString().c_str(),
i.getValueString().c_str()));
return;
}
}

ScriptParams params;
params.addParam(droidControlDevice);
Expand Down

0 comments on commit 61070d8

Please sign in to comment.