Jump to content

builder component doesn't check for mimicked equipped items that affect crafting (i.e. discount from Green Amulet)


hoxi
  • Pending

Either of these functions could check for it:

local materials, discounted = self:GetIngredients(recname)
if self:CheckIngredientsForMimic(materials) then
	return false, "ITEMMIMIC"
end

Depends on if you care about triggering the mimic and cancelling the action only if the craft would've been discounted and the mimicked item would be used, or doing so on any build action.

 

Here's an example of how it could be done:

-- check_ingredientmod should be defined by discounted
-- that is if you care about only triggering the mimic then, otherwise always check for it
function Builder:CheckIngredientsForMimic(ingredients, check_ingredientmod)
    if check_ingredientmod then
        -- check for equipped mimic item that can affect crafting here
        -- then run item.components.itemmimic:TurnEvil and return true
    end

    for _, ents in pairs(ingredients) do
        for item in pairs(ents) do
            if item.components.itemmimic then
                item.components.itemmimic:TurnEvil(self.inst)
                return true
            end
        end
    end

    return false
end

-- in functions like DoBuild
local materials, discounted = self:GetIngredients(recname)
if self:CheckIngredientsForMimic(materials, discounted) then
	return false, "ITEMMIMIC"
end

 

Just keep in mind that there's currently some issues that were reported here that should also be fixed.


Steps to Reproduce
  • Craft an item that would get discounted while wearing a mimicked green amulet.
  • Notice how you'll be able to, then the mimic will trigger afterwards.
  • Compare trying to craft something with a mimicked ingredient, and notice that you won't be able to.



User Feedback


There are no comments to display.



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...