mantis: 8008 unscripted child prim collisions didn't trigger scripted root prim collision events; collision sounds had incorrect aggregateevents call and default sounds where muted. Future optimization needed and Testing

LSLKeyTest
UbitUmarov 2016-08-28 08:45:09 +01:00
parent 03dba18bb6
commit ddc2f2ccd3
6 changed files with 32 additions and 7 deletions

View File

@ -129,8 +129,6 @@ namespace OpenSim.Region.Framework.Scenes
return;
float volume = part.CollisionSoundVolume;
if (volume == 0.0f)
return;
UUID soundID = part.CollisionSound;
@ -150,6 +148,9 @@ namespace OpenSim.Region.Framework.Scenes
break;
}
if (volume == 0.0f)
return;
bool doneownsound = false;
int thisMaterial = (int)part.Material;

View File

@ -2112,6 +2112,12 @@ namespace OpenSim.Region.Framework.Scenes
d.AddActiveScripts(count);
}
private const scriptEvents PhysicsNeeedSubsEvents = (
scriptEvents.collision | scriptEvents.collision_start | scriptEvents.collision_end |
scriptEvents.land_collision | scriptEvents.land_collision_start | scriptEvents.land_collision_end);
private scriptEvents lastRootPartPhysEvents = 0;
public void aggregateScriptEvents()
{
PrimFlags objectflagupdate = (PrimFlags)RootPart.GetEffectiveObjectFlags();
@ -2148,6 +2154,20 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.RemoveGroupTarget(this);
}
scriptEvents rootPartPhysEvents = RootPart.AggregateScriptEvents;
rootPartPhysEvents &= PhysicsNeeedSubsEvents;
if (rootPartPhysEvents != lastRootPartPhysEvents)
{
lastRootPartPhysEvents = rootPartPhysEvents;
for (int i = 0; i < parts.Length; i++)
{
SceneObjectPart part = parts[i];
if (part == null)
continue;
part.UpdatePhysicsSubscribedEvents();
}
}
ScheduleGroupForFullUpdate();
}

View File

@ -1534,7 +1534,6 @@ namespace OpenSim.Region.Framework.Scenes
else
m_collisionSoundType = 1;
aggregateScriptEvents();
}
}
@ -5033,7 +5032,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
}
private void UpdatePhysicsSubscribedEvents()
internal void UpdatePhysicsSubscribedEvents()
{
PhysicsActor pa = PhysActor;
if (pa == null)
@ -5107,8 +5106,6 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
objectflagupdate |= (uint) PrimFlags.AllowInventoryDrop;
}
UpdatePhysicsSubscribedEvents();
LocalFlags = (PrimFlags)objectflagupdate;
if (ParentGroup != null && ParentGroup.RootPart == this)
@ -5119,6 +5116,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
{
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents()", Name, LocalId);
UpdatePhysicsSubscribedEvents();
ScheduleFullUpdate();
}
}

View File

@ -1246,7 +1246,7 @@ namespace OpenSim.Region.Framework.Scenes
physActor_OnPhysicsRequestingCameraData;
partPhysActor.OnPhysicsRequestingCameraData +=
physActor_OnPhysicsRequestingCameraData;
}
}
}
ParentUUID = UUID.Zero;
}

View File

@ -5109,6 +5109,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.CollisionSoundVolume = (float)impact_volume;
m_host.CollisionSound = m_host.invalidCollisionSoundUUID;
m_host.CollisionSoundType = -1; // disable all sounds
m_host.aggregateScriptEvents();
return;
}
@ -5122,6 +5123,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
else
m_host.CollisionSoundType = -1;
m_host.aggregateScriptEvents();
}
public LSL_String llGetAnimation(string id)

View File

@ -4266,6 +4266,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.CollisionSoundType = 0; // full return to default sounds
else
m_host.CollisionSoundType = 2; // default sounds with volume
m_host.aggregateScriptEvents();
return;
}
// TODO: Parameter check logic required.
@ -4278,6 +4279,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
else
m_host.CollisionSoundType = -1;
m_host.aggregateScriptEvents();
}
// still not very usefull, detector is lost on rez, restarts, etc