Ejemplo n.º 1
0
        private void Subscribe(ScriptEventData data)
        {
            unsubscribes = SubscribeToAll(ShowPromptEvent, (ScriptEventData subdata) =>
            {
                try
                {
                    ISimpleData simpledata = subdata.Data?.AsInterface <ISimpleData>();
                    if (simpledata != null)
                    {
                        AgentPrivate agent = ScenePrivate.FindAgent(simpledata.AgentInfo.SessionId);

                        if (agent != null && agent.IsValid)
                        {
                            agent.Client.UI.ModalDialog.Show(MessagePrompt, LeftButtonText, RightButtonText, (opc) =>
                            {
                                OnDialogResponse(agent.Client.UI.ModalDialog.Response, agent.AgentInfo.SessionId);
                            });
                        }
                    }
                }
                catch (Exception)
                {
                    // Agent left.
                }
            });
        }
Ejemplo n.º 2
0
    private void InitializeDirector(ScriptEventData sed)
    {
        Log.Write("In InitializeDirector");
        ISimpleData  DirectorData  = sed.Data?.AsInterface <ISimpleData>();
        AgentPrivate DirectorAgent = ScenePrivate.FindAgent(DirectorData.AgentInfo.SessionId);

        Director = DirectorAgent.AgentInfo.Name;
    }
Ejemplo n.º 3
0
        private void Subscribe(ScriptEventData sed)
        {
            if (subscription == null)
            {
                subscription = SubscribeToAll(StartEvent, (ScriptEventData subdata) =>
                {
                    ISimpleData simpledata = subdata.Data?.AsInterface <ISimpleData>();
                    if (simpledata != null && simpledata.AgentInfo != null)
                    {
                        AgentPrivate agent = ScenePrivate.FindAgent(simpledata.AgentInfo.SessionId);

                        if (agent != null && agent.IsValid)
                        {
                            broadcastAgents.Add(agent);
                            ScenePrivate.SetMegaphone(agent, true); // User gets notified of megaphone status
                        }
                    }
                });

                subscription += SubscribeToAll(StopEvent, (ScriptEventData subdata) =>
                {
                    ISimpleData simpledata = subdata.Data?.AsInterface <ISimpleData>();
                    if (simpledata != null && simpledata.AgentInfo != null)
                    {
                        AgentPrivate agent = ScenePrivate.FindAgent(simpledata.AgentInfo.SessionId);

                        if (agent != null && agent.IsValid)
                        {
                            broadcastAgents.Remove(agent);
                            ScenePrivate.SetMegaphone(agent, false); // User gets notified of megaphone status
                        }
                    }
                });

                subscription += SubscribeToAll(ToggleEvent, (ScriptEventData subdata) =>
                {
                    ISimpleData simpledata = subdata.Data?.AsInterface <ISimpleData>();
                    if (simpledata != null && simpledata.AgentInfo != null)
                    {
                        AgentPrivate agent = ScenePrivate.FindAgent(simpledata.AgentInfo.SessionId);

                        if (agent != null && agent.IsValid)
                        {
                            if (broadcastAgents.Contains(agent))
                            {
                                broadcastAgents.Remove(agent);
                                ScenePrivate.SetMegaphone(agent, false); // User gets notified of megaphone status
                            }
                            else
                            {
                                broadcastAgents.Add(agent);
                                ScenePrivate.SetMegaphone(agent, true); // User gets notified of megaphone status
                            }
                        }
                    }
                });
            }
        }
