-// Prototype
-MobV2SAO proto_MobV2SAO(NULL, v3f(0,0,0), NULL);
-
-MobV2SAO::MobV2SAO(ServerEnvironment *env, v3f pos,
- Settings *init_properties):
- ServerActiveObject(env, pos),
- m_move_type("ground_nodes"),
- m_speed(0,0,0),
- m_last_sent_position(0,0,0),
- m_oldpos(0,0,0),
- m_yaw(0),
- m_counter1(0),
- m_counter2(0),
- m_age(0),
- m_touching_ground(false),
- m_hp(10),
- m_walk_around(false),
- m_walk_around_timer(0),
- m_next_pos_exists(false),
- m_shoot_reload_timer(0),
- m_shooting(false),
- m_shooting_timer(0),
- m_falling(false),
- m_disturb_timer(100000),
- m_random_disturb_timer(0),
- m_shoot_y(0)
-{
- ServerActiveObject::registerType(getType(), create);
-
- m_properties = new Settings();
- if(init_properties)
- m_properties->update(*init_properties);
-
- m_properties->setV3F("pos", pos);
-
- setPropertyDefaults();
- readProperties();
+// No prototype, PlayerSAO does not need to be deserialized
+
+PlayerSAO::PlayerSAO(ServerEnvironment *env_, Player *player_, u16 peer_id_,
+ const std::set<std::string> &privs, bool is_singleplayer):
+ ServerActiveObject(env_, v3f(0,0,0)),
+ m_player(player_),
+ m_peer_id(peer_id_),
+ m_inventory(NULL),
+ m_damage(0),
+ m_last_good_position(0,0,0),
+ m_time_from_last_punch(0),
+ m_nocheat_dig_pos(32767, 32767, 32767),
+ m_nocheat_dig_time(0),
+ m_wield_index(0),
+ m_position_not_sent(false),
+ m_armor_groups_sent(false),
+ m_properties_sent(true),
+ m_privs(privs),
+ m_is_singleplayer(is_singleplayer),
+ m_animation_speed(0),
+ m_animation_blend(0),
+ m_animation_sent(false),
+ m_bone_position_sent(false),
+ m_attachment_parent_id(0),
+ m_attachment_sent(false),
+ // public
+ m_moved(false),
+ m_inventory_not_sent(false),
+ m_hp_not_sent(false),
+ m_breath_not_sent(false),
+ m_wielded_item_not_sent(false),
+ m_physics_override_speed(1),
+ m_physics_override_jump(1),
+ m_physics_override_gravity(1),
+ m_physics_override_sneak(true),
+ m_physics_override_sneak_glitch(true),
+ m_physics_override_sent(false)
+{
+ assert(m_player);
+ assert(m_peer_id != 0);
+ setBasePosition(m_player->getPosition());
+ m_inventory = &m_player->inventory;
+ m_armor_groups["fleshy"] = 100;
+
+ m_prop.hp_max = PLAYER_MAX_HP;
+ m_prop.physical = false;
+ m_prop.weight = 75;
+ m_prop.collisionbox = core::aabbox3d<f32>(-1/3.,-1.0,-1/3., 1/3.,1.0,1/3.);
+ // start of default appearance, this should be overwritten by LUA
+ m_prop.visual = "upright_sprite";
+ m_prop.visual_size = v2f(1, 2);
+ m_prop.textures.clear();
+ m_prop.textures.push_back("player.png");
+ m_prop.textures.push_back("player_back.png");
+ m_prop.colors.clear();
+ m_prop.colors.push_back(video::SColor(255, 255, 255, 255));
+ m_prop.spritediv = v2s16(1,1);
+ // end of default appearance
+ m_prop.is_visible = true;
+ m_prop.makes_footstep_sound = true;