mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 12:04:18 +02:00
handle match on non-default serverScripts property during entity send
This commit is contained in:
parent
3556379034
commit
a1ad496772
1 changed files with 17 additions and 9 deletions
|
@ -2236,19 +2236,27 @@ void EntityItem::globalizeProperties(EntityItemProperties& properties, const QSt
|
|||
|
||||
|
||||
bool EntityItem::matchesJSONFilters(const QJsonObject& jsonFilters) const {
|
||||
// currently the only property filter we handle is '+' which means that query is only asking for entities
|
||||
// where the given property is non-default
|
||||
|
||||
// enumerate the filter object - for each key present check if the filter (which we only expect to be '+' right now)
|
||||
// tells us that we should include this entity or not
|
||||
bool matchedAllFilters = true;
|
||||
// The intention for the query JSON filter and this method is to be flexible to handle a variety of filters for
|
||||
// ALL entity properties. Some work will need to be done to the property system so that it can be more flexible
|
||||
// (to grab the value and default value of a property given the string representation of that property, for example)
|
||||
|
||||
// currently the only property filter we handle is '+' for serverScripts
|
||||
// which means that we only handle a filtered query asking for entities where the serverScripts property is non-default
|
||||
|
||||
static const QString SERVER_SCRIPTS_PROPERTY = "serverScripts";
|
||||
|
||||
for (auto& property : jsonFilters.keys()) {
|
||||
if (jsonFilters[property] == EntityQueryFilterSymbol::NonDefault) {
|
||||
// check if this entity has a non-default value for the given property
|
||||
|
||||
if (property == SERVER_SCRIPTS_PROPERTY && jsonFilters[property] == EntityQueryFilterSymbol::NonDefault) {
|
||||
// check if this entity has a non-default value for serverScripts
|
||||
if (_serverScripts != ENTITY_ITEM_DEFAULT_SERVER_SCRIPTS) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return matchedAllFilters;
|
||||
// the json filter syntax did not match what we expected, return a match
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue