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

#1
Now, I know this isn't super helpful at the moment but I made a little addition myself. I wanted to just start with something small to play around with the code a bit, so I created a "splash screen" of sorts.

It's a new first tab that will display first when the program starts, with a big logo image on it. My main idea with it is that once a save is loaded, the logo will disappear and be replaced by a summary of various information from the save file. Things like planet name, maybe the grid location, colony name, number of colonists, etc., etc.

This isn't too helpful right now, but since the plan is to expand this with more and more features, it might be helpful to have a spot to print summary information down the line.

I also put together a logo for it with a name I came up with. I felt it did a good job representing the Rim-whatevs feeling, so I ran with it. If you don't like the name then we don't have to use it for the project, no biggie.

Anyway, there should be a pull request pending so please take a look.
#2
Quote from: StorymasterQ on August 21, 2014, 01:20:20 AM
C has always been finicky with casing. But, it's the way to go for a programmer.

In my defense, the problem was in the xml file. Using class in C usually requires lowercase, so I guess that carried over when I wrote the xml file.

@Shinzy
I'm glad you could get a good laugh out of that!  :)
#3
Help / Re: Arbitrary XML\DLL definitions
August 21, 2014, 08:04:27 AM
I'd like to add that upon further thought, perhaps my saying that I wasn't "seeing what I was missing" was a poor choice of words. Because I didn't really understand what you meant I had thought you were probably saying that I had just made a mistake in a line or two somewhere. Written a command wrong or made a wrong call or something. So I had just been trying to say that I wasn't seeing where those wrong lines were.

I apologize for that, I definitely didn't mean to make you think that I was ignoring what you were saying.
#4
Help / Re: Arbitrary XML\DLL definitions
August 21, 2014, 07:06:20 AM
Haplo and Neurotoxin are indeed correct in that I didn't understand your answer at the time. Hence my response about not "seeing" what I was doing wrong from you said. Thank you for expanding your answer however.
#5
*Comes home after a looooong day.

*Checks forums and sees a suggestion.

*Fires up project and makes suggested alteration.

*Launches Rimworld and checks if fixed.

*SLAMS HEAD REPEATEDLY INTO TABLE.


really? REALLY!? The differing case of that one letter was the whole problem? What the hell language?! What the actual hell!!!???
#6
A bunch of it's stuck together now that wasn't before, as a consequence of my shuffling it around repeatedly trying to solve this... issue. But yeah, I did intend to have it split up more.

If it really is just some odd behavior then I guess that means I'll just have to hard code the variables. sigh...
#7
@Haplo:
It hasn't complained to me about the "ToString" thing, and when I set the values to something specific during testing it still displays it correctly. I can still add that though, I doubt it'll do any harm anyway.

On the internal/public thing, it was public until just before I copy/pasted the code. I made that small change when looking over the code mrofa was kind enough to link, just in case it made any difference. It didn't so I've changed it back since then.

@mrofa:
I do have the blue and green lines though, as:
<ThingDef class="Nuclear_Generator.ThingDef_FuelRod">
<ThingClass>Nuclear_Generator.FuelRod</ThingClass>

And the only variable I'm trying to add at the moment is:
<MaxEnergyLevel>1000</MaxEnergyLevel>

Though it is possible that maybe I'm missing the point of what your saying.

Thank you both for taking some more time to have a look at this problem for me. It is much appreciated.
#8
As I mentioned I use Mercurial myself, and I do it through TortoiseHg. It's got a pretty d*** good gui actually. I've had some some experience with TortoiseGit, but it's been a fair while since then. Still, much of it is probably the same.

Some good news though. After using some google-fu, it looks like there an extension for TortoiseHg to allow changing repos between mercurial and git on the fly. It'll apparently even connect and work with github. So I might look into using that. It'd be nice to get the best of both worlds.
#9
I must definitely be missing the obvious here. I very much appreciate your taking the time to have a look at what I posted, but I'm afraid I'm just not seeing what I'm missing. Or probably more appropriately, I'm just not seeing where I'm missing it. Thanks for the pointers though,
#10
Well I feel silly. I guess I should have looked at the files a little bit better first :P
I was just starting to poke around between working on this other thing so I completely missed that. Anyway, yeah, I 'll see what I can do when I get the chance...
#11
Sure, I'd be happy for the direct help. I'm always a little embarrassed doing things like showing off code just because I'm always afraid I'm doing an embarrassingly terrible job, but oh well.

oh, I made a couple edits to it first to bring it more inline with the example you provided above (thank you by the way). Still didn't seem to work though. anyway, here we go...

Here's the c# file in question, named FuelRod.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using UnityEngine;         // Always needed
//using VerseBase;         // Material/Graphics handling functions are found here
using Verse;               // RimWorld universal objects are here (like 'Building')
using Verse.AI;            // Needed when you do something with the AI
//using Verse.Sound;       // Needed when you do something with the Sound
using RimWorld;            // RimWorld specific functions are found here (like 'Building_Battery')
//using RimWorld.Planet;   // RimWorld specific functions for world creation
//using RimWorld.SquadAI;  // RimWorld specific functions for squad brains

namespace Nuclear_Generator
{

    /// <summary>
    /// The ThingDef to define new variables for the "fuelrod" xml
    /// </summary>
    internal class ThingDef_FuelRod : ThingDef
    {
        /// <summary>
        /// Max "energy" level of rod. Generator removes "energy" at a fixed rate from the rod until it is spent.
        /// </summary>
        public int MaxEnergyLevel = 0;
    }

