[Help] How to increase Orbital Trade Beacon radius?

Started by Tyolan, March 06, 2017, 02:26:30 PM

Previous topic - Next topic

Tyolan

I would like to create a small mod to increase a little the Orbital Trade Beacon radius. I know the beacon information are in "Buildings_Misc.xml" but i can't find a way to change the radius. The only attribute linked to the radius seems to be "PlaceWorker_ShowTradeBeaconRadius". But i don't know how to change it.

Any suggestion? Thx a lot.

RawCode


Tyolan

<ThingDef ParentName="BuildingBase">
    <defName>OrbitalTradeBeacon</defName>
    <label>orbital trade beacon</label>
    <thingClass>Building_OrbitalTradeBeacon</thingClass>
    <graphicData>
      <texPath>Things/Building/Misc/DropBeacon</texPath>
      <graphicClass>Graphic_Single</graphicClass>
      <shadowData>
        <volume>(0.3, 0.4, 0.3)</volume>
        <offset>(0,0,-0.1)</offset>
      </shadowData>
      <damageData>
        <rect>(0.2,0.2,0.6,0.6)</rect>
      </damageData>
    </graphicData>
    <altitudeLayer>Building</altitudeLayer>
    <statBases>
      <MaxHitPoints>75</MaxHitPoints>
      <WorkToBuild>1300</WorkToBuild>
      <Flammability>1.0</Flammability>
    </statBases>
    <description>Required for orbital trading. You can only sell goods that are near an orbital trade beacon. Can be placed indoors.</description>
    <drawerType>MapMeshAndRealTime</drawerType>
    <drawPlaceWorkersWhileSelected>true</drawPlaceWorkersWhileSelected>
    <fillPercent>0.15</fillPercent>
    <costList>
      <Steel>50</Steel>
      <Component>1</Component>
    </costList>
    <comps>
      <li Class="CompProperties_Power">
        <compClass>CompPowerTrader</compClass>
        <basePowerConsumption>40</basePowerConsumption>
        <shortCircuitInRain>false</shortCircuitInRain>
      </li>
      <li Class="CompProperties_Flickable"/>
      <li Class="CompProperties_Breakdownable"/>
    </comps>
<building>
<ai_chillDestination>false</ai_chillDestination>
</building>
    <leaveResourcesWhenKilled>false</leaveResourcesWhenKilled>
    <pathCost>8</pathCost>
    <designationCategory>Misc</designationCategory>
    <rotatable>false</rotatable>
    <placeWorkers>
      <li>PlaceWorker_ShowTradeBeaconRadius</li>
    </placeWorkers>
    <designationHotKey>Misc2</designationHotKey>
    <researchPrerequisites>
      <li>MicroelectronicsBasics</li>
    </researchPrerequisites>
  </ThingDef>

RawCode

sadly, it's hardcoded, you need code injection to change area of beacon, custom placement worker won't have any effect.

if (current.InHorDistOf(pos, 7.9f))
{
Building_OrbitalTradeBeacon.tradeableCells.Add(current);
}

Tyolan

So i need to learn how to do a code injection with a dll? I have some skills in programming, do you think it will be hard?

RawCode

get harmony from tools section and read its documentation.
you will need dnspy and notepad++ anyway, also you will need knowledge of c# reflection.