Jump to content

[Mod Help] Eyebone and Other Items Don't Drop when Disconnecting (Host Only)


Recommended Posts

Title mostly says it all. The host shouldn't have to pick the eyebone every time they shut down the server. Along with some other items if they spawn it with the console command (Pile o' Balloons, Lighter, Lucy the Axe, Abigail's Flower.) But I also wanted to make this a mod for myself, but I don't know where to at least start at. I don't know if I were supposed to put this in the Mods and Tools category, or the one currently. I know some items appear to be buggy (Lucy doesn't appear on the ground, but IS there, only way to pick it up is by holding space to force pick it up/Balloons aren't there, only way to pop them is by ctrl+f), but that's really the reason the characters aren't implemented in DST. They still work as far as I've seen. I think this is also somewhere in the category under Bug Tracker, but I don't think it's an issue for now.

 

Anyway, Could someone be kind enough to make it, or even better, point out where I should start?

So I started just playing with some lua, and just edited some prefabs that Wendy (I used her for testing) has, and I added the items to her inventory starter, but I feel a little skeptic about this. Any suggestions? I never got any feedback on my other same topic on the suggestions/feedback category. 

local prefabs ={    "abigail_flower",    "balloons_empty",    "lucy",    "lighter",    "shadowwaxwell",    "chester_eyebone",} local start_inv ={"waxwelljournel","lighter","lucy","balloons_empty",}

EDIT: I found out I was modding the wrong file. I've found out that in player_commons, it mentions a tag "Irreplaceable" under player despawn (Disconnecting, I presume,) But I don't want to get rid of the tag for a reason: I want the host to not drop the items that has the specified tag, but for other players to. How could I do that though?

Edited by Rayalan
Link to comment
Share on other sites

Why hasn't anyone replied/helped on this topic? Am I doing something bad? Maybe I'm just a little impatient, I guess.

 

Anyways, found out something to do with items that have tags that list for specific people to keep in their inventory, but I don't know how to make multiple characters without just messing the code and break the game, and with only adding the host of the server, but I don't even know how to do that either.

 

 

Edited by Rayalan
Link to comment
Share on other sites

@Rayalan, Probably because nobody knows exactly how to do it. It's not ground that's been tread before many times over like most of the requests on here, and requires some digging around in the code to find the flow of players leaving -> items dropping.

 

But I got around to tracing it, and tested this code, which seems to work (in the modmain):

AddPrefabPostInit("world", function(inst)	inst:ListenForEvent("ms_playerjoined", function(world, player)		if world.ismastersim and player == GLOBAL.ThePlayer then			local OldDropEverythingWithTag = player.components.inventory.DropEverythingWithTag			player.components.inventory.DropEverythingWithTag = function(self, tag, ...)				if tag == "irreplaceable" then return end				OldDropEverythingWithTag(self, tag, ...)			end		end	end)end)
Link to comment
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
 Share

×
  • Create New...