Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Red192

#1
Help / Re: Few features I'd like to know how to make
October 14, 2019, 04:05:18 AM
As far i know rimworld uses xml just for read fields and data, not for describe any coded behavior.

Unless you are not activating/disattivating boolean, add or remove fields, increase or decrease values, any other kind of code will be ignored.

In other words: since the behavior you described is not used by any other weapon defs in the game should not be possibile to achieve what you are looking for by just modifying some xml code.

I'm have just begin to work on a mod and it's the first code project EVER, even little things are quite challenging to me (but quite fun i would say). However I think your idea could be done by a beginner thou, you should try to read the wiki a for setting up the C# workplace and begin to explore the code, if you want you can also follow the plagueGun tutorial, but i think you can also start right away
#2
I might find on a better solution: rename Draw() on the FireOverlay component and remove the override, make custom building class WorkTableWithFire, override usedThisTick() on it with: base.UsedThisTick(); this.GetComp<CompFireOverlayOnUse>().ReDraw();, put the new class in the thingClass of the custom building xml and... It works perfectly :)

EDIT: basically what you was telling me to do from the very begging but i did not understanding it, thanks LWM
#3
Try to modify the building toll definition (jobDriver or whatever) to look inside all the minified things in the map if the telescope is inside
#4
Oh no, is for a custom building
#5
https://github.com/RimWorld-CCL-Reborn/AlienRaces/wiki

in there you should find everything you need for make an idea of what you can do :)
#6
QuoteThere's probably a way to make it happen - again, having a close idea of what you're specifically trying to do would be helpful.  But I suspect you can reach it by one of the parameters passed to the Prefix or whatever?

Now i know that you need to add a reference to the original class into the preFix or PostFix parameters for work with it, i wasn't able to make it work for that probably. I did not touch that part since a while so o could return on that.

QuoteIs it possible to see your code?

yes, of course, i'm trying to say to a modified version of the component "fire overlay" to "fire overlay on use"

using System;
using UnityEngine;
using Verse;
using RimWorld;

namespace NoName
{
    // Token: 0x0200073A RID: 1850
    [StaticConstructorOnStartup]
    public class CompFireOverlayOnUse : ThingComp
    {

        // Token: 0x17000623 RID: 1571
        // (get) Token: 0x060028B9 RID: 10425 RVA: 0x00135B3C File Offset: 0x00133F3C
        public CompProperties_FireOverlayOnUse Props
        {
            get
            {
                return (CompProperties_FireOverlayOnUse)this.props;
            }
        }
        // Token: 0x060028BA RID: 10426 RVA: 0x00135B4C File Offset: 0x00133F4C !this.parent.Map.reservationManager.IsReservedByAnyoneOf(this.parent, this.parent.Faction
        public override void PostDraw()
        {
            base.PostDraw();
            if ((this.refuelableComp != null && !this.refuelableComp.HasFuel) || [color=red][b]!this.parent.Map.reservationManager.IsReservedByAnyoneOf(this.parent, this.parent.Faction)) [/b][/color]
            {
                return;
            }
            Vector3 drawPos = this.parent.DrawPos;
            drawPos.y += 0.046875f;
            CompFireOverlayOnUse.FireGraphic.Draw(drawPos, Rot4.North, this.parent, 0f);
            //itIsOn = false;
        }



        // Token: 0x060028BB RID: 10427 RVA: 0x00135BB5 File Offset: 0x00133FB5
        public override void PostSpawnSetup(bool respawningAfterLoad)
        {
            base.PostSpawnSetup(respawningAfterLoad);
        }

        // Token: 0x040016B5 RID: 5813
        protected CompRefuelable refuelableComp;

        // Token: 0x040016B6 RID: 5814
        public static readonly Graphic FireGraphic = GraphicDatabase.Get<Graphic_Flicker>("Things/Special/Fire", ShaderDatabase.TransparentPostLight, Vector2.one, Color.white);

    }
}



at the moment it just fire when reserved, as EbonJager suggested. Since it was a marginal part of the mod i simply put aside and move on, so i don't remember exactly what i tried and what not.

Right know i'm thinking to: Make a new building_worktable derived class, inside that i override UsedThisTick() to take the building, search if there is a FireOverlayOnUse component attached to it, if yes, change a public bool on it
#7
Help / Re: [Harmony] trying to postfix
October 05, 2019, 12:06:22 PM
I did it! i was quite surprised that it is worked, but, ok :)

at the end i have made a new class derived from statPart. Then i made a new StatDef in which put the new part, and finaly I've made a simple xml patch for add the new StatDef into the statFactors node of miningSpeed. No harmony required :)

Maybe I rewrite it for make it a bit more universal, so it can be reused in other problems
#8
Help / Re: [Harmony] trying to postfix
October 05, 2019, 08:43:11 AM
Thanks K

Edit: I just tried without the typo and still does not work, but since you even advise against patching the jobDriver i might try to modify the stats, even if i don't know exactly how right now.
I might have confuded that a ref variable is a copy of the original field and for that reason the original is not edited
#9
Help / [Harmony] trying to postfix
October 04, 2019, 10:41:48 AM
So, i'm trying to use Harmony for make the mining ticks been affected by a certain tecnology, but it does not work, i tried a bit but i guess is better to try to ask here:

using RimWorld;
using System.Reflection;
using System;
using Verse;
using Harmony;

namespace NoName
{
    [HarmonyPatch(typeof(JobDriver_Mine))]
    [HarmonyPatch("ResetTicksToPickHit")]
    static class JobDriver_Mine_ResearchPatch
    {
        static void Postfix(JobDriver_Mine __istance, ref int ___ticksToPickHit)
        {
            float num = 1;
            if (ResearchProjectDef.Named("IronWorking").IsFinished)
            {
                num = 0.5f;
            }
           ___ticksToPickHit = (int)(___ticksToPickHit*num);
        }
    }
}


Is something wrong?

EDIT: A reference cannot be modified... of course
#10
Help / Re: How to properly override ThingComp?
October 04, 2019, 10:32:39 AM
I'm newb as well, so i could be wrong, but for example you can copy and paste the thingDef of, i don't know, the fire camp, in a xml inside your mod folder and than add your new component to it. Go in game, build a campfire and see if it works
#11
Help / Re: How to properly override ThingComp?
October 03, 2019, 10:48:58 AM
The problem for me is that the thing is not instantiated, try to put the component into a building and than spawn it in the map
#12
ok, today i returned on this part and i wasn't able to get something out of it: firstly i tried to create  a new thingclass, child of building_workshop, but the UsedThisTick was not called by doRecipeWork in that case.

After that I installed and tried the harmony ddl, but i need to add a public variable in Building_Workshop for being usable from the component. I cant even call a component attached to that building from the harmony patching.

now, i know is a bit embarrassing, but i need to ask about some programming basics on how to solve the problem, i'm quite new to this kind of stuff so I don't know how to make this thing work properly
#13
Help / Re: Troubles with IEnumerable
September 24, 2019, 10:04:31 AM
I don't use hugs lib at the moment but harmony work fine with 3.5, in any case I don't know what are the differences between the two version
#14
just for the first one thou... in the third one i can't see any problem
#15
Help / Re: Troubles with IEnumerable
September 24, 2019, 05:48:01 AM
sorry for the stupid question but we are not suppose to use only .net 3.5?