How to remove luxury and strategic resources with workers mod?

danielcofour

Chieftain
Joined
Jan 25, 2014
Messages
7
Basically what I would like is to make luxury and strategic resources behave like bonus resources, ie. you can build districts atop them and workers can remove them. I'm guessing this should be possible through a mod, but I can't find anything related to this in game files.

Anyone got any ideas?
 
It would appear you would need to redefine the resource as a Bonus resource instead of a luxury or strategic resource.

Control over whether the Harvest Button is available is made in C:\Program Files (x86)\Steam\SteamApps\common\Sid Meier's Civilization VI\Base\Assets\UI\Panels\UnitPanel.lua, and the relevant line appears to be:
Code:
local bCanStart, tResults = UnitManager.CanStartOperation( pUnit, actionHash, nil, true );
"pUnit" is the designation for the individual unit being tested at that time for the available actions to display, and "actionHash" appears to be the ID# for the "operation" from table <UnitOperations> (OperationType="UNITOPERATION_HARVEST_RESOURCE"). It isn't clear as yet what the final boolean argument "true" is for.

The command UnitManager.CanStartCommand(args) is an lua method that appears to ask the game's DLL* whether a specific unit can perform a specified operation at any given plot at any given point within the game. This would appear to be giving 'false' for whether UNITOPERATION_HARVEST_RESOURCE can be performed on luxury and strategic resources, resulting in the action not even being available.

The relevant portion of the UnitPanel.lua looks through all the rows in the table <UnitOperations> and all the rows in the table <UnitCommands> to determine what buttons are available for a given unit at that time.

I haven't tried to chase down whether there is a District Placement lua or whether all the enabling/disabling of Districts is being done directly in the game's DLL.

It would probably be possible to re-write the code within UnitPanel.lua to allow harvesting of luxuries and strategic resources, but this would take some labor, and may cause various sorts of imbalance or non-anticipated results in-game.

* to which we currently have no access

------------------------------------------

A search througth the game's xml files found nothing that specifies RESOURCECLASS_STRATEGIC or RESOURCECLASS_LUXURY cannot be harvested. So the limitation has to be within the game's lua files or directly in the game's DLL.

RESOURCECLASS_LUXURY for example is referenced in several places but is never actually defined anywhere that an AgentRansack search finds within the game's xml files.
 
Last edited:
Thanks for the reply. Yeah, this is way more complicated than it should be. I thought it would come down to a simple XML edit, but apparently not.

Thanks again, but I'm not going to go into this.
 
actually its pretty easy.

Base game file "Resources.xml" only has:

Code:
    <Resource_Harvests>
        <!--Bonus -->
        <Row ResourceType="RESOURCE_BANANAS" YieldType="YIELD_FOOD" Amount="25" PrereqTech="TECH_IRRIGATION"/>
        <Row ResourceType="RESOURCE_CATTLE" YieldType="YIELD_FOOD" Amount="25" PrereqTech="TECH_ANIMAL_HUSBANDRY"/>
        <Row ResourceType="RESOURCE_COPPER" YieldType="YIELD_GOLD" Amount="50" PrereqTech="TECH_MINING"/>
        <Row ResourceType="RESOURCE_CRABS" YieldType="YIELD_GOLD" Amount="50" PrereqTech="TECH_CELESTIAL_NAVIGATION"/>
        <Row ResourceType="RESOURCE_DEER" YieldType="YIELD_PRODUCTION" Amount="25" PrereqTech="TECH_ANIMAL_HUSBANDRY"/>
        <Row ResourceType="RESOURCE_FISH" YieldType="YIELD_FOOD" Amount="25" PrereqTech="TECH_CELESTIAL_NAVIGATION"/>
        <Row ResourceType="RESOURCE_RICE" YieldType="YIELD_FOOD" Amount="25" PrereqTech="TECH_POTTERY"/>
        <Row ResourceType="RESOURCE_SHEEP" YieldType="YIELD_FOOD" Amount="25" PrereqTech="TECH_ANIMAL_HUSBANDRY"/>
        <Row ResourceType="RESOURCE_STONE" YieldType="YIELD_PRODUCTION" Amount="25" PrereqTech="TECH_MASONRY"/>
        <Row ResourceType="RESOURCE_WHEAT" YieldType="YIELD_FOOD" Amount="25" PrereqTech="TECH_POTTERY"/>
    </Resource_Harvests>

I just added things like:

Code:
        <!--Luxury -->
        <Row ResourceType="RESOURCE_WHALES" YieldType="YIELD_GOLD" Amount="50" PrereqTech="TECH_CELESTIAL_NAVIGATION"/>
        <!-- Strategic -->
        <Row ResourceType="RESOURCE_ALUMINUM" YieldType="YIELD_GOLD" Amount="50" PrereqTech="TECH_ADVANCED_FLIGHT"/>
        <Row ResourceType="RESOURCE_COAL" YieldType="YIELD_GOLD" Amount="50" PrereqTech="TECH_STEAM_POWER"/>
        <Row ResourceType="RESOURCE_HORSES" YieldType="YIELD_GOLD" Amount="50" PrereqTech="TECH_ANIMAL_HUSBANDRY"/>
        <Row ResourceType="RESOURCE_IRON" YieldType="YIELD_GOLD" Amount="50" PrereqTech="TECH_BRONZE_WORKING"/>
        <Row ResourceType="RESOURCE_NITER" YieldType="YIELD_GOLD" Amount="50" PrereqTech="TECH_GUNPOWDER"/>
        <Row ResourceType="RESOURCE_OIL" YieldType="YIELD_GOLD" Amount="50" PrereqTech="TECH_COMBUSTION"/>
        <Row ResourceType="RESOURCE_URANIUM" YieldType="YIELD_GOLD" Amount="50" PrereqTech="TECH_NUCLEAR_FISSION"/>

so resources I wanna harvest can be harvested. You can change the yield type to whatever you want be it food, gold, production, faith, culture or science. You can also set the required tech for the resource to be harvested.
 
Last edited:
Ctrl+F "harvest" did it for me. lol

Thanks a lot (note to self: pay more attention next time). I do have a question though: I assume you've tried this one out, have you encountered anything weird related to this, specifically regarding the AI? Have they done something stupid with it, like remove all of their strategic resources and replace them with farms, for instance?
 
I've added all of the luxury and stratetic resources. I'm not entirely sure about the values and tech requirements, but they seem reasonable enough.

