[Help] Trying to get the burst upgrade working for a new turret.

Started by Ironhierro, July 28, 2014, 02:24:43 AM

Previous topic - Next topic

Ironhierro

I've just started playing with C#; I did enough INI editing back in the day that XML isn't that scary but C, I'm having troubles with.

Not quite sure what I've done wrong; this is the assembly, did I screw something obvious up that I'm just not seeing? I can upload the XML / C# source file as well if that'll help. Thanks.

The Output Log gave me this: 'Could not resolve cross-reference: No Verse.ResearchProjectDef named MinigunTurret found to give to Verse.ThingDef MinigunTurretGun'


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

using UnityEngine; // Always needed
using RimWorld; // Needed
using Verse; // Needed

namespace Verse
{
    public static class ResearchModsSpecial1
    {
        public static void ElectricLoading()
        {
            DefDatabase<ThingDef>.GetNamed("Gun_MinigunTurret").verb.burstShotCount = 7;
        }
    }
}

Haplo

Quote from: Ironhierro on July 28, 2014, 02:24:43 AM
The Output Log gave me this: 'Could not resolve cross-reference: No Verse.ResearchProjectDef named MinigunTurret found to give to Verse.ThingDef MinigunTurretGun'

I would say this means, that you have added a research named 'MinigunTurret' in your XML file, but you didn't make an XML for the ResearchDefs itself.

Quote from: Ironhierro on July 28, 2014, 02:24:43 AM
namespace Verse
{
    public static class ResearchModsSpecial1
    {
...

Personally I wouldn't use the Namespace Verse. Use your own Namespace like 'ModXYZ'. Then in your XML use ModXYZ.ClassName to define it.
But normally this isn't really a problem as long as you do not use a name of the original source and overwrite it.. 

I think you want to call this code sometimes by some other code?
Right now you have nothing that calls it.
So for now it is only some dead code. Never to be used..

If you want to use it in your XML you need to integrate the base. Something like this:

public class ResearchModsSpecial : Equipment
{