Ejemplo n.º 4
0
        private void Start(ScriptEventData sed)
        {
            ISimpleData idata = sed.Data.AsInterface <ISimpleData>();

            if (idata != null && idata.AgentInfo != null)
            {
                AgentPrivate  agent       = ScenePrivate.FindAgent(idata.AgentInfo.SessionId);
                ObjectPrivate agentObject = ScenePrivate.FindObject(idata.AgentInfo.ObjectId);

                if (agent == null || agentObject == null || !agent.IsValid)
                {
                    return;
                }

                try
                {
                    Guid agentId = agent.AgentInfo.AvatarUuid;

                    UIProgressBar thisBar;
                    if (_agentProgressBars.TryGetValue(agentId, out thisBar) && thisBar != null && thisBar.IsValid)
                    {
                        // if this script is already showing the progress bar to this agent, ignore the start event.
                        return;
                    }

                    // cancel any progress bar that has been started by another script
                    foreach (UIProgressBar otherBar in agent.Client.UI.GetProgressBars())
                    {
                        if (otherBar.IsValid)
                        {
                            otherBar.Cancel();
                        }
                    }

                    UIProgressBar bar = agent.Client.UI.AddProgressBar();
                    bar.Start(LabelString, Duration, Color, (OperationCompleteEvent completeEvent) => {
                        OnBarComplete(agent.AgentInfo, completeEvent);
                    });

                    _agentProgressBars[agentId] = bar;

                    if (CancelOnMove)
                    {
                        CancelOnMoveCoroutine(agentId, agentObject, bar);
                    }
                    else
                    {
                        RemoveFromDictionaryCoroutine(agentId, bar);
                    }
                }
                catch { }
            }
            else
            {
                Log.Write(LogLevel.Error, "Could not obtain agent data from progress bar start event.");
            }
        }
    private void RemoteTeleport(ScriptEventData data)
    {
        ISimpleData  idata = data.Data.AsInterface <ISimpleData>();
        AgentPrivate agent = ScenePrivate.FindAgent(idata.AgentInfo.SessionId);

        if (agent != null)
        {
            agent.Client.TeleportToLocation(DestOwner, DestScene);
        }
    }
Ejemplo n.º 6
0
    private void InitializeCameraMan(ScriptEventData sed)
    {
        //Log.Write("In InitializeCameraMan");
        ISimpleData  CameraData  = sed.Data?.AsInterface <ISimpleData>();
        AgentPrivate CameraAgent = ScenePrivate.FindAgent(CameraData.AgentInfo.SessionId);

        CameraMan    = CameraAgent.AgentInfo.Name;
        NewCameraMan = true;
        LocalTeleport(0, sed);
    }
Ejemplo n.º 7
0
        private void Subscribe(ScriptEventData sed)
        {
            if (subscription == null)
            {
                subscription = SubscribeToAll(StartDoingThisEvent, (ScriptEventData subdata) =>
                {
                    ISimpleData simpledata = subdata.Data?.AsInterface <ISimpleData>();
                    if (simpledata != null && simpledata.AgentInfo != null)
                    {
                        AgentPrivate agent = ScenePrivate.FindAgent(simpledata.AgentInfo.SessionId);

                        if (agent != null && agent.IsValid)
                        {
                            // Start Do something with he Agent that was in the Simpledata
                            // recieved in the Event Subscribed to.
                        }
                    }
                });

                subscription += SubscribeToAll(StopDoingThisEvent, (ScriptEventData subdata) =>
                {
                    ISimpleData simpledata = subdata.Data?.AsInterface <ISimpleData>();
                    if (simpledata != null && simpledata.AgentInfo != null)
                    {
                        AgentPrivate agent = ScenePrivate.FindAgent(simpledata.AgentInfo.SessionId);

                        if (agent != null && agent.IsValid)
                        {
                            // Stop Do something with he Agent that was in the Simpledata
                            // recieved in the Event Subscribed to.
                        }
                    }
                });

                /* Template for additonal events to be responded to ...
                 *
                 * subscription += SubscribeToAll(StartSomethingElseEvent, (ScriptEventData subdata) =>
                 * {
                 *  ISimpleData simpledata = subdata.Data?.AsInterface<ISimpleData>();
                 *  if (simpledata != null && simpledata.AgentInfo != null)
                 *  {
                 *      AgentPrivate agent = ScenePrivate.FindAgent(simpledata.AgentInfo.SessionId);
                 *
                 *      if (agent != null && agent.IsValid)
                 *      {
                 *          // Stop Do somethingElse with he Agent that was in the Simpledata
                 *          // recieved in the Event Subscribed to.
                 *
                 *      }
                 *  }
                 * });
                 * .......................................................................*/
            }
        }
