- if (sao) {
- try {
- sao->setHPRaw(args.getS32("hp"));
- } catch(SettingNotFoundException &e) {
- sao->setHPRaw(PLAYER_MAX_HP);
- }
-
- try {
- sao->setBasePosition(args.getV3F("position"));
- } catch (SettingNotFoundException &e) {}
-
- try {
- sao->setPitch(args.getFloat("pitch"));
- } catch (SettingNotFoundException &e) {}
- try {
- sao->setYaw(args.getFloat("yaw"));
- } catch (SettingNotFoundException &e) {}
-
- try {
- sao->setBreath(args.getS32("breath"), false);
- } catch (SettingNotFoundException &e) {}
-
- try {
- const std::string &extended_attributes = args.get("extended_attributes");
- Json::Reader reader;
- Json::Value attr_root;
- reader.parse(extended_attributes, attr_root);
-
- const Json::Value::Members attr_list = attr_root.getMemberNames();
- for (Json::Value::Members::const_iterator it = attr_list.begin();
- it != attr_list.end(); ++it) {
- Json::Value attr_value = attr_root[*it];
- sao->setExtendedAttribute(*it, attr_value.asString());
- }
- } catch (SettingNotFoundException &e) {}
- }