[Mod Request] Enhanced Trade Beacon

Started by desert, July 18, 2017, 12:26:37 PM

Previous topic - Next topic

desert

A trade beacon with full-map radius. Accomplished by either creating a new beacon-like structure with a larger radius, or modding the original beacon. Likely involves C#.

For example:

Replace the TradeableCellsAround function in the object Building_OrbitalTradeBeacon with code enabling full-map coverage for the trade beacon.
public static List<IntVec3> TradeableCellsAround(IntVec3 pos, Map map)
{
Building_OrbitalTradeBeacon.tradeableCells.Clear();
if (!pos.InBounds(map))
{
return Building_OrbitalTradeBeacon.tradeableCells;
}
return map.AllCells.ToList();
}


Supplementary edit to the structure XML removing the building radius highlight. In the Core mod Thingsdef_Buildings file "Buildings_Misc.xml", the code enabling radius highlight seems to be:
<placeWorkers>
      <li>PlaceWorker_ShowTradeBeaconRadius</li>
    </placeWorkers>


Reference to this thread.

Sion

Do you want to sell everything everywhere that lies on the map, or only things in your stockpiles?

I think it's better to skip the checks all together and just return a list of all items or your stockpiles only, because I think the game are already tracking those so there are no need to search for them again.
So many ideas... so little time...
Silence is the worst answer.

desert

Quote from: Sion on July 19, 2017, 04:50:08 PM
Do you want to sell everything everywhere that lies on the map, or only things in your stockpiles?

I think it's better to skip the checks all together and just return a list of all items or your stockpiles only, because I think the game are already tracking those so there are no need to search for them again.

I believe the sample code provided in OP will identify every cell on the map as a "tradeable cell", so any valid item in any cell will be listed as tradeable. That is, in the function TradeableCellsAround, the base game checks are replaced with

return map.AllCells.ToList()

desert

GOOD NEWS: A WORKAROUND

PeteTimeSix's QoL Tweaks Pack allows any stockpile to be set as a trading stockpile. Any such designated stockpile will contribute items to orbital trading.

It's not a direct adjustment to trading or structures, but it accomplishes what I want without otherwise interfering (other mod features may be disabled if one wishes).