Ejemplo n.º 8
0
 string FixupChatMessage(string inputText, ISimpleData simpleData)
 {
     if ((simpleData != null) && (simpleData.AgentInfo != null))
     {
         return(inputText.Replace("{NAME}", simpleData.AgentInfo.Name));
     }
     else
     {
         return(inputText);
     }
 }
Ejemplo n.º 9
0
        private void Hide(ScriptEventData sed)
        {
            ISimpleData idata = sed.Data.AsInterface <ISimpleData>();

            if (idata != null && idata.AgentInfo != null)
            {
                SessionId sessionId = idata.AgentInfo.SessionId;
                CancelHideTimer(sessionId);
                HideForSessionId(sessionId);
            }
        }
Ejemplo n.º 10
0
        void SubscribeToMessages()
        {
            // Already subscribed
            if (unsubscribes != null)
            {
                return;
            }

            foreach (var kvp in mediaUrls)
            {
                unsubscribes += SubscribeToAll(kvp.Key, (ScriptEventData subData) =>
                {
                    if (PrivateMedia)
                    {
                        ISimpleData simpleData = subData.Data?.AsInterface <ISimpleData>();

                        if (simpleData != null && simpleData.AgentInfo != null)
                        {
                            AgentPrivate agent = ScenePrivate.FindAgent(simpleData.AgentInfo.SessionId);

                            if (agent != null && agent.IsValid)
                            {
                                try
                                {
                                    agent.OverrideMediaSource(kvp.Value, MediaWidth, MediaHeight);
                                }
                                catch (ThrottleException)
                                {
                                    // Throttled
                                    Log.Write(LogLevel.Warning, "OverrideMediaSource request throttle hit. Media not set.");
                                }
                                catch (NullReferenceException)
                                {
                                    // User Left, ignore.
                                }
                            }
                        }
                    }
                    else
                    {
                        try
                        {
                            ScenePrivate.OverrideMediaSource(kvp.Value, MediaWidth, MediaHeight);
                        }
                        catch (ThrottleException)
                        {
                            // Throttled
                            Log.Write(LogLevel.Warning, "OverrideMediaSource request throttle hit. Media not set.");
                        }
                    }
                });
            }
        }
Ejemplo n.º 11
0
        private void RemoteTeleport(ScriptEventData data)
        {
            ISimpleData idata = data.Data.AsInterface <ISimpleData>();

            if (idata != null && idata.AgentInfo != null)
            {
                RemoteTeleport(idata.AgentInfo.SessionId);
            }
            else
            {
                SimpleLog(LogLevel.Info, "No agent attached to RemoteTeleport request.");
            }
        }
Ejemplo n.º 12
0
    private void LookUpLetter(ScriptEventData inMessage)
    {
        if (inMessage.Data == null)
        {
            return;
        }
        ISimpleData simpleData = inMessage.Data?.AsInterface <ISimpleData>();

        string strActiveLetter = inMessage.Message;

        //Log.Write("inMessage: " + strActiveMessage);
        strActiveLetter = strActiveLetter.Substring(6, 1);
        Log.Write("Letterin: " + strActiveLetter);
        RevealLetter(strActiveLetter);
    }
Ejemplo n.º 13
0
        private string GenerateHintText(string hint, AgentInfo info, ISimpleData data)
        {
            if (hint.Contains("{"))
            {
                hint = hint.Replace("{Player.Name}", info.Name).Replace("{Object.Name}", ObjectPrivate.Name);

                ObjectPrivate source = ScenePrivate.FindObject(data.SourceObjectId);
                if (source != null)
                {
                    hint = hint.Replace("{Data.Source}", source.Name);
                }
            }

            return(hint);
        }
Ejemplo n.º 14
0
 private void DecodeUserInteraction(ScriptEventData data)
 {
     if (!SequenceLoaded)  //first interaction load Sequence to Check
     {
         ISimpleData sd = data.Data.AsInterface <ISimpleData>();
         AgentName   = sd.AgentInfo;
         ComponentID = sd.ObjectId;
         LoadSequenceToCheck();
         SequenceLoaded = true;
     }
     if (data.Message == ResetCodeEvent)
     {
         ElementPositionInSequence = 0;
     }
     CheckSequence(data.Message);
 }
