Jump to content

Recommended Posts

I've been working on stabilizing a long-abandoned mod for some time now. The progress is slow but steady, and I've finally got the hat to a point where it works for the host. HOWEVER, if I put it on the ground and another player sees it, or I put it in a chest and another player opens it, said players' games immediately crash. Any tips for what's going on?

local assets=
{
	Asset("ANIM", "anim/hat_ushanka.zip"),
	
	Asset("IMAGE", "images/inventoryimages/hat_ushanka.tex"),	
    Asset("ATLAS", "images/inventoryimages/hat_ushanka.xml")
}

local function onequip(inst, owner) 
        owner.AnimState:OverrideSymbol("swap_hat", "hat_ushanka", "swap_hat")
        owner.AnimState:Show("HAT")
        owner.AnimState:Show("HEAD_HAT")
        owner.AnimState:Hide("HAIR_NOHAT")
        owner.AnimState:Hide("HAIR")
        
        if owner:HasTag("player") then
			owner.AnimState:Hide("HEAD")
			owner.AnimState:Show("HEAD_HAT")
		end
		
		if inst.components.fueled then
			inst.components.fueled:StartConsuming()
		end
end

local function onunequip(inst, owner) 
        owner.AnimState:Hide("HAT")
        owner.AnimState:Hide("HEAD_HAT")
        owner.AnimState:Show("HAIR_NOHAT")
        owner.AnimState:Show("HAIR")

		if owner:HasTag("player") then
	        owner.AnimState:Show("HEAD")
			owner.AnimState:Hide("HEAD_HAT")
		end
		
		if inst.components.fueled then
			inst.components.fueled:StopConsuming()
		end
end


local function fn(Sim)
	local inst = CreateEntity()
	local trans = inst.entity:AddTransform()
	local anim = inst.entity:AddAnimState()
	inst.entity:AddNetwork()
    MakeInventoryPhysics(inst)
    
    inst:AddTag("hat")
    
    anim:SetBank("strawhat")
    anim:SetBuild("hat_ushanka")
    anim:PlayAnimation("anim")    
    
	if not TheWorld.ismastersim then
		return inst
	end
	
	inst.entity:SetPristine()
	
    inst:AddComponent("inspectable")
    
    inst:AddComponent("inventoryitem")
	inst.components.inventoryitem.imagename = "hat_ushanka"
    inst.components.inventoryitem.atlasname = "images/inventoryimages/hat_ushanka.xml"
    
    inst:AddComponent("equippable")
    inst.components.equippable.equipslot = EQUIPSLOTS.HEAD
	inst.components.equippable.dapperness = TUNING.DAPPERNESS_MED
	inst.components.equippable:SetOnEquip( onequip )
    inst.components.equippable:SetOnUnequip( onunequip )
	
	inst:AddComponent("insulator")
    inst.components.insulator:SetInsulation(TUNING.INSULATION_LARGE)
	
	inst:AddComponent("waterproofer")
    inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_SMALL)
	
	inst:AddComponent("fueled")
    inst.components.fueled.fueltype = FUELTYPE.USAGE
    inst.components.fueled:InitializeFuelLevel(TUNING.BEEFALOHAT_PERISHTIME)
    inst.components.fueled:SetDepletedFn(inst.Remove)
    
    return inst
end

return Prefab( "common/inventory/hat_ushanka", fn, assets) 

Your suggestion is in there, but it could easily be in the wrong spot.

 

workshop-402531514.zip

This error does not correspond to the version of the mod you posted. The line 49 in your hat_hushanka.lua is an empty one and before that it is a AddTag.

So we'll need the error that is actually generated by the version of the code which you posted :)

Alrighty, here's a brand new error log, one that ACTUALLY represents the crash.

Note that when I crafted the hat and wore it in front of my buddy, there were no problems. It wasn't until I stuck it in a chest and he opened the chest that he crashed.

5F6D7F7201A31E0EC906CC36FA80C21AFFA83199

local assets=
{
	Asset("ANIM", "anim/hat_ushanka.zip"),
	
	Asset("IMAGE", "images/inventoryimages/hat_ushanka.tex"),	
    Asset("ATLAS", "images/inventoryimages/hat_ushanka.xml")
}

