Jump to content

Recommended Posts

Without any tests (any at all).

You guys can do this by adding a few lines of code. There is a function that add components. What's the name? Humm. Ok, I will open the file for a bit so I can tell you guys what to do.

- Open the file scripts/prefabs/bedrow_straw.lua

- Find the fn function

- Add the component "finiteuses" and configure it

- Humm. I think you have to remove the component "stackable" here

- Add the function "onfinished"

- Test it

Adding the component finiteuses to the fn function and configure it

-- cejoga    inst:AddComponent("finiteuses")    inst.components.finiteuses:SetMaxUses(10)    inst.components.finiteuses:SetUses(10)    inst.components.finiteuses:SetOnFinished(onfinished)    --/cejoga
Removing the stackable component

--inst:AddComponent("stackable")    --inst.components.stackable.maxsize = TUNING.STACK_SIZE_LARGEITEM
Adding the function onfinished (line 38 to 42) and outside fn function

--cejogalocal function onfinished(inst)    inst:Remove()end--/cejoga
Run the game and try it out.

Did it work?

--EDIT--

Ops! I made a mistake. From the comment above make the changes below.

- Remove the lines from the component "finiteuses"

- Remove the function onfinished

- Uncomment the lines from stackable component

- Comment the lines bellow from the onsleep function

-- cejoga	--[[local br = nil	if inst.components.stackable then		br = inst.components.stackable:Get()	else		br = inst	end		if br then		br.persists = false		br:Remove()	end	]]	-- /cejoga
Edited by cejoga

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