本文整理汇总了C#中OpenSim.Region.Framework.Scenes.SceneObjectGroup.ResumeScripts方法的典型用法代码示例。如果您正苦于以下问题:C# SceneObjectGroup.ResumeScripts方法的具体用法?C# SceneObjectGroup.ResumeScripts怎么用?C# SceneObjectGroup.ResumeScripts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Region.Framework.Scenes.SceneObjectGroup
的用法示例。
在下文中一共展示了SceneObjectGroup.ResumeScripts方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleIncomingSceneObject
public virtual bool HandleIncomingSceneObject(SceneObjectGroup so, Vector3 newPosition)
{
// If the user is banned, we won't let any of their objects
// enter. Period.
//
if (Scene.RegionInfo.EstateSettings.IsBanned(so.OwnerID))
{
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Denied prim crossing of {0} {1} into {2} for banned avatar {3}",
so.Name, so.UUID, Scene.Name, so.OwnerID);
return false;
}
if (newPosition != Vector3.Zero)
so.RootPart.GroupPosition = newPosition;
if (!Scene.AddSceneObject(so))
{
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Problem adding scene object {0} {1} into {2} ",
so.Name, so.UUID, Scene.Name);
return false;
}
if (!so.IsAttachment)
{
// FIXME: It would be better to never add the scene object at all rather than add it and then delete
// it
if (!Scene.Permissions.CanObjectEntry(so.UUID, true, so.AbsolutePosition))
{
// Deny non attachments based on parcel settings
//
m_log.Info("[ENTITY TRANSFER MODULE]: Denied prim crossing because of parcel settings");
Scene.DeleteSceneObject(so, false);
return false;
}
// For attachments, we need to wait until the agent is root
// before we restart the scripts, or else some functions won't work.
so.RootPart.ParentGroup.CreateScriptInstances(
0, false, Scene.DefaultScriptEngine, GetStateSource(so));
so.ResumeScripts();
if (so.RootPart.KeyframeMotion != null)
so.RootPart.KeyframeMotion.UpdateSceneObject(so);
}
return true;
}
示例2: AttachObjectInternal
//.........这里部分代码省略.........
m_log.WarnFormat(
"[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since {4} avatars are still sitting on it",
group.Name, group.LocalId, sp.Name, attachmentPt, group.GetSittingAvatarsCount());
return false;
}
Vector3 attachPos = group.AbsolutePosition;
// If the attachment point isn't the same as the one previously used
// set it's offset position = 0 so that it appears on the attachment point
// and not in a weird location somewhere unknown.
if (attachmentPt != (uint)AttachmentPoint.Default && attachmentPt != group.AttachmentPoint)
{
attachPos = Vector3.Zero;
}
// if the attachment point is the same as previous, make sure we get the saved
// position info.
if (attachmentPt != 0 && attachmentPt == group.RootPart.Shape.LastAttachPoint)
{
attachPos = group.RootPart.AttachedPos;
}
// AttachmentPt 0 means the client chose to 'wear' the attachment.
if (attachmentPt == (uint)AttachmentPoint.Default)
{
// Check object for stored attachment point
attachmentPt = group.AttachmentPoint;
}
// if we didn't find an attach point, look for where it was last attached
if (attachmentPt == 0)
{
attachmentPt = (uint)group.RootPart.Shape.LastAttachPoint;
attachPos = group.RootPart.AttachedPos;
group.HasGroupChanged = true;
}
// if we still didn't find a suitable attachment point.......
if (attachmentPt == 0)
{
// Stick it on left hand with Zero Offset from the attachment point.
attachmentPt = (uint)AttachmentPoint.LeftHand;
attachPos = Vector3.Zero;
}
group.AttachmentPoint = attachmentPt;
group.AbsolutePosition = attachPos;
List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt);
if (attachments.Contains(group))
{
if (DebugLevel > 0)
m_log.WarnFormat(
"[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached",
group.Name, group.LocalId, sp.Name, attachmentPt);
return false;
}
// If we already have 5, remove the oldest until only 4 are left. Skip over temp ones
while (attachments.Count >= 5)
{
if (attachments[0].FromItemID != UUID.Zero)
DetachSingleAttachmentToInv(sp, attachments[0]);
attachments.RemoveAt(0);
}
// If we're not appending, remove the rest as well
if (attachments.Count != 0 && !append)
{
foreach (SceneObjectGroup g in attachments)
{
if (g.FromItemID != UUID.Zero)
DetachSingleAttachmentToInv(sp, g);
}
}
lock (sp.AttachmentsSyncLock)
{
if (addToInventory && sp.PresenceType != PresenceType.Npc)
UpdateUserInventoryWithAttachment(sp, group, attachmentPt, append);
AttachToAgent(sp, group, attachmentPt, attachPos, silent);
if (resumeScripts)
{
// Fire after attach, so we don't get messy perms dialogs
// 4 == AttachedRez
group.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4);
group.ResumeScripts();
}
// Do this last so that event listeners have access to all the effects of the attachment
m_scene.EventManager.TriggerOnAttach(group.LocalId, group.FromItemID, sp.UUID);
}
return true;
}
示例3: FindAttachmentPoint
//.........这里部分代码省略.........
if (itemID != UUID.Zero)
DetachSingleAttachmentToInventory(itemID, remoteClient);
}
itemID = group.GetFromItemID();
group.RootPart.AttachedAvatar = presence.UUID;
//Anakin Lohner bug #3839
SceneObjectPart[] parts = group.Parts;
for (int i = 0; i < parts.Length; i++)
parts[i].AttachedAvatar = presence.UUID;
if (group.RootPart.PhysActor != null)
{
m_scene.SceneGraph.PhysicsScene.RemovePrim(group.RootPart.PhysActor);
group.RootPart.PhysActor = null;
}
group.AbsolutePosition = attachPos;
group.RootPart.AttachedPos = attachPos;
group.RootPart.IsAttachment = true;
group.RootPart.SetParentLocalId(presence.LocalId);
group.SetAttachmentPoint(Convert.ToByte(AttachmentPt));
AvatarAttachments attPlugin = presence.RequestModuleInterface<AvatarAttachments>();
if (attPlugin != null)
attPlugin.AddAttachment(group);
// Killing it here will cause the client to deselect it
// It then reappears on the avatar, deselected
// through the full update below
//
if (group.IsSelected)
{
foreach (SceneObjectPart part in group.ChildrenList)
{
part.CreateSelected = true;
}
}
//Kill the previous entity so that it will be selected
SendKillEntity(group.RootPart);
//NOTE: This MUST be here, otherwise we limit full updates during attachments when they are selected and it will block the first update.
// So until that is changed, this MUST stay. The client will instantly reselect it, so this value doesn't stay borked for long.
group.IsSelected = false;
if (itemID == UUID.Zero)
{
//Delete the object inworld to inventory
List<SceneObjectGroup> groups = new List<SceneObjectGroup>(1) { group };
IInventoryAccessModule inventoryAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
if (inventoryAccess != null)
inventoryAccess.DeleteToInventory(DeRezAction.AcquireToUserInventory, UUID.Zero,
groups, remoteClient.AgentId, out itemID);
}
else
{
//it came from an item, we need to start the scripts
// Fire after attach, so we don't get messy perms dialogs
// 4 == AttachedRez
group.CreateScriptInstances(0, true, 4, UUID.Zero);
group.ResumeScripts();
}
if (UUID.Zero == itemID)
{
m_log.Error("[ATTACHMENTS MODULE]: Unable to save attachment. Error inventory item ID.");
remoteClient.SendAgentAlertMessage(
"Unable to save attachment. Error inventory item ID.", false);
return;
}
// XXYY!!
if (item == null)
{
item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = m_scene.InventoryService.GetItem(item);
}
//Update the ItemID with the new item
group.SetFromItemID(item.ID);
//If we updated the attachment, we need to save the change
if (presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID))
AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
//Now recreate it so that it is selected
group.ScheduleGroupUpdate(PrimUpdateFlags.FullUpdate);
// In case it is later dropped again, don't let
// it get cleaned up
group.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
group.HasGroupChanged = false;
m_scene.EventManager.TriggerOnAttach(localID, group.GetFromItemID(), remoteClient.AgentId);
}