local function onequip(inst, owner) 
        owner.AnimState:OverrideSymbol("swap_hat", "hat_ushanka", "swap_hat")
        owner.AnimState:Show("HAT")
        owner.AnimState:Show("HEAD_HAT")
        owner.AnimState:Hide("HAIR_NOHAT")
        owner.AnimState:Hide("HAIR")
        
        if owner:HasTag("player") then
			owner.AnimState:Hide("HEAD")
			owner.AnimState:Show("HEAD_HAT")
		end
		
		if inst.components.fueled then
			inst.components.fueled:StartConsuming()
		end
end

local function onunequip(inst, owner) 
        owner.AnimState:Hide("HAT")
        owner.AnimState:Hide("HEAD_HAT")
        owner.AnimState:Show("HAIR_NOHAT")
        owner.AnimState:Show("HAIR")

		if owner:HasTag("player") then
	        owner.AnimState:Show("HEAD")
			owner.AnimState:Hide("HEAD_HAT")
		end
		
		if inst.components.fueled then
			inst.components.fueled:StopConsuming()
		end
end

 local function fn(Sim) 
    local inst = CreateEntity()
    local trans = inst.entity:AddTransform()

	inst.entity:AddTransform()
	inst.entity:AddAnimState()
	inst.entity:AddSoundEmitter()
    inst.entity:AddNetwork()
	
	
    MakeInventoryPhysics(inst)
 
    inst:AddTag("hat")
	
	    if not TheWorld.ismastersim then
        return inst
    end
	
	inst.entity:SetPristine()
	
    inst.AnimState:SetBank("hat_ushanka")
    inst.AnimState:SetBuild("hat_ushanka")
    inst.AnimState:PlayAnimation("idle")
	
	MakeHauntableLaunch(inst)
 
    inst:AddComponent("inspectable")
     
	inst:AddComponent("waterproofer")
    inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_SMALL) 
	
	inst:AddComponent("insulator")
    inst.components.insulator:SetInsulation(TUNING.INSULATION_LARGE)
	
    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem.imagename = "hat_ushanka"
    inst.components.inventoryitem.atlasname = "images/inventoryimages/hat_ushanka.xml"
	 
    inst:AddComponent("equippable")
	inst.components.equippable.equipslot = EQUIPSLOTS.HEAD
	inst.components.equippable.dapperness = TUNING.DAPPERNESS_MED
    inst.components.equippable:SetOnEquip(onequip)
    inst.components.equippable:SetOnUnequip(onunequip)
	
	inst:AddComponent("fueled")
    inst.components.fueled.fueltype = FUELTYPE.USAGE
    inst.components.fueled:InitializeFuelLevel(TUNING.BEEFALOHAT_PERISHTIME * 1.5)
    inst.components.fueled:SetDepletedFn(inst.Remove)
 
    return inst
end
return  Prefab("common/inventory/hat_ushanka", fn, assets)

Current version. So line 49 is     inst.entity:AddNetwork()

Well I'm glad I'm not the only one stumped!

Yeah, the file path is C:\Program Files (x86)\Steam\steamapps\common\Don't Starve Together\mods

I'm reuploading the entire folder, just to be thorough.

Again, the problem is that when another client opens a chest containing the item, his game crashes.

At this point it might be simpler if I just remake the entire code from scratch, and only carry over the art assets. Got any tutorials on how to make custom item prefabs like this?

workshop-402531514.zip

It's on the workshop, but in a rather different form. Again, I'm trying to stabilize a mod that has long since been abandoned by its creator. But that hardly matters, since I've never required any of my clients to install the mods. We have almost never had problems with mod stability in any of the other mods that we run. We run nine different character mods--the clients install none, and we have no problems. Besides this one.

THAT said, I can try seeing what happens if my friend sticks my version of this mod on his machine.

The mystery thickens! Although I finally learned how to post pictures in a more format friendly way, so that's a small victory.

1AD12D62DE6C5146724A5197AB208E4331390865

This is all AFTER I tried two ideas. First, I had him completely delete his old version of the mod. We tested, crash, same message. Then I sent him the attached version of the mod--which is what my server was running--and had him UNZIP it first, and place the whole thing in his mods folder. Still got this same error. So three things still remain:

  1. The mod line that it's still spitting back is inst.entity:AddNetwork().
  2. As I thought, the problem is not rooted in whether or not the client has the mod installed. We have ALWAYS run our modded servers without clients installing the mods themselves, and this is one of the only stability issues we have. Most of the modded characters we run have zero stability issues.
  3. Are there any tutorials for teaching how to make a custom prefab for a custom character? I have the art assets, so I could try just coding the entire hat from scratch.

