Jump to content

[WITH SOLUTION] Fake crafting action with recipes containing livinglog


LaoWang27
  • Fixed

Simple to understand and reproduce:

livinglog-bug-1.gif.80323e2fe272265f5faa6c4112762520.gif

When crafting an item, if the living log is among recipe ingredients, character will perform fake client "dolongaction".

 

livinglog-bug-2.gif.4739498ef3be486cbda1f77d678312d3.gif

An adequate crafting ingredients will not cause this bug.

 

Why?

Livinglog is a valid recipe in game which can be crafting by player health. However, this recipe is only available for Wormwood.

But the function widgetutil.lua@DoRecipeClick() failed to consider about this.

So when a player lacks a living log, he will try to crafting the living log by consuming his health. (but it's Wormwood exclusive!!!)

 

Solution to fix:

File widgetutil.lua line 127-146

else
                    -- check if we can craft sub ingredients
                    for i, ing in ipairs(recipe.ingredients) do
                        local ing_recipe = GetValidRecipe(ing.type)
                        if ing_recipe ~= nil
                            and not owner.replica.inventory:Has(ing.type, math.max(1, RoundBiasedUp(ing.amount * owner.replica.builder:IngredientMod())), true)
                            and (owner.replica.builder:KnowsRecipe(ing_recipe) or CanPrototypeRecipe(ing_recipe.level, tech_level)) and owner.replica.builder:HasIngredients(ing_recipe) then
                            owner.replica.builder:MakeRecipeFromMenu(recipe, skin) -- tell the server to build the current recipe, not the ingredient
                            return true
                        end
                    end

                    return true, "NO_INGREDIENTS"
                end
            else
                return true, recipe.nounlock and "NO_STATION" or "NO_TECH"
            end
        end
    end
end

change to

else
					-- check if we can craft sub ingredients
					for i, ing in ipairs(recipe.ingredients) do
						local ing_recipe = GetValidRecipe(ing.type)
						if ing_recipe ~= nil
							and not owner.replica.inventory:Has(ing.type, math.max(1, RoundBiasedUp(ing.amount * owner.replica.builder:IngredientMod())), true)
							and (owner.replica.builder:KnowsRecipe(ing_recipe) or CanPrototypeRecipe(ing_recipe.level, tech_level) and (ing_recipe.builder_tag == nil or owner:HasTag(ing_recipe.builder_tag))--[[check builder_tag]]) and owner.replica.builder:HasIngredients(ing_recipe) then
							owner.replica.builder:MakeRecipeFromMenu(recipe, skin) -- tell the server to build the current recipe, not the ingredient
							return true
						end
					end

					return true, "NO_INGREDIENTS"
				end
            else
                return true, recipe.nounlock and "NO_STATION" or "NO_TECH"
            end
        end
    end
end

 

Same change on line 88, don't forget

 

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

Other existing bugs


(1) Watering can bug

(2) container crafting bug

(3) Inventory Image bug

(4) Joystick not recognised

 


Steps to Reproduce

Very easy to reproduce:

1) Launch a server with cave, enable movement prediction.

2) Craft a livinglog recipe (just do what I did in GIF above)

 

Log file is of no sense, ignore it. :p

 




User Feedback


A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.


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...