private void CreateTree(UUID uuid, Copse copse, Vector3 position, bool randomScale) { position.Z = (float)m_scene.Heightmap[(int)position.X, (int)position.Y]; if (position.Z < copse.m_treeline_low || position.Z > copse.m_treeline_high) { return; } Vector3 scale = copse.m_initial_scale; if (randomScale) { try { float t; float r = (float)Util.RandomClass.NextDouble(); r *= (float)Util.RandomClass.NextDouble(); r *= (float)Util.RandomClass.NextDouble(); t = copse.m_maximum_scale.X / copse.m_initial_scale.X; if (t < 1.0) { t = 1 / t; } t = t * r + 1.0f; scale.X *= t; t = copse.m_maximum_scale.Y / copse.m_initial_scale.Y; if (t < 1.0) { t = 1 / t; } t = t * r + 1.0f; scale.Y *= t; t = copse.m_maximum_scale.Z / copse.m_initial_scale.Z; if (t < 1.0) { t = 1 / t; } t = t * r + 1.0f; scale.Z *= t; } catch { scale = copse.m_initial_scale; } } SceneObjectGroup tree = AddTree(uuid, UUID.Zero, scale, Quaternion.Identity, position, copse.m_tree_type, false); tree.Name = copse.ToString(); copse.m_trees.Add(tree.UUID); tree.RootPart.ScheduleFullUpdate(); }
private void CreateTree(UUID uuid, Copse copse, Vector3 position) { position.Z = (float)m_scene.Heightmap[(int)position.X, (int)position.Y]; if (position.Z >= copse.m_treeline_low && position.Z <= copse.m_treeline_high) { SceneObjectGroup tree = AddTree(uuid, UUID.Zero, copse.m_initial_scale, Quaternion.Identity, position, copse.m_tree_type, false); tree.Name = copse.ToString(); copse.m_trees.Add(tree.UUID); tree.SendGroupFullUpdate(); } }
private void CreateTree(UUID uuid, Copse copse, Vector3 position) { position.Z = m_scene.RequestModuleInterface <ITerrainChannel>()[(int)position.X, (int)position.Y]; if (position.Z >= copse.m_treeline_low && position.Z <= copse.m_treeline_high) { SceneObjectGroup tree = (SceneObjectGroup)AddTree(uuid, UUID.Zero, copse.m_initial_scale, Quaternion.Identity, position, copse.m_tree_type, false); tree.Name = copse.ToString(); copse.m_trees.Add(tree.UUID); tree.ScheduleGroupUpdate(PrimUpdateFlags.FindBest); } }
private void HandleTreeLoad(Object[] args) { Copse copse; m_log.InfoFormat("[TREES]: Loading copse definition...."); copse = new Copse(((string)args[0]), false); foreach (Copse cp in m_copse) { if (cp.m_name == copse.m_name) { m_log.InfoFormat("[TREES]: Copse: {0} is already defined - command failed", copse.m_name); return; } } m_copse.Add(copse); m_log.InfoFormat("[TREES]: Loaded copse: {0}", copse.ToString()); }
private void HandleTreeLoad(string module, string[] cmd) { if (MainConsole.Instance.ConsoleScene != m_scene) { return; } Copse copse; m_log.InfoFormat("[TREES]: Loading copse definition...."); copse = new Copse(cmd[2], false); foreach (Copse cp in m_copse) { if (cp.m_name == copse.m_name) { m_log.InfoFormat("[TREES]: Copse: {0} is already defined - command failed", copse.m_name); return; } } m_copse.Add(copse); m_log.InfoFormat("[TREES]: Loaded copse: {0}", copse.ToString()); }
private void CreateTree(UUID uuid, Copse copse, Vector3 position) { position.Z = (float)m_scene.Heightmap[(int)position.X, (int)position.Y]; if (position.Z >= copse.m_treeline_low && position.Z <= copse.m_treeline_high) { SceneObjectGroup tree = AddTree(uuid, UUID.Zero, copse.m_initial_scale, Quaternion.Identity, position, copse.m_tree_type, false); tree.Name = copse.ToString(); copse.m_trees.Add(tree.UUID); tree.SendGroupFullUpdate(PrimUpdateFlags.FindBest); } }
/// <summary> /// Creats (plants) a tree /// </summary> /// <param name="uuid">UUID.</param> /// <param name="copse">Copse.</param> /// <param name="position">Position.</param> void CreateTree( UUID uuid, Copse copse, Vector3 position ) { position.Z = m_scene.RequestModuleInterface<ITerrainChannel>()[(int)position.X, (int)position.Y]; if (position.Z >= copse.m_treeline_low && position.Z <= copse.m_treeline_high) { var tree = (SceneObjectGroup) AddTree(uuid, UUID.Zero, copse.m_initial_scale, Quaternion.Identity, position, copse.m_tree_type, false); tree.Name = copse.ToString(); copse.m_trees.Add(tree.UUID); tree.ScheduleGroupUpdate(PrimUpdateFlags.FindBest); } }
private void HandleTreeLoad(string module, string[] cmd) { if (MainConsole.Instance.ConsoleScene != m_scene) return; Copse copse; m_log.InfoFormat("[TREES]: Loading copse definition...."); copse = new Copse(cmd[2], false); foreach (Copse cp in m_copse) { if (cp.m_name == copse.m_name) { m_log.InfoFormat("[TREES]: Copse: {0} is already defined - command failed", copse.m_name); return; } } m_copse.Add(copse); m_log.InfoFormat("[TREES]: Loaded copse: {0}", copse.ToString()); }