workshop-402531514.zip

13 minutes ago, KirbyJParasol said:
  •  
  • As I thought, the problem is not rooted in whether or not the client has the mod installed. We have ALWAYS run our modded servers without clients installing the mods themselves, and this is one of the only stability issues we have. Most of the modded characters we run have zero stability issues.

Yes, but if the mod isn't on the workshop, the players can't download the mod, you have a big warning when you enable a mod that isn't on workshop. Also, if your mod is on workshop (but a different version) and you have another version on your server, it could lead to problem.

Usually, there is a message that you need to update the mod, but if they share the same number of version, for example, i doubt there is a way to detect the error.

And you are very confusing because it seems that your mod have one version in the server, and another on the workshop.

On 07/09/2017 at 10:08 PM, KirbyJParasol said:

 

It's on the workshop, but in a rather different form.

 

So maybe the thing that happens is that you have your version, on the server, that is a modified version of the workshop mod, and people on the client side still download the workshop version, different of the server version ?

Because this would explain why the error makes no sense.

 

Can't you do a clean upload of the mod on the workshop and test the clean upload version instead of messing with the old one ?

Edited by Lumina

Sorry I've been confusing. Let me explain.

The mod that I'm tweaking IS NOT MY MOD. It has been long since abandoned by the original author. A lot of the code is outdated, so it's pretty unstable. I have been, and am currently, trying to stabilize each element of the mod. Currently I'm working on that hat prefab.

In order to play with friends, I host this mod, along with eight other character mods, on my server. NONE OF THE CLIENTS INSTALL ANY MODS. But we only have problems with this mod, and with the Medic mod. The Medic bug has been noted by multiple players on that mod's workshop page. Point is, not requiring the clients to install the mods has NEVER caused us issues.

FURTHERMORE!

The tests that I JUST now ran with my friend, were as follows:

  • Tried opening a chest containing the hat with NO MOD in his mods folder.
  • Tried opening a chest with MY EXACT VERSION of the mod in his mods folder.

In both cases, the game crashes and gives the exact same error.

 

I cannot stress any more strongly that this mod almost certainly has nothing to do with what the client has (or doesn't have) installed, and is almost certainly a problem with the server side code. I am also once again inquiring if there are any prefab tutorials out there that I can use to just rebuild the entire code from scratch.

HeavyHat.thumb.png.48f77a6e16a70c21b4d4661f7722efab.png

Dedicated server i'm hosting. So as far as i understand how it works, i'm the client of the dedicated server.
And i have thousand of hats with no crash.

 

English isn't my native language. So maybe i'm bad at explaining, maybe it's why we don't understand each other.

But i'll try again.

 

Steam allows mod on WORKSHOP to be shared even if players don't suscribe/download/have the mod themselves.

You change the mod on local.

Players have NO WAY to have the updated mod because it's not on WORKSHOP.

Copying files on local on their side is probably not enough to have something clean. Maybe it's replaced by the workshop version, maybe it's not taken in account, i don't know.

 

Mod is working fine on my side and i'm pretty sure i'm client side.

 

Now, please, could you reupload a clean version of the mod on workshop (limit it to friends only if you can't reupload a mod that aren't your)

OR

Rename it something else than the mod workshop name ("annoyingmod" seems to be a fitting name), send a zip to your friend and do news tests

so we can be sure that the fact that your mod share it's name with an existing but outdated version of your mod isn't the reason of the problem ?

Thanks.

Because i start to be annoyed to waste my time (and seeing others people wasting their) trying to fix something that could be perfectly fine but not working because they still have the old outdated version on their side.

Edited by Lumina

Didn't know you could upload friends only versions of mods to Steam. Yeah I can do that, though I think I essentially did the same thing with the earlier experiment.

The strange thing about this bug is that it only crashes clients who join your game. If you locally host a game and also play it--as in, you're both the host AND one of the clients--the game never crashes for you. It will just crash for all your friends who join off you.

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