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 - pawnstorm

#16
Mods / Re: [Request] - Bulk Transportation
May 25, 2014, 03:18:40 PM
I think they just haul one stack of anything. Whether an item is stackable or the amount that can be stacked is defined elsewhere. With backpacks, you'd have the same problem drawing them as with wheelbarrows. Aside from the drawing issue, it'd probably be possible to allow colonists to carry an extra stack of something by rewriting the jobdrivers to pick up another stack and handle the extra storage reservation. I don't think it's worth the effort though.
#17
General Discussion / Re: Introduce Yourself!
May 24, 2014, 09:03:07 PM
Maybe it's a good idea to just delete all posts after Cael's post and edit his post to not include the suggestion of downloading Rimworld from a torrent site. All this talk about piracy probably just leads to more people pirating the game.
#18
Quote from: Jagginlaz0rz on May 24, 2014, 03:22:22 PM
But, this begs a different question, how DID you make the turrets attack animals? Was it a difficult thing?
Tynan made turrets unable to target animals on purpose, for balance reasons I suppose. It's really easy to change it, though making turrets behave like that by default would make animal events kinda pointless. Anyway, all you have to do is override TryStartShoot() and remove
if (!p.RaceDef.humanoid)
return false;
#19
Help / Re: Adding new Architect tabs [solved]
May 23, 2014, 06:46:18 AM
In case somebody finds it useful, I thought I'd share some code here. Aside from extending the TabArchitect class and replacing Find.MainTabsRoot.tabArchitect with it in the incidentmakerclasses like I did in Architect+ (Architect+ comes with source btw, unlike Vanilla+), I found another easy way to add stuff to the interface. It's the same method that's also used in Joretap0's awesome Inventory Panel mod.

This is achieved by adding a custom Layer extended class to the layerstack, adding it is simple: Find.Layers.Add(YourLayer). You can draw any GUI stuff you want in a layer, buttons, icons, dialogs, labels...

The problem is finding some way to trigger adding the layer at the right time. The solution I came up with is adding a dummy sound to get an early trigger through the constructor of the custom sound class (which is always triggered after mods are loaded), and then creating a custom mapgenner for when a new game is started and a custom postloadinitter for when a game is loaded. I've also added a destructor that ensures a new instance is added to the mapgenners/postloadinitters if needed when it is removed. Hacky method, but it works :P.

First you need to create a dummy sound def in Defs\SoundDefs. Use a different def name to avoid compatibility issues:

<?xml version="1.0" encoding="utf-8"?>
<SoundDefPackage>
<SoundDef>
<defName>SubSoundDummy</defName>
<subSounds>
<li Class="YourMod.SubSoundDummy, YourMod">
</li>
</subSounds>
</SoundDef>
</SoundDefPackage>


And these are the classes you need to trigger adding your Layer at the appropriate time:

    public class SubSoundDummy : SubSoundDef
    {
        public SubSoundDummy()
        {
            if (!Genner_YourMod.active)
            {
                Genner_YourMod genner = new Genner_YourMod();
                foreach (MapGeneratorDef def in DefDatabase<MapGeneratorDef>.AllDefs)
                    def.genners.Add(genner);
            }
            if (!Initter_YourMod.active)
            {
                Initter_YourMod init = new Initter_YourMod();
                PostLoadInitter.RegisterForPostLoadInit(init);
            }
        }
    }


    public class Genner_YourMod : Genner
    {
        public static bool active = false;

        public Genner_YourMod()
        {
            active = true;
        }

        ~Genner_YourMod()
        {
            if (!PlayDataMaster.loaded && ModsConfig.IsActive("YourMod"))
            {
                Genner_YourMod genner = new Genner_YourMod();
                foreach (MapGeneratorDef def in DefDatabase<MapGeneratorDef>.AllDefs)
                    def.genners.Add(genner);
            }
            else
            {
                active = false;
            }
        }

        public override void Generate()
        {
            if (ModsConfig.IsActive("YourMod"))
                Find.Layers.Add(new YourLayer());
        }   
    }


    public class Initter_YourMod : Saveable
    {
        public static bool active = false;

        public Initter_YourMod()
        {
            active = true;
        }
       
        ~Initter_YourMod()
        {
            if (Scribe.mode == LoadSaveMode.PostLoadInit && ModsConfig.IsActive("YourMod"))
            {
                Initter_YourMod init = new Initter_YourMod();
                PostLoadInitter.RegisterForPostLoadInit(init);
            }
            else
            {
                active = false;
            }
        }

        public void ExposeData()
        {
            if (ModsConfig.IsActive("YourMod"))
                Find.Layers.Add(new YourLayer());
        }
    }