    /// <summary>
    /// Class for the FuelRod. Mainly just to track/show how much energy is left in it.
    /// </summary>
    public class FuelRod : ThingWithComponents
    {
        /// <summary>
        /// the max "energy" level. can never be less then 0.
        /// </summary>
        public int EnergyLevelMax { get; private set; }
        /// <summary>
        /// the current "energy" level. can never be less then 0.
        /// </summary>
        public int EnergyLevelCurrent { get; set; }

        public override void SpawnSetup()
        {
            base.SpawnSetup();

            ThingDef_FuelRod FuelRodDef = (ThingDef_FuelRod)this.def;
            EnergyLevelCurrent = FuelRodDef.MaxEnergyLevel;
        }

        /// <summary>
        /// Replaces/adds to the text that'll be shown in the lower left info box when the rod is selected.
        /// really just displays the percentage of energy remaining in the rod.
        /// </summary>
        /// <returns>the string of text for the info box</returns>
        public override string GetInspectString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(base.GetInspectString());

            stringBuilder.Append("Current Energy Level: " + EnergyLevelCurrent);
            stringBuilder.AppendLine();
            stringBuilder.Append("Max Energy Level: " + EnergyLevelMax);

            return stringBuilder.ToString();
        }
    }

}


I'm sure you can guess at what kind of mod I'm working on now...

Here's the xml file for it as well:
<?xml version="1.0" encoding="utf-8" ?>
<Resources>

<ThingDef class="Nuclear_Generator.ThingDef_FuelRod"> <!--ParentName="ResourceBase"-->
<category>Item</category>
<eType>Item</eType>
<resourceReadoutPriority>Middle</resourceReadoutPriority>
<useStandardHealth>true</useStandardHealth>
<selectable>true</selectable>
<maxHealth>100</maxHealth>
<altitudeLayer>Item</altitudeLayer>
<stackLimit>1</stackLimit>
<tradersCarry>true</tradersCarry>
<comps>
<li><compClass>CompForbiddable</compClass></li>
</comps>
<beauty>Ugly</beauty>
<alwaysHaulable>true</alwaysHaulable>
<drawGUIOverlay>true</drawGUIOverlay>
<rotatable>false</rotatable>
<pathCost>15</pathCost>

<defName>FuelRod</defName>
<label>Fuel Rod</label>
<ThingClass>Nuclear_Generator.FuelRod</ThingClass>
<description>A uranium fuel rod for use in a reactor.</description>
<texturePath>Things/FuelRodTemp</texturePath>
<soundInteract>Metal_Drop</soundInteract>
<soundDrop>Metal_Drop</soundDrop>
<basePrice>5</basePrice>
<storeCategories>
<li>Manufactured</li>
</storeCategories>

<!--
Max amount of "energy" or "work" that the rod can do/handle.
The generator removes a set amount of "energy" from each rod every
so often.
Once empty it becomes "spent", and the generator can't use it anymore.
-->
<MaxEnergyLevel>1000</MaxEnergyLevel>
</ThingDef>

</Resources>


I did have it split between a "resource base" class and the main one, but I've stuck it all in one temporarily while trying to get this to work.

I get the distinct impression that I'm just missing something obvious and I'll probably feel really silly once it's pointed out  :-[
#12
Hi again Neurotoxin. I know I mentioned before that I wanted to try giving you a hand on this, but I've been occupied these last few days or so trying to create a mod to fill a gap in the gameplay that I feel. Also I use mercurial for source control and don't have anything installed to handle git, so doing proper push/pull operations might be a bit difficult for me to do directly.

Still, I'd like to try my hand at poking around and seeing what I might be able to add. To that end, do you have an list of features or priorities for what you'd like to see done? I've got a couple ideas but it might be helpful to hear the kind of direction you wanted to go.
#13
Hello everybody. This is the first time I thought I'd try my hand at creating a mod, but I seem to have into a little snag.

I wanted to add the ability to load a variable for an item from it's xml so it didn't have to be hardcoded into the dll. I found a couple helpful posts about this in the forums here, as well as some good examples about this in a few other peoples mods. So thanks to everybody for that awesome work.

The thing is though, all that stuff was about buildings and the like. When I extend an item or thing class with that stuff it doesn't seem to load anything. Everything else seems to work fine and it doesn't throw any error messages. Does anyone know if this can be done with items or is this extra variable thing only available to buildings?
#14
Ah, glad it's not anything major then. That'd be annoying if there was some undiagnosed problem lurking around my mods folder just waiting to spring itself at the most inopportune time. The only mods I've installed right now are the "cannons and turrets" mod, the "Embrasures" mod and the "target practice dummy" mod. I've also activated the blast charges one. I'm just adding them in slowly, so I don't have "much" yet. Anyway, with those I don't see any issues so hopefully that'll help narrow it down.

I'm glad you can get some use out the textures too. Since I've already applied the fixes on my end I won't be downloading this particular update, but which door set did you decide to go with?

I had also been thinking of taking a look at the save editor you're working on and seeing if I could help any. Unfortunately I haven't reinstalled Visual Studio since my last hd wipe, and I haven't been able to find the disks with it over the last week or so that I've been poking around. Boo to that :(
#15
Quote from: Neurotoxin on August 15, 2014, 05:09:52 AM
...I wanted to try fixing the texture bug when you enable the mod and start playing right away anyway.

Edit: Not sure there is a fix actually, or it might not be directly related to this mod. It only seems to happen for me to beds and with specific textures. I'll continue investigating.

What problem are you referring too? I didn't notice any texture problems either before or after my fiddling with the few things I mentioned.