Ejemplo n.º 15
0
 public override void Init()
 {
     // Listen for the 'on' message
     SubscribeToScriptEvent("on", (ScriptEventData data) =>
     {
         ISimpleData idata = data.Data.AsInterface <ISimpleData>();
         if (idata == null)
         {
             ScenePrivate.Chat.MessageAllUsers("The 'on' message does not have a simple script payload!");
         }
         else
         {
             ObjectPrivate obj = ScenePrivate.FindObject(idata.ObjectId);
             ScenePrivate.Chat.MessageAllUsers("The 'on' message simple script payload came from " + obj.Name);
         }
     });
 }
Ejemplo n.º 16
0
        Quest GetQuestFromScriptEventData(ScriptEventData sed)
        {
            ISimpleData idata = sed.Data.AsInterface <ISimpleData>();

            if (idata != null && idata.AgentInfo != null)
            {
                SessionId sessionId = idata.AgentInfo.SessionId;

                var questData = WaitFor(QuestDefinition.GetQuest, sessionId) as QuestDefinition.GetQuestData;

                if (questData.Success)
                {
                    return(questData.Quest);
                }
            }
            return(null);
        }
Ejemplo n.º 17
0
        private void Show(ScriptEventData sed)
        {
            ISimpleData idata = sed.Data.AsInterface <ISimpleData>();

            if (idata != null && idata.AgentInfo != null)
            {
                AgentPrivate agent = ScenePrivate.FindAgent(idata.AgentInfo.SessionId);

                ObjectPrivate agentObject = ScenePrivate.FindObject(idata.AgentInfo.ObjectId);

                if (agent == null || agentObject == null || !agent.IsValid)
                {
                    return;
                }

                try
                {
                    SessionId sessionId = agent.AgentInfo.SessionId;
                    CancelHideTimer(sessionId);
                    agent.Client.UI.HintText = m_textString;

                    if (ShowDuration > 0.01f)
                    {
                        agentTimers.Add(sessionId, Timer.Create(ShowDuration, () => { HideForSessionId(sessionId); }));
                    }

                    if (CancelOnMove)
                    {
                        StartCoroutine(() => CancelOnMoveCoroutine(agentObject, agent, sessionId));
                    }
                }
                catch (ArgumentException)
                {
                    Log.Write(LogLevel.Error, "Error setting text, bad string?");
                }
                catch
                {
                    Log.Write(LogLevel.Warning, "Error setting text, agent might have left");
                }
            }
            else
            {
                Log.Write(LogLevel.Error, "Could not obtain agent data from text box show event.");
            }
        }
Ejemplo n.º 18
0
    private void ListenForMessage(ScriptEventData inMessage)
    {
        Log.Write("Listen for Message: " + inMessage.Message);
        if (inMessage.Data == null)
        {
            return;
        }
        ISimpleData simpleData = inMessage.Data?.AsInterface <ISimpleData>();

        string strActiveMessage = inMessage.Message;

        Log.Write("inMessage: " + strActiveMessage);
        strActiveMessage = strActiveMessage.Substring(MessageEvent.Length, 1);
        //Log.Write("inMessage2: " + strActiveMessage);
        int ActiveGame = Int32.Parse(strActiveMessage);

        LoadMessage(ActiveGame);
    }
Ejemplo n.º 19
0
        Objective GetObjectiveFromScriptEventData(ScriptEventData sed)
        {
            ISimpleData idata = sed.Data.AsInterface <ISimpleData>();

            if (idata != null && idata.AgentInfo != null)
            {
                SessionId sessionId = idata.AgentInfo.SessionId;

                var objectiveData = WaitFor(ObjectiveDefinition.GetObjective, sessionId) as ObjectiveDefinition.GetObjectiveData;

                if (objectiveData.Success)
                {
                    return(objectiveData.Objective);
                }
            }
            Log.Write(LogLevel.Error, "Failed to get objective from event data");
            return(null);
        }
