Exemple #1
0
        internal static void SetAttachment(AttachmentPointId point, string thingName, bool moveLeg = true)
        {
            Person              ourPerson = Managers.personManager.ourPerson;
            GameObject          attpoint  = ourPerson.GetAttachmentPointById(point);
            SavedAttachmentList list      = config.GetListForAttachmentPoint(point);

            if (thingName.Length == 0 || thingName.Equals("-"))
            {
                Managers.personManager.DoRemoveAttachedThing(attpoint);
            }
            else if (list.ContainsName(thingName))
            {
                var comp = attpoint.GetComponent <StartCoroutineAttach>();
                if (comp == null)
                {
                    comp = attpoint.AddComponent <StartCoroutineAttach>();
                }
                comp.Attach(attpoint.GetComponent <AttachmentPoint>(), list[thingName]);

                if (moveLeg)
                {
                    try {
                        if (point == AttachmentPointId.LegLeft)
                        {
                            ourPerson.AttachmentPointLegLeft.transform.localPosition    = config.LegPosLeft[thingName];
                            ourPerson.AttachmentPointLegLeft.transform.localEulerAngles = config.LegRotLeft[thingName];
                            Managers.personManager.SaveOurLegAttachmentPointPositions();
                        }
                        else if (point == AttachmentPointId.LegRight)
                        {
                            ourPerson.AttachmentPointLegRight.transform.localPosition    = config.LegPosRight[thingName];
                            ourPerson.AttachmentPointLegRight.transform.localEulerAngles = config.LegRotRight[thingName];
                            Managers.personManager.SaveOurLegAttachmentPointPositions();
                        }
                    } catch (KeyNotFoundException) { }
                }
            }
            else
            {
                DebugLog.Log("\"{0}\" is not a known attachment for {1}.", thingName, point);
            }
        }
Exemple #2
0
        public ConfigFile(UnityModManager.ModEntry mod)
            : base(mod, "config.txt")
        {
            listHead       = new SavedAttachmentList(AttachmentPointId.Head);
            listHeadTop    = new SavedAttachmentList(AttachmentPointId.HeadTop);
            listTorsoLower = new SavedAttachmentList(AttachmentPointId.TorsoLower);
            listTorsoUpper = new SavedAttachmentList(AttachmentPointId.TorsoUpper);
            listHandLeft   = new SavedAttachmentList(AttachmentPointId.HandLeft);
            listHandRight  = new SavedAttachmentList(AttachmentPointId.HandRight);
            listArmLeft    = new SavedAttachmentList(AttachmentPointId.ArmLeft);
            listArmRight   = new SavedAttachmentList(AttachmentPointId.ArmRight);
            listLegLeft    = new SavedAttachmentList(AttachmentPointId.LegLeft);
            listLegRight   = new SavedAttachmentList(AttachmentPointId.LegRight);

            LegPosLeft  = new Dictionary <string, Vector3>();
            LegPosRight = new Dictionary <string, Vector3>();
            LegRotLeft  = new Dictionary <string, Vector3>();
            LegRotRight = new Dictionary <string, Vector3>();

            AddDefaultValue("IgnoreAddBody", "False");
            AddDefaultValue("EnableTellControl", "True");
        }