AlexMog / Longship

Valheim Dedicated server Fixes, Optimizations and High-Level API
MIT License
29 stars 3 forks source link

[Feature Request] Auto delete spawned in items/objects if not in adminlist #17

Open b3ck opened 3 years ago

b3ck commented 3 years ago

Just looking for a little Anti-Cheat, right now as it stands anyone can spawn in any item/object into any server. The fix? well it's just an idea really, basically the server knows when a user spawns in an item/object, solution? check to see if that user is in the adminlist, and if not immediately delete said item/object.

I had someone look into this but they were unable to remove an object after spawning it into the world.. they said if the server could remove it then it would probably work.

Things they tried as a player:

call .DEtostry() on said object.

ZNetScene.instance.Destroy(base.gameObject);

Again they were unsuccessful but maybe the server doing it would work?

Kind Regards, -b3ck

Hi-ImKyle commented 3 years ago

I actually have a crude way of doing this but I've only ever done it on my own player's inventory, never tried it on another player.

Player.m_localPlayer.GetInventory().RemoveItem(theItem)

b3ck commented 3 years ago

yeah it seems it would have to be done server-side, since when you spawn items/objects it first goes into the world.

AlexMog commented 3 years ago

Hello, The problem here is that the server is absolutely not Authorative. That means that it turst every inputs that the player will give. Inventories seems to be managed on the client-side, so if a client can manipulate its own inventory, it can add any item to its inventory and drop them in the server.

There is no easy fix for that, I can't do anything about it right now without a massive amount of work (and it's clearly not the role of Longship to act as an anti-cheat), let's hope that the devs will rework their network system, because it is really not great right now ! (to be fair, all the game is really badly coded, that complicates my task to develop most systems I want to add to Longship)

AlexMog commented 3 years ago

I've precised here #19 how the server handle player's inventory

b3ck commented 3 years ago

I guess I should have worded this differently, at this point I could careless about items, it's more about objects placed in the world that cannot be destroyed, if somehow there is a way to prevent this,: awesome! If not not worries just a thought I was having 🤔