slight polishing
This commit is contained in:
parent
ee296e3381
commit
320428eddf
@ -285,7 +285,6 @@ void Player::init(World* world, EntityId entityId, EntityMode mode) {
|
||||
Entity::init(world, entityId, mode);
|
||||
|
||||
auto speciesDefinition = Root::singleton().speciesDatabase()->species(m_identity.species);
|
||||
m_statusController->setStatusProperty("ouchNoise", speciesDefinition->ouchNoise(m_identity.gender));
|
||||
|
||||
m_tools->init(this);
|
||||
m_movementController->init(world);
|
||||
@ -295,6 +294,7 @@ void Player::init(World* world, EntityId entityId, EntityMode mode) {
|
||||
m_techController->init(this, m_movementController.get(), m_statusController.get());
|
||||
|
||||
if (mode == EntityMode::Master) {
|
||||
m_statusController->setStatusProperty("ouchNoise", speciesDefinition->ouchNoise(m_identity.gender));
|
||||
m_emoteState = HumanoidEmote::Idle;
|
||||
m_questManager->init(world);
|
||||
m_companions->init(this, world);
|
||||
@ -1088,6 +1088,9 @@ Json Player::getGenericProperty(String const& name, Json const& defaultValue) co
|
||||
}
|
||||
|
||||
void Player::setGenericProperty(String const& name, Json const& value) {
|
||||
if (value.isNull())
|
||||
m_genericProperties.erase(name);
|
||||
else
|
||||
m_genericProperties.set(name, value);
|
||||
}
|
||||
|
||||
@ -2086,8 +2089,11 @@ QuestManagerPtr Player::questManager() const {
|
||||
|
||||
Json Player::diskStore() {
|
||||
JsonObject genericScriptStorage;
|
||||
for (auto& p : m_genericScriptContexts)
|
||||
genericScriptStorage[p.first] = p.second->getScriptStorage();
|
||||
for (auto& p : m_genericScriptContexts) {
|
||||
auto scriptStorage = p.second->getScriptStorage();
|
||||
if (!scriptStorage.empty())
|
||||
genericScriptStorage[p.first] = move(scriptStorage);
|
||||
}
|
||||
|
||||
return JsonObject{
|
||||
{"uuid", *uniqueId()},
|
||||
|
@ -2037,13 +2037,20 @@ Json WorldServer::getProperty(String const& propertyName, Json const& def) const
|
||||
}
|
||||
|
||||
void WorldServer::setProperty(String const& propertyName, Json const& property) {
|
||||
if (m_worldProperties.value(propertyName) == property)
|
||||
return;
|
||||
|
||||
m_worldProperties[propertyName] = property;
|
||||
// Kae: Properties set to null (nil from Lua) should be erased instead of lingering around
|
||||
auto entry = m_worldProperties.find(propertyName);
|
||||
bool missing = entry == m_worldProperties.end();
|
||||
if (missing ? !property.isNull() : property != entry->second) {
|
||||
if (missing) // property can't be null if we're doing this when missing is true
|
||||
m_worldProperties.emplace(propertyName, property);
|
||||
else if (property.isNull())
|
||||
m_worldProperties.erase(entry);
|
||||
else
|
||||
entry->second = property;
|
||||
for (auto const& pair : m_clientInfo)
|
||||
pair.second->outgoingPackets.append(make_shared<UpdateWorldPropertiesPacket>(JsonObject{ {propertyName, property} }));
|
||||
}
|
||||
}
|
||||
|
||||
void WorldServer::timer(int stepsDelay, WorldAction worldAction) {
|
||||
m_timers.append({stepsDelay, worldAction});
|
||||
|
Loading…
Reference in New Issue
Block a user