public override void FinishBill(RuneBill bill, Pawn pawn)
        {
            SocketComp socket = bill.itemToBeManipulated.TryGetComp <SocketComp>();

            if (socket != null)
            {
                socket.SocketRune(bill.runeToManipulate);
            }
        }
示例#2
0
        public float SocketableMarketValue(SocketComp socketable)
        {
            float result = 0f;

            foreach (Thing rune in socketable.socketedThings)
            {
                result += rune.MarketValue;
            }

            return(result);
        }
示例#3
0
        public static void DrawRuneAttachments(Thing eq, ref Vector3 drawLoc, float aimAngle, bool useAimingRotation = true, Graphic graphic = null, Rot4 rot = new Rot4())
        {
            SocketComp socketable = eq.TryGetComp <SocketComp>();

            if (socketable == null)
            {
                return;
            }

            //Vanilla routines.
            Mesh  mesh = null;
            float num  = aimAngle;

            if (useAimingRotation)
            {
                num = aimAngle - 90f;

                if (aimAngle > 20f && aimAngle < 160f)
                {
                    mesh = MeshPool.plane10;
                    num += eq.def.equippedAngleOffset;
                }
                else if (aimAngle > 200f && aimAngle < 340f)
                {
                    mesh = MeshPool.plane10Flip;
                    num -= 180f;
                    num -= eq.def.equippedAngleOffset;
                }
                else
                {
                    mesh = MeshPool.plane10;
                    num += eq.def.equippedAngleOffset;
                }
                num %= 360f;
            }
            else
            {
                mesh = graphic.MeshAt(rot);
            }

            //Custom drawing.
            Vector3 runeDrawLoc = drawLoc + new Vector3(0f, 0.01f, 0f);

            foreach (RuneComp rune in socketable.SocketedRunes)
            {
                if (rune.OverlayGraphic != null)
                {
                    Material matSingle = rune.OverlayGraphic.MatSingle;
                    Graphics.DrawMesh(mesh, runeDrawLoc, Quaternion.AngleAxis(num, Vector3.up), matSingle, 0);
                }
            }
        }
示例#4
0
        public static bool Patch_Verb_LaunchProjectile_GetProjectile(ref ThingDef __result, Verb_LaunchProjectile __instance)
        {
            if (__instance.EquipmentSource != null)
            {
                SocketComp comp = __instance.EquipmentSource.GetComp <SocketComp>();
                if (comp != null && comp.SocketedRunes.FirstOrDefault(runeComp => runeComp.RuneProps.replacedProjectile != null) is RuneComp rune)
                {
                    __result = rune.RuneProps.replacedProjectile;
                    return(false);
                }
            }

            return(true);
        }
        public override void FinishBill(RuneBill bill, Pawn pawn)
        {
            SocketComp socket = bill.itemToBeManipulated.TryGetComp <SocketComp>();

            if (socket != null)
            {
                Thing rune = socket.RemoveRune(bill.runeToManipulate);

                if (rune != null)
                {
                    //Try to spawn it nearby.
                    GenPlace.TryPlaceThing(rune, pawn.Position, pawn.Map, ThingPlaceMode.Near);
                }
            }
        }
        public override IEnumerable <Toil> MakeWorkToils(Toil endToil)
        {
            yield return(Toils_General.Wait(100).WithProgressBarToilDelay(TargetIndex.A, false));

            Toil workToil = new Toil();

            workToil.initAction = delegate()
            {
                SocketComp socket = Item.TryGetComp <SocketComp>();
                if (socket != null)
                {
                    socket.SocketRune(RuneThing);
                }
            };
            yield return(workToil);
        }
        public override IEnumerable <Toil> MakeWorkToils(Toil endToil)
        {
            this.FailOn(() => Bill == null || (Bill.paused || Bill.assignedPawn != pawn));

            yield return(Toils_General.Wait(Bill.recipeDef.workRequired, TargetIndex.C).WithProgressBarToilDelay(TargetIndex.C, false).PlaySustainerOrSound(Bill.recipeDef.workSound));

            Toil workToil = new Toil();

            workToil.initAction = delegate()
            {
                SocketComp socket = Item.TryGetComp <SocketComp>();
                if (socket != null && Bill != null)
                {
                    Bill.recipeDef.Worker.FinishBill(Bill, GetActor());
                    BillHolder.BillStack.RemoveBill(Bill);
                    EndJobWith(JobCondition.Succeeded);
                }
            };
            yield return(workToil);
        }
示例#8
0
 public abstract bool ItemTargetingCondition(SocketComp socketable, RuneBill bill);
 public override bool ItemTargetingCondition(SocketComp socketable, RuneBill bill)
 {
     return(socketable.CanBeSocketed && socketable.FreeSlots > 0);
 }
示例#10
0
 public virtual void Notify_RuneRemoved(SocketComp socketable)
 {
 }
示例#11
0
 public virtual void Notify_RuneInserted(SocketComp socketable)
 {
 }
 public override bool ItemTargetingCondition(SocketComp socketable, RuneBill bill)
 {
     return(socketable.CanBeSocketed && socketable.SocketedRunes.Count() > 0);
 }