-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attempt at generic factory furniture (consume/produce) #1084
Attempt at generic factory furniture (consume/produce) #1084
Conversation
…ontext menu fix, load/save
fi.PossibleProductions = new System.Collections.Generic.List<FactoryInfo.ProductionChain>(); | ||
//fi.InputSlots = new List<FactoryInfo.IntVector2>() { new FactoryInfo.IntVector2(1, 0) }; | ||
//fi.OutputSlots = new List<FactoryInfo.IntVector2>() { new FactoryInfo.IntVector2(2, 0) }; | ||
var chain1 = new FactoryInfo.ProductionChain() { Name="Iron smelting", ProcessingTime = 4.0f }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test file doesn't look formatted according to the rules in the CONTRIBUTING.md file. It's pretty hard to read.
+1 on adding Copper, but that could probably have been added in a small separate PR which I'd taken in a heartbeat. In general I like the consume/produce pattern. This looks like a pretty good improvement to the current way of doing conversions on top of that. |
@dusho this PR has some conflicts, please fix them |
|
||
<JobSpotOffset X="1" Y="0" /> | ||
|
||
<FactoryInfo> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your xml has a mix of spaces and tabs, pick one or the other :)
…ess and power cell, context menu action on furniture still not working...
…ext menu still doesn't work as expected
new commit, got rid of that partial class.. factory overall renamed to workshop.. to have class FurnitureWorkshop (instead of FurnitureFactory that can be confused with design pattern) |
merged with upstream |
…the broken localization on furniture description
<?xml version="1.0" encoding="utf-8"?> | ||
<Sprites> | ||
<Sprite name="Raw Copper" x="0" y="0" w="1" h="1" pixelPerUnit="64" /> | ||
</Sprites> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add one line at the end
|
WorkshopMenuActions.Add(new WorkshopContextMenu() | ||
{ | ||
ProductionChainName = prodChainName, | ||
Function = (furn, prod) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think more readable would be change lambda by simple method. ->
WorkshopMenuActions.Add(new WorkshopContextMenu
{
ProductionChainName = chain.Name,
Function = ChangeCurrentProductionChain
});
and
private static void ChangeCurrentProductionChain(Furniture furniture, string productName)
{
Parameter currentProdaction = furniture.Parameters[CUR_PRODUCTION_CHAIN_PARAM_NAME];
bool isNotProcessing = furniture.Parameters[CUR_PROCESSED_INV_PARAM_NAME].ToInt() == 0;
// if selected production really changes and nothing is being processed now
if (productName.Equals(currentProdaction.Value) || !isNotProcessing)
{
return;
}
furniture.CancelJobs();
furniture.Parameters[CUR_PRODUCTION_CHAIN_PARAM_NAME].SetValue(productName);
}
incorporated comments from Grenkin1988 (thanks for great review!) |
You removed |
sorry.. forgot to add newly created file. fixed |
This branch has conflicts that must be resolved |
This branch break something, the character do not find job anymore: do not happen on master:
|
can you describe the testcase? cause nothing different should happen for existing furniture (as it uses LUA code for update). But new code kicks in only for power cell press.. and metal furnace + there is trick with furnace that you have to pick what to smelt there in context menu (right click) , iron ore -> iron plate, copper ore -> copper plate |
@dusho, I just tried it again. The test case is: start the game, open the unity console and check the console :) The character stay stuck at the center tile and never does anything |
Sorry, my bad, I'm silly, we have to order them to mine now, they won't stockpile ore by themself. This is confusing |
well actually something is indeed broken.. in my branch they are not picking the ice at all.. in master it works - it's beeing stockpiled |
@@ -1,9 +1,9 @@ | |||
<?xml version="1.0" encoding="utf-8" ?> | |||
<Inventories> | |||
<Inventory type="Raw Iron" maxStackSize="50" basePrice="0.8" category="inv_cat_raw"/> | |||
<Inventory type="Ice" maxStackSize="10" basePrice="1.2" category="inv_cat_raw"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this may be the issue about ice? just quick reading
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ye.. wish I saw your comment sooner :)
ok fixed.. ice got removed from inventory.xml somehow |
Working in generic consume/produce (discussed in #604)
Can do:
There is new temporary Metal Furnace (that works as Metal Smelter) just to try things out. Idea is to get rid of most of repeated code in LUA for furniture that consumes and produces something
New art for Power cell press, input: 3x uranium, 2x steel plate, output: 1x power cell