#20
Mods / Re: [Request] - Bulk Transportation
May 23, 2014, 06:07:47 AM
This is a really nice idea, but it'd be pretty hard to implement with the way rimworld handles jobs. Jobs are just given to pawns with a single target (which can be a thing or a location). I suppose it'd be possible to keep collecting things that are of the same type, but managing the storage reservations would be an issue, especially when odd things happen like the job gets interrupted.
Another thing I think would be hard to do right is drawing the wheelbarrow correctly in relation to the colonist using it. If the colonist is moving up, the colonist would have to be drawn over the wheelbarrow, if he's moving down it's the other way around.
Also, pathing would be tricky. You'd have to take into account that one square ahead of the colonist also has to be a passable square, since that's where the wheelbarrow is.
#21
Added the modpack and compiled a new version of Vanilla+. You can now change the caption above the architect menu by editing the Settings.xml file. Probably not very useful for most of you, but I figured it might be a nice touch for modpack creators, so they can easily change the caption to the name of their modpack.
If someone deletes the Settings.xml file, it'll default back to Vanilla+ though.
#22
Nice! You left the source in though, not sure if you meant to do that. Also, there are 2 InventoryPanel directories?
#23
I got it working, I sent you a private message :)
#24
I think I found a way to add the inventory panel to the HUD without needing to override a vanilla class or use a building. Is it ok if I try to add this to your mod and then send you the files? You can do anything you want with my code, I don't need credit for it or anything.
#25
Ah, you got it working, nice! I don't understand why you add the button to the layerstack in the TickRare() method though, doesn't that keep adding new layers to the layerstack every 5 seconds?
Perhaps you can do it in SpawnSetup(), that way you also don't need the InitializeMod(). You could remove it from the layerstack in DeSpawn(), and maybe add a placement restricter for it so that people can only build one Inventory Panel.
I'd much prefer if it didn't require a building though, seems a bit odd to me to have to build something to view my inventory.
Another suggestion, maybe you could also use the command icon you used on the building as an icon on the HUD. If you could squeeze it in next to the "Toggle visibility of zones" icon (below the normal speed icon) I think that'd be perfect.
#26
Ah, awesome job! Looking forward to the new version :)
#27
Quote from: benramit on May 19, 2014, 03:14:29 PM
got the update it work perfect thank you so much ;D
Glad to hear, thanks for reporting it works now!
#28
It'll be just an archive with a small collection of mods which I've tested for compatibility, each mod in its own directory with all the original files and nothing added. Is that alright?

Just a braindump of some ideas on how to add it to the HUD:

First, you'll need a place where it draws your HUD-element. I can think of 2 options:
You can extend TabInspect and replace Find.MainTabsRoot.tabInspect with your extended class, kinda like I did with TabArchitect. Then make a function to draw your stuff and override PanelOnGUI to also call your function. Maybe you could integrate a button or something into the inspectorpane, if you check (Find.Selector.NumSelected > 0) before you draw it'll only display the button when something(s) is/are selected.
Or you can try to add it to the LayerStack. I'm not sure how those work, but adding it seems simple: Find.Layers.Add(your layer extended class). And then just put the draw stuff in YourLayer.LayerOnGui().

Then for the tricky part, which is adding your custom tabinspect/layer to the UI. There's the trick I used in architect+, using the incidentmakerclasses, but you wanted a different solution. Also, using the incidentmaker classes would obviously make it incompatible with Architect+/Vanilla+.
I think it's impossible to do this without atleast overriding some original class and replacing it in an xml file. Preferably one that gets instantiated at the right time, but I can't think of any besides the incidentmaker classes. I'll attach 2 textfiles with some grepresults of all the unique classes referenced in the core xml files, perhaps you have better luck.
It might work too if you can find a class that gets used atleast once before the game UI is displayed. Perhaps you can override one of the sound classes and add it to a certain sound.
In the sound class, just extend the original class, and add a static constructor that adds your TabInspect/Layer to the GUI. Then, add a destructor to your custom TabInspect/Layer class that checks if it should add itself again (for TabInspect you could check if Find.MainTabsRoot.tabInspect is of the original TabInspect class again, if you took the Layer approach, check if Find.Layers.FirstLayerOfType(YourCustomLayer)==null). Maybe you'd also need to check if your mod's still active just in case someone unloads it.

Edit: Maybe it'd also be a nice idea to create like a wrapper mod library that any mod can use to trigger their class on the incidentmaker class and/or some static trigger in another class that loads early. That way, multiple mods can use the same trigger.

[attachment deleted by admin: too old]
#29
Nice mod! This is really useful :). Do you have any ideas yet on how to add it to the HUD? If you want my help, I think I might have some ideas.

Also can I add this to the Vanilla+ modpack? Pretty please? :P
It's going to be just a little bundle of mods as a separate download that I think complement Vanilla+ well and which I do some testing on for compatibility issues.
#30
General Discussion / Re: Reproduce
May 19, 2014, 09:13:29 AM
Quote from: a89a89 on May 19, 2014, 08:56:35 AM
Quote from: Thracian on May 19, 2014, 07:22:12 AM
Is there a mod where you can let your colonists reproduce? (but of course you need a man and women)? or is this going to be a feuture?
if there was a mod like that, would you really wait 1800 days ( just guessing) for them to work?
lol, good point. Would be fun to implement though, you could even make female colonists subject to random mood swings and sudden cravings for raw meat when pregnant. Or make their mood randomly affect the thoughts of the other colonists, ie. "I'm pregnant and want to spread the joy that the promise of new life brings!" or "I'm pregnant. My back hurts, my hormones are a mess and the whole world must suffer for it!" :P.