Ejemplo n.º 20
0
        protected override void SimpleInit()
        {
            if (!ObjectPrivate.TryGetFirstComponent <CameraComponent>(out CamComponent))
            {
                Log.Write("No camera component found!");
                return;
            }

            Log.Write("Found camera component");

            if (!string.IsNullOrWhiteSpace(activateCameraComponent))
            {
                SubscribeToAll(activateCameraComponent, (data) =>
                {
                    ISimpleData idata  = data.Data.AsInterface <ISimpleData>();
                    AgentPrivate agent = ScenePrivate.FindAgent(idata.ObjectId);

                    if (agent != null)
                    {
                        agent.Client.SetActiveCamera(CamComponent);
                        if (Duration > 0)
                        {
                            Wait(TimeSpan.FromSeconds(Duration));
                            agent.Client.ResetCamera();
                        }
                    }
                });
            }

            if (!string.IsNullOrWhiteSpace(resetCameraComponent))
            {
                SubscribeToAll(resetCameraComponent, (data) =>
                {
                    ISimpleData idata  = data.Data.AsInterface <ISimpleData>();
                    AgentPrivate agent = ScenePrivate.FindAgent(idata.ObjectId);

                    if (agent != null)
                    {
                        agent.Client.ResetCamera();
                    }
                });
            }
        }
Ejemplo n.º 21
0
        void SetVisible(ScriptEventData sed, bool visible)
        {
            if (AffectEveryone)
            {
                meshComponent.SetIsVisible(visible);
                return;
            }

            ISimpleData idata = sed.Data.AsInterface <ISimpleData>();

            if (idata != null && idata.AgentInfo != null)
            {
                meshComponent.SetIsVisible(idata.AgentInfo.SessionId, visible);
            }
            else
            {
                Log.Write(LogLevel.Error, "Visibility", "Event data did not contain agent info.");
            }
        }
Ejemplo n.º 22
0
        void SubscribeToMessages()
        {
            // Already subscribed
            if (unsubscribes != null)
            {
                return;
            }

            foreach (var kvp in messages)
            {
                unsubscribes += SubscribeToAll(kvp.Key, (ScriptEventData subData) =>
                {
                    ISimpleData simpleData = subData.Data?.AsInterface <ISimpleData>();

                    string chatText = FixupChatMessage(kvp.Value, simpleData);

                    if (DirectMessage)
                    {
                        try
                        {
                            if (simpleData != null)
                            {
                                var agent = ScenePublic.FindAgent(simpleData.AgentInfo.SessionId);

                                if (agent != null && agent.IsValid)
                                {
                                    agent.SendChat(chatText);
                                }
                            }
                        }
                        catch (Exception)
                        {
                            // Agent left.
                        }
                    }
                    else
                    {
                        ScenePublic.Chat.MessageAllUsers(chatText);
                    }
                });
            }
        }
Ejemplo n.º 23
0
        private void Subscribe(ScriptEventData sed)
        {
            if (unsubscribes == null)
            {
                unsubscribes = SubscribeToAll(ShowListingEvent, (ScriptEventData subdata) =>
                {
                    try
                    {
                        ISimpleData simpledata = subdata.Data?.AsInterface <ISimpleData>();
                        if (simpledata != null)
                        {
                            AgentPrivate agent = ScenePrivate.FindAgent(simpledata.AgentInfo.SessionId);
                            agent.Client.OpenStoreListing(ProductGuid);
                        }
                    }

                    catch (NullReferenceException nre) { SimpleLog(LogLevel.Info, "NullReferenceException showing store listing (maybe the user left): " + nre.Message); }
                    catch (Exception e) { SimpleLog(LogLevel.Error, "Exception showing store listing: " + e.Message); }
                });
            }
        }
Ejemplo n.º 24
0
        private void Cancel(ScriptEventData sed)
        {
            ISimpleData idata = sed.Data.AsInterface <ISimpleData>();

            if (idata != null && idata.AgentInfo != null)
            {
                AgentPrivate agent = ScenePrivate.FindAgent(idata.AgentInfo.SessionId);
                if (agent == null || !agent.IsValid)
                {
                    return;
                }

                try
                {
                    UIProgressBar progressBar;
                    if (_agentProgressBars.TryGetValue(agent.AgentInfo.AvatarUuid, out progressBar))
                    {
                        CancelBarForAgent(agent.AgentInfo.AvatarUuid, progressBar);
                    }
                }
                catch { }
            }
        }
