コード例 #1
0
        public override bool TryMergeWith(Hediff other)
        {
            //if a new S***n hediff is added to the same body part, they are combined. if severity reaches more than 1, spillover to other body parts occurs

            Hediff_Semen hediff_Semen = other as Hediff_Semen;

            if (hediff_Semen != null && hediff_Semen.def == this.def && hediff_Semen.Part == base.Part && this.def.injuryProps.canMerge)
            {
                semenType = hediff_Semen.semenType;                //take over new creature color

                float totalAmount = hediff_Semen.Severity + this.Severity;
                if (totalAmount > 1.0f)
                {
                    BodyPartDef spillOverTo = SemenHelper.spillover(this.Part.def);                    //SemenHelper saves valid other body parts for spillover
                    if (spillOverTo != null)
                    {
                        //Rand.PopState();
                        //Rand.PushState(RJW_Multiplayer.PredictableSeed());
                        IEnumerable <BodyPartRecord> availableParts = SemenHelper.getAvailableBodyParts(pawn);           //gets all non missing, valid body parts
                        IEnumerable <BodyPartRecord> filteredParts  = availableParts.Where(x => x.def == spillOverTo);   //filters again for valid spill target
                        BodyPartRecord spillPart = filteredParts.RandomElement <BodyPartRecord>();                       //then pick one
                        if (spillPart != null)
                        {
                            SemenHelper.cumOn(pawn, spillPart, totalAmount - this.Severity, null, semenType);
                        }
                    }
                }

                return(base.TryMergeWith(other));
            }
            return(false);
        }
コード例 #2
0
        public override void PostTick()
        {
            if (pawn.RaceProps.Humanlike)            //for now, only humans are supported
            {
                hediffs_semen = this.pawn.health.hediffSet.hediffs.FindAll(x => (x.def == RJW_SemenoOverlayHediffDefOf.Hediff_Semen || x.def == RJW_SemenoOverlayHediffDefOf.Hediff_InsectSpunk || x.def == RJW_SemenoOverlayHediffDefOf.Hediff_MechaFluids));
                float bukkakeLevel = CalculateBukkakeLevel();                //sum of severity of all the s***n hediffs x semenWeight
                this.Severity = bukkakeLevel;
                bool updatePortrait = false;

                //loop through all s***n hediffs, add missing ones to dictionary
                for (int i = 0; i < hediffs_semen.Count(); i++)
                {
                    Hediff_Semen h  = (Hediff_Semen)hediffs_semen[i];
                    string       ID = h.GetUniqueLoadID();             //unique ID for each hediff
                    if (!splatches.ContainsKey(ID))                    //if it isn't here yet, make new object
                    {
                        updatePortrait = true;
                        bool leftSide = h.Part.Label.Contains("left") ? true : false;                        //depending on whether the body part is left or right, drawing-offset on x-aixs may be inverted

                        splatches[ID] = new SemenSplatch(h, pawn.story.bodyType, h.Part.def, leftSide, h.semenType);
                    }
                }



                //remove splatch objects once their respective s***n hediff is gone
                List <string> removeKeys = new List <string>();
                foreach (string key in splatches.Keys)
                {
                    SemenSplatch s = splatches[key];

                    if (!hediffs_semen.Contains(s.hediff_Semen))
                    {
                        removeKeys.Add(key);
                        updatePortrait = true;
                    }
                }
                //loop over and remove elements that should be destroyed:
                foreach (string key in removeKeys)
                {
                    SemenSplatch s = splatches[key];
                    splatches.Remove(key);
                }

                if (updatePortrait)                //right now, portraits are only updated when a completely new s***n hediff is added or an old one removed - maybe that should be done more frequently
                {
                    PortraitsCache.SetDirty(pawn);
                }
            }
        }
コード例 #3
0
            public SemenSplatch(Hediff_Semen hediff, BodyTypeDef bodyType, BodyPartDef bodyPart, bool leftSide = false, int semenType = SemenHelper.CUM_NORMAL)
            {
                hediff_Semen  = hediff;
                semenMaterial = new Material(BukkakeContent.pickRandomSplatch());                //needs to create new material in order to allow for different colors
                semenMaterial.SetTextureScale("_MainTex", new Vector2(-1, 1));
                this.bodyPart = bodyPart;
                //Rand.PopState();
                //Rand.PushState(RJW_Multiplayer.PredictableSeed());

                //set color:
                switch (semenType)
                {
                case SemenHelper.CUM_NORMAL:
                    semenMaterial.color = SemenHelper.color_normal;
                    break;

                case SemenHelper.CUM_INSECT:
                    semenMaterial.color = SemenHelper.color_insect;
                    break;

                case SemenHelper.CUM_MECHA:
                    semenMaterial.color = SemenHelper.color_mecha;
                    break;
                }

                if (!MP.enabled)
                {
                    mirrorMesh = (Rand.Value > 0.5f);                    //in 50% of the cases, flip mesh horizontally for more variance
                }
                //x,y,z adjustments to draw splatches over the approximately correct locations; values stored in s***n helper - accessed by unique combinations of bodyTypes and bodyParts
                SemenHelper.key k = new SemenHelper.key(bodyType, bodyPart);
                if (SemenHelper.splatchAdjust.Keys.Contains(k))
                {
                    SemenHelper.values helperValues = SemenHelper.splatchAdjust[k];

                    //invert, x-adjust (horizontal) depending on left/right body side:
                    if (!leftSide)
                    {
                        float[] xAdjTemp = new float[4];
                        for (int i = 0; i < xAdjTemp.Length; i++)
                        {
                            xAdjTemp[i] = helperValues.x[i] * -1f;
                        }
                        xAdjust = xAdjTemp;
                    }
                    else
                    {
                        xAdjust = helperValues.x;
                    }

                    zAdjust = helperValues.z; //vertical adjustment
                }
                else                          //fallback in the the key can't be found
                {
                    if (Prefs.DevMode)
                    {
                        Log.Message("created s***n splatch for undefined body type or part. BodyType: " + bodyType + " , BodyPart: " + bodyPart);
                    }
                    xAdjust = new float[] { 0f, 0f, 0f, 0f };
                    zAdjust = new float[] { 0f, 0f, 0f, 0f };
                }


                //y adjustments: plane/layer of drawing, > 0 -> above certain objects, < 0 -> below
                SemenHelper.key_layer k2 = new SemenHelper.key_layer(leftSide, bodyPart);

                if (SemenHelper.layerAdjust.Keys.Contains(k2))
                {
                    SemenHelper.values_layer helperValues_layer = SemenHelper.layerAdjust[k2];
                    yAdjust = helperValues_layer.y;
                }
                else
                {
                    yAdjust = new float[] { 0.02f, 0.02f, 0.02f, 0.02f };                    //over body in every direction
                }
            }