Upgradeable stuff?

Started by picollo, July 09, 2015, 10:30:26 AM

Previous topic - Next topic

picollo

I was wondering if It is possibile to make upgradeable items, which would get better via researching technologies.

Let's take batteries for example.

Basic battery: Stores up to X power (dont remember exact numbers).

Research: Better batteries I: Batteries store 5% more power. with same cost.

What I've been thinking is to create late game techs, which you could research multiple times to slightly improve capacity of your buildings.
Research Better Batteries X 10 times, and each battery will have 50% bigger storage capacity.

Something similar is done with turrets, when you increase number of bullets turret shots in one burst.

I know I could create additional battery for each technology, but having 10 batteries, 10 solar panels, etc. could be a little bit irritating.

Lonely Rogue

Turrets do it, with gun turret cooling. Take a look at the coding for that.
Rimworld: A game where you're kept as entertainment for thousand year old robots, and you just don't know it yet.
Any mod requests?

skullywag

its called a researchmod, the gun turret cooling one looks like:


using System;
using System.Linq;
namespace Verse
{
public static class ResearchModsSpecial
{
  public static void GunTurretCooling()
  {
  (
  from x in DefDatabase<ThingDef>.GetNamed("Gun_TurretImprovised", true).Verbs
  where x.isPrimary
  select x).First<VerbProperties>().burstShotCount = 4;
  }
  }
}



<ResearchProjectDef>
<defName>GunTurretCooling</defName>
<label>gun turret cooling</label>
<description>Gun turrets fire four shots in a burst instead of three.</description>
<totalCost>1000</totalCost>
    <researchMods>
      <li>
        <specialAction>ResearchModsSpecial.GunTurretCooling</specialAction>
      </li>
    </researchMods>
</ResearchProjectDef>


The code (and the classname) can be whatever you want, for any c# people, dont use researcmodspecial use a different classname and reference it in the xml to avoid conflicts.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

picollo

DDawgSierra- I know turret coolikg does similar stuff. However I was in work, and just got an idea of it, and couldn't look at the code. Despite that my coding skill is quite low. SO any hint like  skullywag gave me will increase my work like 10 times.


Skullywag, Thanks for clarification.
I'll look at this code, and try to do some basic work.

If I wanted to decrease amount of coding, can I set (in this case) number of shots as variable, and use one function for multiple technologies?

Something like:
using System;
using System.Linq;
namespace Verse

{
public static class ResearchModsSpecial
{
  public static void GunTurretCooling( int ShotNumber)
  {
                           
  (
  from x in DefDatabase<ThingDef>.GetNamed("Gun_TurretImprovised", true).Verbs
  where x.isPrimary
  select x).First<VerbProperties>().burstShotCount = ShotNumber;
  }
  }
}



<ResearchProjectDef>
<defName>GunTurretCooling</defName>
<label>gun turret cooling</label>
<description>Gun turrets fire four shots in a burst instead of three.</description>
<totalCost>1000</totalCost>
    <researchMods>
      <li>
        <specialAction>ResearchModsSpecial.GunTurretCooling(4)</specialAction>
      </li>
    </researchMods>
</ResearchProjectDef>
<ResearchProjectDef>
<defName>GunTurretCooling</defName>
<label>gun turret cooling</label>
<description>Gun turrets fire five shots in a burst instead of four.</description>
<totalCost>1000</totalCost>
    <researchMods>
      <li>
        <specialAction>ResearchModsSpecial.GunTurretCooling(5)</specialAction>
      </li>
    </researchMods>
</ResearchProjectDef>


I know that it probably is buggy as hell, bbut you should get idea of my concept. This solution should reduce code amount, and in addition make this mod more customisable.

skullywag

Hmm not sure, best thing is to just try it.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

picollo

Definetely will do!

Thanks anyway.

Lonely Rogue

I was just trying to be helpful. I'm not the best modder in the world, I was trying to point out something you would find helpful. *feels miffed*
Rimworld: A game where you're kept as entertainment for thousand year old robots, and you just don't know it yet.
Any mod requests?

DaemonDeathAngel

Look at Superior Crafting. It upgrades battery efficiency with each research tier within Power.

picollo

Ahh, so it was already done :)
Superior Crafting overwhelemd me with too heavy changes, so I haven't ever looked for details of this mod. Thanks for the hint!

DaemonDeathAngel

No problem. I have been talking to the mod maker of Superior Crafting lately, and you think it's overwhelming now, it's going to be insane when he's done.

picollo

Just when I checked this mod it's complete overhaul of whole game. With (as for me) too much of crafting things which are used to craft other things which will  be used to craft components to some usefull stuff. Chain of production like in Settlers or Knights and Merchants. And I appreciate simplicity of crafting in vanilla Rimworld.