Ejemplo n.º 25
0
 public static void Set(ISimpleData data)
 {
     Data = data;
 }
Ejemplo n.º 26
0
        void Setup(StreamChannel channel, string eventName, float loudness)
        {
            unsubscribes += SubscribeToAll(eventName, (ScriptEventData subData) =>
            {
                StopSound(true);

                if (PrivateMedia)
                {
                    ISimpleData simpleData = subData.Data?.AsInterface <ISimpleData>();

                    if (simpleData != null && simpleData.AgentInfo != null)
                    {
                        AgentPrivate agent = ScenePrivate.FindAgent(simpleData.AgentInfo.SessionId);

                        if (agent != null && agent.IsValid)
                        {
                            try
                            {
                                if (Spatialized)
                                {
                                    if (audio != null)
                                    {
                                        currentPlayHandle = agent.PlayStreamOnComponent(channel, audio, loudness);
                                    }
                                    else
                                    {
                                        currentPlayHandle = agent.PlayStreamAtPosition(channel, ObjectPrivate.Position, loudness);
                                    }
                                }
                                else
                                {
                                    currentPlayHandle = agent.PlayStream(channel, loudness);
                                }
                            }
                            catch (ThrottleException)
                            {
                                // Throttled
                                Log.Write(LogLevel.Warning, "PlayStream request throttle hit. Stream not set.");
                            }
                            catch (NullReferenceException)
                            {
                                // User Left, ignore.
                            }
                        }
                    }
                }
                else
                {
                    try
                    {
                        if (Spatialized)
                        {
                            if (audio != null)
                            {
                                currentPlayHandle = audio.PlayStreamOnComponent(channel, loudness);
                            }
                            else
                            {
                                currentPlayHandle = ScenePrivate.PlayStreamAtPosition(channel, ObjectPrivate.Position, loudness);
                            }
                        }
                        else
                        {
                            currentPlayHandle = ScenePrivate.PlayStream(channel, loudness);
                        }
                    }
                    catch (ThrottleException)
                    {
                        // Throttled
                        Log.Write(LogLevel.Warning, "PlayStream request throttle hit. Stream not set.");
                    }
                }
            });
        }
Ejemplo n.º 27
0
    private void ExecuteMovement(ScriptEventData data)
    {
        Log.Write("In Execute Animation data message: " + data.Message);
        ISimpleData  ExecuteData  = data.Data?.AsInterface <ISimpleData>();
        AgentPrivate ExecuteAgent = ScenePrivate.FindAgent(ExecuteData.AgentInfo.SessionId);

        Executor = ExecuteAgent.AgentInfo.Name;
        Log.Write("Executor: " + Executor);
        Log.Write("Director: " + Director);
        if (Executor == Director)
        {
            if (data.Message == MoveEvent[0])
            {
                LocalTeleport(0, data);
            }
            else if (data.Message == MoveEvent[1])
            {
                LocalTeleport(1, data);
            }
            else if (data.Message == MoveEvent[2])
            {
                LocalTeleport(2, data);
            }
            else if (data.Message == MoveEvent[3])
            {
                LocalTeleport(3, data);
            }
            else if (data.Message == MoveEvent[4])
            {
                LocalTeleport(4, data);
            }
            else if (data.Message == MoveEvent[5])
            {
                LocalTeleport(5, data);
            }
            else if (data.Message == MoveEvent[6])
            {
                LocalTeleport(6, data);
            }
            else if (data.Message == MoveEvent[7])
            {
                LocalTeleport(7, data);
            }
            else if (data.Message == MoveEvent[8])
            {
                LocalTeleport(8, data);
            }
            else if (data.Message == MoveEvent[9])
            {
                LocalTeleport(9, data);
            }
            else if (data.Message == MoveEvent[10])
            {
                LocalTeleport(10, data);
            }
            else if (data.Message == MoveEvent[11])
            {
                LocalTeleport(11, data);
            }
            else if (data.Message == MoveEvent[12])
            {
                LocalTeleport(12, data);
            }
            else if (data.Message == MoveEvent[13])
            {
                LocalTeleport(13, data);
            }
            else if (data.Message == MoveEvent[14])
            {
                LocalTeleport(14, data);
            }
            else if (data.Message == MoveEvent[15])
            {
                LocalTeleport(15, data);
            }
            else if (data.Message == MoveEvent[16])
            {
                LocalTeleport(16, data);
            }
            else if (data.Message == MoveEvent[17])
            {
                LocalTeleport(17, data);
            }
        }
    }
