Sign in to follow this  

Help porting smarter crock pot mod into DST

Recommended Posts

Nadevill    7

I've been  working on it for days using different tactics, and I cant seem to get it.


Curreny, The mod works this way:

The container widget setup is overriden to add a button. its functionality is 

--server size    if inst.components.container ~= nil then        GLOBAL.BufferedAction(inst.components.container.opener, inst, action):Do()    --client size    elseif inst.replica.container ~= nil and not inst.replica.container:IsBusy() then        GLOBAL.SendRPCToServer(GLOBAL.RPC.DoWidgetButtonAction, action.code, inst,action.mod_name)    end

when the action is PREDICT, defined here:

PREDICT.str = "Predict" = "PREDICT"PREDICT.fn = function(act)	if"SMARTERCROCKPOT") then		item ,odds=	endend

where the predicter components does the calculation, and outputs the result using:

prefab:PushEvent("prediction", {item = loot,odds = chance})

which is intercepted in the container widget (just like itemget) and activates a method to add a utilSlot (InvSlot with empty code so it does nothing) with the item to the cookpot.


for more, you can always download.


The problem:

All this works for the hostonly.

for the client, predicter:Predict() gets called, but the event isnt pushed into the widget.



Do you have any tips or code to aid me so the mod will work for the clients too? 

Help wiil be appreciated :)

Share this post

Link to post
Share on other sites
rezecib    3166

@Nadevill, I believe for items this sort of information gets propagated to clients via inventoryitem_classified. There are a number of ways you could get around it... You could write your own classified, find a way to get it to pretend there's actually an inventory item there that can't be removed, or add netvars to pass the tile image/atlas

Share this post

Link to post
Share on other sites

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
Sign in to follow this