Code:
    <Resource_Harvests>
       <!-- Bonus -->
       <Row ResourceType="RESOURCE_BANANAS"        YieldType="YIELD_FOOD"       Amount="25" PrereqTech="TECH_IRRIGATION"/>
       <Row ResourceType="RESOURCE_CATTLE"         YieldType="YIELD_FOOD"       Amount="25" PrereqTech="TECH_ANIMAL_HUSBANDRY"/>
       <Row ResourceType="RESOURCE_COPPER"         YieldType="YIELD_GOLD"       Amount="50" PrereqTech="TECH_MINING"/>
       <Row ResourceType="RESOURCE_CRABS"          YieldType="YIELD_GOLD"       Amount="50" PrereqTech="TECH_CELESTIAL_NAVIGATION"/>
       <Row ResourceType="RESOURCE_DEER"           YieldType="YIELD_PRODUCTION" Amount="25" PrereqTech="TECH_ANIMAL_HUSBANDRY"/>
       <Row ResourceType="RESOURCE_FISH"           YieldType="YIELD_FOOD"       Amount="25" PrereqTech="TECH_CELESTIAL_NAVIGATION"/>
       <Row ResourceType="RESOURCE_RICE"           YieldType="YIELD_FOOD"       Amount="25" PrereqTech="TECH_POTTERY"/>
       <Row ResourceType="RESOURCE_SHEEP"          YieldType="YIELD_FOOD"       Amount="25" PrereqTech="TECH_ANIMAL_HUSBANDRY"/>
       <Row ResourceType="RESOURCE_STONE"          YieldType="YIELD_PRODUCTION" Amount="25" PrereqTech="TECH_MASONRY"/>
       <Row ResourceType="RESOURCE_WHEAT"          YieldType="YIELD_FOOD"       Amount="25" PrereqTech="TECH_POTTERY"/>
       <!--Luxury -->
       <Row ResourceType="RESOURCE_CITRUS"         YieldType="YIELD_FOOD"       Amount="50" PrereqTech="TECH_IRRIGATION"/>
       <Row ResourceType="RESOURCE_COCOA"          YieldType="YIELD_FOOD"       Amount="50" PrereqTech="TECH_IRRIGATION"/>
       <Row ResourceType="RESOURCE_COFFEE"         YieldType="YIELD_FOOD"       Amount="50" PrereqTech="TECH_IRRIGATION"/>
       <Row ResourceType="RESOURCE_COTTON"         YieldType="YIELD_GOLD"       Amount="50" PrereqTech="TECH_IRRIGATION"/>
       <Row ResourceType="RESOURCE_DIAMONDS"       YieldType="YIELD_GOLD"       Amount="50" PrereqTech="TECH_MINING"/>
       <Row ResourceType="RESOURCE_DYES"           YieldType="YIELD_GOLD"       Amount="50" PrereqTech="TECH_POTTERY"/>
       <Row ResourceType="RESOURCE_FURS"           YieldType="YIELD_GOLD"       Amount="50" PrereqTech="TECH_ANIMAL_HUSBANDRY"/>
       <Row ResourceType="RESOURCE_GYPSUM"         YieldType="YIELD_PRODUCTION" Amount="50" PrereqTech="TECH_MASONRY"/>
       <Row ResourceType="RESOURCE_INCENSE"        YieldType="YIELD_GOLD"       Amount="50" PrereqTech="TECH_POTTERY"/>
       <Row ResourceType="RESOURCE_IVORY"          YieldType="YIELD_GOLD"       Amount="50" PrereqTech="TECH_ANIMAL_HUSBANDRY"/>
       <Row ResourceType="RESOURCE_JADE"           YieldType="YIELD_GOLD"       Amount="50" PrereqTech="TECH_MINING"/>
       <Row ResourceType="RESOURCE_MARBLE"         YieldType="YIELD_GOLD"       Amount="50" PrereqTech="TECH_MINING"/>
       <Row ResourceType="RESOURCE_MERCURY"        YieldType="YIELD_PRODUCTION" Amount="50" PrereqTech="TECH_MINING"/>
       <Row ResourceType="RESOURCE_PEARLS"         YieldType="YIELD_GOLD"       Amount="50" PrereqTech="TECH_CELESTIAL_NAVIGATION"/>
       <Row ResourceType="RESOURCE_SALT"           YieldType="YIELD_GOLD"       Amount="50" PrereqTech="TECH_MINING"/>
       <Row ResourceType="RESOURCE_SILK"           YieldType="YIELD_GOLD"       Amount="50" PrereqTech="TECH_ANIMAL_HUSBANDRY"/>
       <Row ResourceType="RESOURCE_SILVER"         YieldType="YIELD_GOLD"       Amount="50" PrereqTech="TECH_MINING"/>
       <Row ResourceType="RESOURCE_SPICES"         YieldType="YIELD_GOLD"       Amount="50" PrereqTech="TECH_POTTERY"/>
       <Row ResourceType="RESOURCE_SUGAR"          YieldType="YIELD_FOOD"       Amount="50" PrereqTech="TECH_IRRIGATION"/>
       <Row ResourceType="RESOURCE_TEA"            YieldType="YIELD_FOOD"       Amount="50" PrereqTech="TECH_IRRIGATION"/>
       <Row ResourceType="RESOURCE_TOBACCO"        YieldType="YIELD_GOLD"       Amount="50" PrereqTech="TECH_IRRIGATION"/>
       <Row ResourceType="RESOURCE_TRUFFLES"       YieldType="YIELD_GOLD"       Amount="50" PrereqTech="TECH_ANIMAL_HUSBANDRY"/>
       <Row ResourceType="RESOURCE_WHALES"         YieldType="YIELD_FOOD"       Amount="50" PrereqTech="TECH_CELESTIAL_NAVIGATION"/>
       <Row ResourceType="RESOURCE_WINE"           YieldType="YIELD_FOOD"       Amount="50" PrereqTech="TECH_IRRIGATION"/>
       <!-- Strategic -->
       <Row ResourceType="RESOURCE_ALUMINUM"       YieldType="YIELD_PRODUCTION" Amount="50" PrereqTech="TECH_MINING"/>
       <Row ResourceType="RESOURCE_COAL"           YieldType="YIELD_PRODUCTION" Amount="50" PrereqTech="TECH_MINING"/>
       <Row ResourceType="RESOURCE_HORSES"         YieldType="YIELD_FOOD"       Amount="50" PrereqTech="TECH_ANIMAL_HUSBANDRY"/>
       <Row ResourceType="RESOURCE_IRON"           YieldType="YIELD_PRODUCTION" Amount="50" PrereqTech="TECH_MINING"/>
       <Row ResourceType="RESOURCE_NITER"          YieldType="YIELD_PRODUCTION" Amount="50" PrereqTech="TECH_MINING"/>
       <Row ResourceType="RESOURCE_OIL"            YieldType="YIELD_PRODUCTION" Amount="50" PrereqTech="TECH_MINING"/>
       <Row ResourceType="RESOURCE_URANIUM"        YieldType="YIELD_PRODUCTION" Amount="50" PrereqTech="TECH_MINING"/>
       <Row ResourceType="RESOURCE_ANTIQUITY_SITE" YieldType="YIELD_GOLD"       Amount="50" PrereqTech="TECH_MINING"/>
       <Row ResourceType="RESOURCE_SHIPWRECK"      YieldType="YIELD_GOLD"       Amount="50" PrereqTech="TECH_CELESTIAL_NAVIGATION"/>
   </Resource_Harvests>
 
Thanks a lot (note to self: pay more attention next time). I do have a question though: I assume you've tried this one out, have you encountered anything weird related to this, specifically regarding the AI? Have they done something stupid with it, like remove all of their strategic resources and replace them with farms, for instance?

Was kinda expecting them to do it though but have never seen them do it.
 
Top Bottom