Ejemplo n.º 28
0
 public SimpleDataController()
 {
     specProvider       = Collection.Locate <ISpecProvider>();
     simpleDataProvider = Collection.Locate <ISimpleData>();
 }
    public override void Init()
    {
        if (!ObjectPrivate.TryGetFirstComponent(out Mesh))
        {
            Log.Write(LogLevel.Error, LogTag, "No MeshComponent found!  Aborting.");
            return;
        }
        else
        {
            List <RenderMaterial> materials = Mesh.GetRenderMaterials().ToList();
            if (materials.Count == 0)
            {
                Log.Write(LogLevel.Error, LogTag, "GetRenderMaterials() == null! Aborting.");
                return;
            }
            else
            {
                foreach (RenderMaterial material in materials)
                {
                    if (material == null)
                    {
                        Log.Write(LogTag, "Material is null");
                    }
                    else
                    {
                        Log.Write(LogTag, material.Name);
                        Log.Write(LogTag, material.ToString());
                    }
                }
            }

            Log.Write(LogTag, $"Mesh.IsScriptable={Mesh.IsScriptable}");

            if (!Mesh.IsScriptable)
            {
                Log.Write(LogLevel.Warning, LogTag, $"MeshComponent {Mesh.Name} is not scriptable");
            }

            SubscribeToScriptEvent(AbsorptionCommand, (ScriptEventData data) =>
            {
                ISimpleData idata = data.Data.AsInterface <ISimpleData>();

                RenderMaterial m     = Mesh.GetRenderMaterial(materials[0].Name);
                MaterialProperties p = m.GetProperties();

                p.Absorption = Absorption;
                m.SetProperties(p, Duration, InterpolationModeParse(Interpolation));
            });

            SubscribeToScriptEvent(BrightnessCommand, (ScriptEventData data) =>
            {
                ISimpleData idata = data.Data.AsInterface <ISimpleData>();

                RenderMaterial m     = Mesh.GetRenderMaterial(materials[0].Name);
                MaterialProperties p = m.GetProperties();

                p.Brightness = Brightness;
                m.SetProperties(p, Duration, InterpolationModeParse(Interpolation));
            });

            SubscribeToScriptEvent(TintCommand, (ScriptEventData data) =>
            {
                ISimpleData idata = data.Data.AsInterface <ISimpleData>();

                RenderMaterial m     = Mesh.GetRenderMaterial(materials[0].Name);
                MaterialProperties p = m.GetProperties();

                if (!Sansar.Color.TryParse(tint.ToRGBA(), out p.Tint))
                {
                    Log.Write(LogLevel.Error, LogTag, "TintCommand: Failed to parse as Sansar.Color");
                    return;
                }
                m.SetProperties(p, Duration, InterpolationModeParse(Interpolation));
            });

            SubscribeToScriptEvent(EmissiveCommand, (ScriptEventData data) =>
            {
                ISimpleData idata = data.Data.AsInterface <ISimpleData>();

                RenderMaterial m     = Mesh.GetRenderMaterial(materials[0].Name);
                MaterialProperties p = m.GetProperties();

                p.EmissiveIntensity = EmissiveIntensity;
                m.SetProperties(p, Duration, InterpolationModeParse(Interpolation));
            });

            SubscribeToScriptEvent(FlipbookCommand, (ScriptEventData data) =>
            {
                ISimpleData idata = data.Data.AsInterface <ISimpleData>();

                RenderMaterial m     = Mesh.GetRenderMaterial(materials[0].Name);
                MaterialProperties p = m.GetProperties();

                p.FlipbookFrame = Frames;
                m.SetProperties(p, Duration, InterpolationModeParse(Interpolation));
            });
        }
    }