Rimworldで松屋Mod作成したよ
きっかけ
なんで作ろうと思ったかわかんないけど、機運?
仕様
松屋Modは牛めしだけ追加して松屋Modって名乗っていいのかって思ったら、専用コンロも作ったほうがいい気がしてきた
— めびうす (@catina013) 2017年10月8日
ただ飯画像と名前置換するだけじゃ芸がないので専用のワークテーブルを作ってそこでのみ作らせるようにしてみた。
基本的には手の込んだ料理や贅沢な料理を改変するのだけど 素材効率や満腹値(?)を良くする代わりに、ワークテーブルの作成コストと維持コストを上げてみた。
必要な要素の抜き出し
電気コンロと手の込んだ料理、贅沢な料理その他関連するxmlを引っこ抜きます。
何が必要かは作ろうとしてるものに近いModをワークショップで落してきて分析するのもいいと思います。
Coreから探してくる
検索欄をファイル内も探すように設定して”food”で検索。
するとCoreファイル直下からファイル名、もしくはファイル内に”food”とついたファイルが全てピックアップされます。
そんなかからいるモノ要らないものを精査して、要るモノのフォルダ階層をこれから作るModのフォルダに作っていきます(本当は作らなくてもいいけど後から見やすいので作ってる)
必要ファイル
既存のModやCore内のファイルを調べた結果、今回の仕様で必要なファイル構成は以下の様になりました。
MatsuyaFood About いつもの Defs RecipeDefs Recipes_Meals.xml ThingDefs_Buildings Buildings_Production.xml ThingDefs_Items Items_Food.xml WorkGiver WorkGivers.xml Textures 割愛
中身乗っけながら簡単に解説してきます。
Recipes_Meals.xml
後述するBuildings_Production.xmlのなかのMatsuyaKitchenで作れるレシピの参照先になります。
ここでは牛めしとPremiamu牛めしのレシピを記述します。
<?xml version="1.0" encoding="utf-8" ?> <RecipeDefs> <RecipeDef ParentName="CookMealBase"> <defName>gyumeshi</defName> <label>牛めし</label> <description>松屋の定番!ぜひ一度お試しください!</description> <jobString>Cooking fine meal.</jobString> <workSpeedStat>CookSpeed</workSpeedStat> <effectWorking>Cook</effectWorking> <soundWorking>Recipe_CookMeal</soundWorking> <allowMixingIngredients>true</allowMixingIngredients> <ingredientValueGetterClass>IngredientValueGetter_Nutrition</ingredientValueGetterClass> <ingredients> <li> <filter> <categories> <li>MeatRaw</li> <li>AnimalProductRaw</li> </categories> </filter> <count>0.2</count> </li> <li> <filter> <categories> <li>PlantFoodRaw</li> </categories> </filter> <count>0.2</count> </li> </ingredients> <products> <MealFine>2</MealFine> </products> <skillRequirements> <li> <skill>Cooking</skill> <minLevel>4</minLevel> </li> </skillRequirements> </RecipeDef> <RecipeDef ParentName="CookMealBase"> <defName>premiamugyumeshi</defName> <label>premiamu牛めし</label> <description>これまでの旨さから、別次元の旨さへ</description> <jobString>Cooking lavish meal.</jobString> <workSpeedStat>CookSpeed</workSpeedStat> <effectWorking>Cook</effectWorking> <soundWorking>Recipe_CookMeal</soundWorking> <allowMixingIngredients>true</allowMixingIngredients> <ingredientValueGetterClass>IngredientValueGetter_Nutrition</ingredientValueGetterClass> <ingredients> <li> <filter> <categories> <li>MeatRaw</li> <li>AnimalProductRaw</li> </categories> </filter> <count>0.5</count> </li> <li> <filter> <categories> <li>PlantFoodRaw</li> </categories> </filter> <count>0.5</count> </li> </ingredients> <products> <MealLavish>2</MealLavish> </products> <skillRequirements> <li> <skill>Cooking</skill> <minLevel>8</minLevel> </li> </skillRequirements> </RecipeDef> </RecipeDefs>
単語を和訳するだけでも大体どのタグが何を指してるかわかると思います。
レシピ時に必要スキルレベルとか原材料等を指定します。フィルターもあるので肉や野菜の細かな指定から肉ならなんでもみたいな大雑把な指定まで出来るみたいです。たぶん。
Buildings_Production.xml
MatsuyaKitchenの作り方とそのキッチンの性能、作れるレシピを指定するファイルです。
<?xml version="1.0" encoding="utf-8" ?> <ThingDefs> <ThingDef ParentName="BenchBase"> <defName>MatsuyaKitchen</defName> <label>松屋キッチン</label> <ThingClass>Building_WorkTable_HeatPush</ThingClass> <Description>充実したラインナップでお客様の軒高と豊かな食生活を応援します。</Description> <graphicData> <texPath>Things/Building/Production/MatsuyaKitchen</texPath> <graphicClass>Graphic_Multi</graphicClass> <drawSize>(3.5,1.5)</drawSize> <damageData> <cornerTL>Damage/Corner</cornerTL> <cornerTR>Damage/Corner</cornerTR> <cornerBL>Damage/Corner</cornerBL> <cornerBR>Damage/Corner</cornerBR> </damageData> </graphicData> <constructEffect>ConstructMetal</constructEffect> <CostList> <Steel>200</Steel> <Component>20</Component> </CostList> <AltitudeLayer>Building</AltitudeLayer> <fillPercent>0.5</fillPercent> <useHitPoints>True</useHitPoints> <statBases> <WorkToBuild>3000</WorkToBuild> <MaxHitPoints>180</MaxHitPoints> <Flammability>1.0</Flammability> </statBases> <Size>(3,1)</Size> <DesignationCategory>Production</DesignationCategory> <Passability>PassThroughOnly</Passability> <pathCost>70</pathCost> <hasInteractionCell>True</hasInteractionCell> <interactionCellOffset>(0,0,-1)</interactionCellOffset> <surfaceType>Item</surfaceType> <recipes> <li>gyumeshi</li> <li>premiamugyumeshi</li> </recipes> <inspectorTabs> <li>ITab_Bills</li> </inspectorTabs> <comps> <li Class="CompProperties_Power"> <compClass>CompPowerTrader</compClass> <startElectricalFires>true</startElectricalFires> <basePowerConsumption>500</basePowerConsumption> </li> <li Class="CompProperties_Flickable"/> <li Class="CompProperties_Breakdownable"/> </comps> <building> <isMealSource>true</isMealSource> <spawnedConceptLearnOpportunity>BillsTab</spawnedConceptLearnOpportunity> <heatPerTickWhileWorking>0.10</heatPerTickWhileWorking> </building> <designationHotKey>Misc8</designationHotKey> <researchPrerequisites> <li>Electricity</li> </researchPrerequisites> </ThingDef> </ThingDefs>
作成コストから作れるレシピ、消費電力なんかを指定します。
ここの作成コストで間違ったレシピを指定した場合、ゲーム内でこのテーブル作成すると進行不可なバグ出るので注意
Items_Food.xml
牛めしの基本情報が設定されるファイルです。牛めしが出来る前はレシピ、出来た後はこれを参照されます。
<?xml version="1.0" encoding="utf-8" ?> <ThingDefs> <ThingDef ParentName="MealRottable"> <defName>gyumeshi</defName> <label>牛めし</label> <description>松屋の定番!ぜひ一度お試しください!</description> <graphicData> <texPath>Things/Item/Meal/gyumeshi</texPath> <graphicClass>Graphic_Single</graphicClass> </graphicData> <statBases> <MarketValue>24</MarketValue> <WorkToMake>200</WorkToMake> </statBases> <ingestible> <preferability>MealFine</preferability> <tasteThought>AteFineMeal</tasteThought> <nutrition>0.90</nutrition> <ingestEffect>EatVegetarian</ingestEffect> <ingestSound>Meal_Eat</ingestSound> </ingestible> </ThingDef> <ThingDef ParentName="MealRottable"> <defName>premiamugyumeshi</defName> <label>premiamu 牛めし</label> <description>これまでの旨さから、別次元の旨さへ</description> <graphicData> <texPath>Things/Item/Meal/gyumeshi</texPath> <graphicClass>Graphic_Single</graphicClass> </graphicData> <statBases> <MarketValue>30</MarketValue> <WorkToMake>300</WorkToMake> </statBases> <ingestible> <preferability>MealLavish</preferability> <tasteThought>AteLavishMeal</tasteThought> <nutrition>1.00</nutrition> <ingestEffect>EatVegetarian</ingestEffect> <ingestSound>Meal_Eat</ingestSound> </ingestible> </ThingDef> </ThingDefs>
Premiamu牛めしも同じテクスチャ使ってるのはご愛敬
WorkGivers.xml
今回で一番のひっかけ問題がここ。
作ったワークテーブルで料理作ってもらうためにはここに記入したほうがよいみたい。(正確なこのファイルの挙動がわかってない)
<?xml version="1.0" encoding="utf-8" ?> <WorkGivers> <WorkGiverDef> <defName>DoBillsCookMatsuyaKitchen</defName> <label>みんなの食卓でありたい。松屋</label> <giverClass>WorkGiver_DoBill</giverClass> <workType>Cooking</workType> <priorityInType>80</priorityInType> <fixedBillGiverDefs> <li>MatsuyaKitchen</li> </fixedBillGiverDefs> <verb>cook</verb> <gerund>cooking at</gerund> <requiredCapacities> <li>Manipulation</li> </requiredCapacities> <prioritizeSustains>true</prioritizeSustains> </WorkGiverDef> </WorkGivers>
MatsuyaKitchenでどのタイプのジョブをさせるかとかたぶんそういうものが記述されているはず。
テクスチャの追加
— 氏子クロニクル (@toshi_a) 2017年10月13日
わざわざ撮ってくれたとしぁさんに感謝。
これを適当にチョチョって64*64の透過pngに変換して完成。
あと適当に松屋っぽさを感じさせるワークテーブルの画像を挿入したら出来上がり。