Default enabled for no change in default behaviour.
Remove 'zoom' privilege.
description = "Can use the rollback functionality",
give_to_singleplayer = false,
})
-core.register_privilege("zoom", {
- description = "Can zoom the camera",
- give_to_singleplayer = false,
-})
core.register_privilege("debug", {
description = "Allows enabling various debug options that may affect gameplay",
give_to_singleplayer = false,
// Get FOV
f32 fov_degrees;
- if (player->getPlayerControl().zoom && m_client->checkLocalPrivilege("zoom")) {
+ if (player->getPlayerControl().zoom && player->getCanZoom()) {
fov_degrees = m_cache_zoom_fov;
} else {
fov_degrees = m_cache_fov;
collision_box.MinEdge *= BS;
collision_box.MaxEdge *= BS;
player->setCollisionbox(collision_box);
+ player->setCanZoom(m_prop.can_zoom);
}
if ((m_is_player && !m_is_local_player) && m_prop.nametag.empty())
m_prop.is_visible = true;
m_prop.makes_footstep_sound = true;
m_prop.stepheight = PLAYER_DEFAULT_STEPHEIGHT * BS;
+ m_prop.can_zoom = true;
m_hp = m_prop.hp_max;
}
v3s16 getLightPosition() const;
void setYaw(f32 yaw) { m_yaw = yaw; }
-
f32 getYaw() const { return m_yaw; }
void setPitch(f32 pitch) { m_pitch = pitch; }
-
f32 getPitch() const { return m_pitch; }
inline void setPosition(const v3f &position)
void setCollisionbox(const aabb3f &box) { m_collisionbox = box; }
+ bool getCanZoom() const { return m_can_zoom; }
+ void setCanZoom(bool can_zoom) { m_can_zoom = can_zoom; }
+
private:
void accelerateHorizontal(const v3f &target_speed, const f32 max_increase);
void accelerateVertical(const v3f &target_speed, const f32 max_increase);
bool camera_barely_in_ceiling = false;
aabb3f m_collisionbox = aabb3f(-BS * 0.30f, 0.0f, -BS * 0.30f, BS * 0.30f,
BS * 1.75f, BS * 0.30f);
+ bool m_can_zoom = true;
GenericCAO *m_cao = nullptr;
Client *m_client;
<< "," << nametag_color.getGreen() << "," << nametag_color.getBlue() << "\" ";
os << ", selectionbox=" << PP(selectionbox.MinEdge) << "," << PP(selectionbox.MaxEdge);
os << ", pointable=" << pointable;
+ os << ", can_zoom=" << can_zoom;
return os.str();
}
writeF1000(os, automatic_face_movement_max_rotation_per_sec);
os << serializeString(infotext);
os << serializeString(wield_item);
+ writeU8(os, can_zoom);
// Add stuff only at the bottom.
// Never remove anything, because we don't want new versions of this
automatic_face_movement_max_rotation_per_sec = readF1000(is);
infotext = deSerializeString(is);
wield_item = deSerializeString(is);
+ can_zoom = readU8(is);
}
v2s16 initial_sprite_basepos;
bool is_visible = true;
bool makes_footstep_sound = false;
- float automatic_rotate = 0.0f;
f32 stepheight = 0.0f;
+ bool can_zoom = true;
+ float automatic_rotate = 0.0f;
bool automatic_face_movement_dir = false;
f32 automatic_face_movement_dir_offset = 0.0f;
bool backface_culling = true;
getboolfield(L, -1, "is_visible", prop->is_visible);
getboolfield(L, -1, "makes_footstep_sound", prop->makes_footstep_sound);
- getfloatfield(L, -1, "automatic_rotate", prop->automatic_rotate);
if (getfloatfield(L, -1, "stepheight", prop->stepheight))
prop->stepheight *= BS;
+ getboolfield(L, -1, "can_zoom", prop->can_zoom);
+
+ getfloatfield(L, -1, "automatic_rotate", prop->automatic_rotate);
lua_getfield(L, -1, "automatic_face_movement_dir");
if (lua_isnumber(L, -1)) {
prop->automatic_face_movement_dir = true;
lua_setfield(L, -2, "is_visible");
lua_pushboolean(L, prop->makes_footstep_sound);
lua_setfield(L, -2, "makes_footstep_sound");
- lua_pushnumber(L, prop->automatic_rotate);
- lua_setfield(L, -2, "automatic_rotate");
lua_pushnumber(L, prop->stepheight / BS);
lua_setfield(L, -2, "stepheight");
+ lua_pushboolean(L, prop->can_zoom);
+ lua_setfield(L, -2, "can_zoom");
+
+ lua_pushnumber(L, prop->automatic_rotate);
+ lua_setfield(L, -2, "automatic_rotate");
if (prop->automatic_face_movement_dir)
lua_pushnumber(L, prop->automatic_face_movement_dir_offset);
else