Mantis#2656. Thank you kindly, Nlin for a patch that:
Attached patch implements llCollisionSound. Thanks T. Sado.0.6.1-post-fixes
parent
778d83d9f0
commit
44c56a974c
|
@ -981,6 +981,9 @@ namespace OpenSim.Data.MySQL
|
||||||
createCol(prims, "ClickAction", typeof (Byte));
|
createCol(prims, "ClickAction", typeof (Byte));
|
||||||
createCol(prims, "Material", typeof (Byte));
|
createCol(prims, "Material", typeof (Byte));
|
||||||
|
|
||||||
|
createCol(prims, "CollisionSound", typeof(String));
|
||||||
|
createCol(prims, "CollisionSoundVolume", typeof(Double));
|
||||||
|
|
||||||
// Add in contraints
|
// Add in contraints
|
||||||
prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]};
|
prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]};
|
||||||
|
|
||||||
|
@ -1271,6 +1274,9 @@ namespace OpenSim.Data.MySQL
|
||||||
if (!row.IsNull("ClickAction"))
|
if (!row.IsNull("ClickAction"))
|
||||||
prim.ClickAction = Convert.ToByte(row["ClickAction"]);
|
prim.ClickAction = Convert.ToByte(row["ClickAction"]);
|
||||||
|
|
||||||
|
prim.CollisionSound = new UUID(row["CollisionSound"].ToString());
|
||||||
|
prim.CollisionSoundVolume = Convert.ToSingle(row["CollisionSoundVolume"]);
|
||||||
|
|
||||||
return prim;
|
return prim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1589,6 +1595,9 @@ namespace OpenSim.Data.MySQL
|
||||||
row["ClickAction"] = clickAction;
|
row["ClickAction"] = clickAction;
|
||||||
|
|
||||||
row["Material"] = prim.Material;
|
row["Material"] = prim.Material;
|
||||||
|
|
||||||
|
row["CollisionSound"] = prim.CollisionSound.ToString();
|
||||||
|
row["CollisionSoundVolume"] = prim.CollisionSoundVolume;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
BEGIN;
|
||||||
|
|
||||||
|
ALTER TABLE prims ADD COLUMN CollisionSound char(36) not null default '00000000-0000-0000-0000-000000000000';
|
||||||
|
ALTER TABLE prims ADD COLUMN CollisionSoundVolume float not null default 0.0;
|
||||||
|
|
||||||
|
COMMIT;
|
|
@ -0,0 +1,6 @@
|
||||||
|
BEGIN;
|
||||||
|
|
||||||
|
ALTER TABLE prims ADD COLUMN CollisionSound varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000';
|
||||||
|
ALTER TABLE prims ADD COLUMN CollisionSoundVolume float NOT NULL default 0;
|
||||||
|
|
||||||
|
COMMIT;
|
|
@ -877,6 +877,9 @@ namespace OpenSim.Data.SQLite
|
||||||
|
|
||||||
createCol(prims, "Material", typeof(Byte));
|
createCol(prims, "Material", typeof(Byte));
|
||||||
|
|
||||||
|
createCol(prims, "CollisionSound", typeof(String));
|
||||||
|
createCol(prims, "CollisionSoundVolume", typeof(Double));
|
||||||
|
|
||||||
// Add in contraints
|
// Add in contraints
|
||||||
prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]};
|
prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]};
|
||||||
|
|
||||||
|
@ -1237,6 +1240,10 @@ namespace OpenSim.Data.SQLite
|
||||||
prim.ObjectSaleType = Convert.ToByte(row["SaleType"]);
|
prim.ObjectSaleType = Convert.ToByte(row["SaleType"]);
|
||||||
|
|
||||||
prim.Material = Convert.ToByte(row["Material"]);
|
prim.Material = Convert.ToByte(row["Material"]);
|
||||||
|
|
||||||
|
prim.CollisionSound = new UUID(row["CollisionSound"].ToString());
|
||||||
|
prim.CollisionSoundVolume = Convert.ToSingle(row["CollisionSoundVolume"]);
|
||||||
|
|
||||||
return prim;
|
return prim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1564,6 +1571,9 @@ namespace OpenSim.Data.SQLite
|
||||||
|
|
||||||
row["SalePrice"] = prim.SalePrice;
|
row["SalePrice"] = prim.SalePrice;
|
||||||
row["Material"] = prim.Material;
|
row["Material"] = prim.Material;
|
||||||
|
|
||||||
|
row["CollisionSound"] = prim.CollisionSound.ToString();
|
||||||
|
row["CollisionSoundVolume"] = prim.CollisionSoundVolume;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -201,6 +201,10 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
private Vector3 m_cameraAtOffset = new Vector3(0.0f, 0.0f, 0.0f);
|
private Vector3 m_cameraAtOffset = new Vector3(0.0f, 0.0f, 0.0f);
|
||||||
private bool m_forceMouselook = false;
|
private bool m_forceMouselook = false;
|
||||||
|
|
||||||
|
// TODO: Collision sound should have default.
|
||||||
|
private UUID m_collisionSound = UUID.Zero;
|
||||||
|
private float m_collisionSoundVolume = 0.0f;
|
||||||
|
|
||||||
#endregion Fields
|
#endregion Fields
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
@ -952,6 +956,22 @@ if (m_shape != null) {
|
||||||
set { m_sitAnimation = value; }
|
set { m_sitAnimation = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UUID CollisionSound
|
||||||
|
{
|
||||||
|
get { return m_collisionSound; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
m_collisionSound = value;
|
||||||
|
aggregateScriptEvents();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public float CollisionSoundVolume
|
||||||
|
{
|
||||||
|
get { return m_collisionSoundVolume; }
|
||||||
|
set { m_collisionSoundVolume = value; }
|
||||||
|
}
|
||||||
|
|
||||||
#endregion Public Properties with only Get
|
#endregion Public Properties with only Get
|
||||||
|
|
||||||
|
|
||||||
|
@ -1607,6 +1627,12 @@ if (m_shape != null) {
|
||||||
if (m_parentGroup.IsDeleted)
|
if (m_parentGroup.IsDeleted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// play the sound.
|
||||||
|
if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f)
|
||||||
|
{
|
||||||
|
SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0);
|
||||||
|
}
|
||||||
|
|
||||||
if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0)
|
if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0)
|
||||||
{
|
{
|
||||||
// do event notification
|
// do event notification
|
||||||
|
@ -3233,7 +3259,8 @@ if (m_shape != null) {
|
||||||
if (
|
if (
|
||||||
((AggregateScriptEvents & scriptEvents.collision) != 0) ||
|
((AggregateScriptEvents & scriptEvents.collision) != 0) ||
|
||||||
((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
|
((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
|
||||||
((AggregateScriptEvents & scriptEvents.collision_start) != 0)
|
((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
|
||||||
|
(CollisionSound != null && CollisionSound != UUID.Zero)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// subscribe to physics updates.
|
// subscribe to physics updates.
|
||||||
|
@ -3252,6 +3279,13 @@ if (m_shape != null) {
|
||||||
PhysActor.OnCollisionUpdate -= PhysicsCollision;
|
PhysActor.OnCollisionUpdate -= PhysicsCollision;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_parentGroup == null)
|
||||||
|
{
|
||||||
|
ScheduleFullUpdate();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0)
|
if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0)
|
||||||
{
|
{
|
||||||
m_parentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting;
|
m_parentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting;
|
||||||
|
@ -3363,3 +3397,4 @@ if (m_shape != null) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3490,7 +3490,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public void llCollisionSound(string impact_sound, double impact_volume)
|
public void llCollisionSound(string impact_sound, double impact_volume)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
NotImplemented("llCollisionSound");
|
//NotImplemented("llCollisionSound");
|
||||||
|
|
||||||
|
// TODO: Parameter check logic required.
|
||||||
|
UUID soundId = UUID.Zero;
|
||||||
|
if (!UUID.TryParse(impact_sound, out soundId))
|
||||||
|
{
|
||||||
|
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
|
||||||
|
{
|
||||||
|
if (item.Type == (int)AssetType.Sound && item.Name == impact_sound)
|
||||||
|
{
|
||||||
|
soundId = item.AssetID;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_host.CollisionSound = soundId;
|
||||||
|
m_host.CollisionSoundVolume = (float)impact_volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llCollisionSprite(string impact_sprite)
|
public void llCollisionSprite(string impact_sprite)
|
||||||
|
|
Loading…
Reference in New Issue