Closed TheGreenBandit closed 8 months ago
I have tried, but both generating and deleting items only take effect on the host. Good luck
I have tried, but both generating and deleting items only take effect on the host. Good luck
Im thinking if we patch the check if host it should work just fine when spawning, just gotta find which function actually checks if you are host
I have tried, but both generating and deleting items only take effect on the host. Good luck
Im thinking if we patch the check if host it should work just fine when spawning, just gotta find which function actually checks if you are host
I think the reason for the invalidation is the process issue. The process of the game is: server generates items/enemies/monsters -> notifies client -> client generates items/enemies/monsters. This is why it only takes effect on the host, because the client cannot notify the client, and if the client notifies the server, it will be intercepted by the server's local code. However, it is obviously impossible for us to modify the local code of the host.
This is the intercepted code
if (base.OwnerClientId != networkManager.LocalClientId)
{
if (networkManager.LogLevel <= Unity.Netcode.LogLevel.Normal)
{
Debug.LogError("Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
Hm, very weird coding style. Maybe if we set ourselves as the host then reset the host to the original after the function has passed? Could be a simple override
private static void \_\_rpc\_handler\_1482204640(NetworkBehaviour target, FastBufferReader reader, \_\_RpcParams rpcParams)
{
NetworkManager networkManager = target.NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
{
if (networkManager.LogLevel <= Unity.Netcode.LogLevel.Normal)
{
Debug.LogError("Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
target.\_\_rpc\_exec\_stage = NetworkBehaviour.\_\_RpcExecStage.Server;
((StartOfRound)target).ManuallyEjectPlayersServerRpc();
target.\_\_rpc\_exec\_stage = NetworkBehaviour.\_\_RpcExecStage.None;
}
This is the execution program that receives the server notification
private static void \_\_rpc\_handler\_1482204640(NetworkBehaviour target, FastBufferReader reader, \_\_RpcParams rpcParams) { NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if (networkManager.LogLevel <= Unity.Netcode.LogLevel.Normal) { Debug.LogError("Only the owner can invoke a ServerRpc that requires ownership!"); } return; } target.\_\_rpc\_exec\_stage = NetworkBehaviour.\_\_RpcExecStage.Server; ((StartOfRound)target).ManuallyEjectPlayersServerRpc(); target.\_\_rpc\_exec\_stage = NetworkBehaviour.\_\_RpcExecStage.None; }
This is the execution program that receives the server notification
now that i think about it most functions such as the spawn check if the player is host by comparing a instance of localclientid such as in NetworkObject
public bool IsLocalPlayer
{
get
{
if (NetworkManager != null && IsPlayerObject)
{
return OwnerClientId == NetworkManager.LocalClientId;
}
return false;
}
}
if we can write to the localclient id and just change it to the host's when we call a function that requires host and restore it it should work fine
private static void \_\_rpc\_handler\_1482204640(NetworkBehaviour target, FastBufferReader reader, \_\_RpcParams rpcParams) { NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if (networkManager.LogLevel <= Unity.Netcode.LogLevel.Normal) { Debug.LogError("Only the owner can invoke a ServerRpc that requires ownership!"); } return; } target.\_\_rpc\_exec\_stage = NetworkBehaviour.\_\_RpcExecStage.Server; ((StartOfRound)target).ManuallyEjectPlayersServerRpc(); target.\_\_rpc\_exec\_stage = NetworkBehaviour.\_\_RpcExecStage.None; }
This is the execution program that receives the server notification
now that i think about it most functions such as the spawn check if the player is host by comparing a instance of localclientid such as in NetworkObject
public bool IsLocalPlayer { get { if (NetworkManager != null && IsPlayerObject) { return OwnerClientId == NetworkManager.LocalClientId; } return false; } }
if we can write to the localclient id and just change it to the host's when we call a function that requires host and restore it it should work fine
I think it's just tricking yourself, because other clients don't think you are the host, so they won't execute the commands you send
I think it's just tricking yourself, because other clients don't think you are the host, so they won't execute the commands you send
maybe, it will have to be tested, let me see if i can write something up quick and if you have anyone to test with try it
private static void \_\_rpc\_handler\_1482204640(NetworkBehaviour target, FastBufferReader reader, \_\_RpcParams rpcParams) { NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if (networkManager.LogLevel <= Unity.Netcode.LogLevel.Normal) { Debug.LogError("Only the owner can invoke a ServerRpc that requires ownership!"); } return; } target.\_\_rpc\_exec\_stage = NetworkBehaviour.\_\_RpcExecStage.Server; ((StartOfRound)target).ManuallyEjectPlayersServerRpc(); target.\_\_rpc\_exec\_stage = NetworkBehaviour.\_\_RpcExecStage.None; }
This is the execution program that receives the server notification
now that i think about it most functions such as the spawn check if the player is host by comparing a instance of localclientid such as in NetworkObject
public bool IsLocalPlayer { get { if (NetworkManager != null && IsPlayerObject) { return OwnerClientId == NetworkManager.LocalClientId; } return false; } }
if we can write to the localclient id and just change it to the host's when we call a function that requires host and restore it it should work fine
I think it's just tricking yourself, because other clients don't think you are the host, so they won't execute the commands you send
maybe, it will have to be tested, let me see if i can write something up quick and if you have anyone to test with try it
private static void \_\_rpc\_handler\_1482204640(NetworkBehaviour target, FastBufferReader reader, \_\_RpcParams rpcParams) { NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if (networkManager.LogLevel <= Unity.Netcode.LogLevel.Normal) { Debug.LogError("Only the owner can invoke a ServerRpc that requires ownership!"); } return; } target.\_\_rpc\_exec\_stage = NetworkBehaviour.\_\_RpcExecStage.Server; ((StartOfRound)target).ManuallyEjectPlayersServerRpc(); target.\_\_rpc\_exec\_stage = NetworkBehaviour.\_\_RpcExecStage.None; }
This is the execution program that receives the server notification
now that i think about it most functions such as the spawn check if the player is host by comparing a instance of localclientid such as in NetworkObject
public bool IsLocalPlayer { get { if (NetworkManager != null && IsPlayerObject) { return OwnerClientId == NetworkManager.LocalClientId; } return false; } }
if we can write to the localclient id and just change it to the host's when we call a function that requires host and restore it it should work fine
I think it's just tricking yourself, because other clients don't think you are the host, so they won't execute the commands you send
maybe, it will have to be tested, let me see if i can write something up quick and if you have anyone to test with try it
Good luck. I'm going to bed. I'll wait for your good news.
just pushed a mockup, try it once you are able to
might have to change name of pr with how much im adding lol. Thinking of changing the gui to something a little better than black and white. Wish i could get imgui.net working
Items can be generated but cannot be picked up.
Nice! All we need to do then is set the item in the inventory then and we have it? Does it retain its scrap balue? Have you tried spawning enemies?
Back to Minecraft hack days in factions lmao. Remember the whole set offhand thing. That's what this vibe gives me.
Try spawning something like a bigbolt or metalsheet
According to the above rpc_handler method, I believe we cannot succeed because the code to determine whether the host is on another player is in the client side, but we cannot modify the code of other clients.
All we should need to do is set it into the players hands after spawning, then it should be fine
Sounds like a feasible method. I will try it
try this, also where do you find this stuff? localVisor = GameObject.Find("Systems/Rendering/PlayerHUDHelmetModel/");
Cant grab. I think only the host can get it
let me try putting it in our inventory while we are host
try this, spawning enemy might work now
hm, for the planned feature in the readme if we just get the enemies, patch their update function with
if(notargetme && enemy.targetplayer == localplayer)
{
enemy.targetplayer = get the closest other player
}
that should be it
edit: actually if we just patch playeristargetable it should work just fine im a dumbass
hmm why tf is this shit not letting me use mouse in gui, or any features like noclip working now
did not mean to close, dumb close with comment button
Can you try using gift boxes to generate items?
that may work, except how would we spawn the gift box
Your menu is broken and none of the functions work. New version
Do you know which commit did it? Did it work before the recent commits?
Ok good to know, i will have to see about different ways of getting the object to go into inventory
just fixed the menu, i do see the problem, even when host you cannot pick up the item.
deleting seems to be working, idk if it works as nonhost however.
it seems that the current way i have for setting host just wont work. ill look into it more but will probably get rid of it for this pr
im going to go to sleep but maybe GrabbableObject.ChangeOwnershipOfPropServerRPC will work, untargetable can be improved by patching the PlayerTripWebServerRpc to do nothing
Can someone test carrydeadbody?
~once that is tested and confirmed working the only 2 things left to do are find out why items with spaces dont wanna spawn and how to display the itemname of a object for the deleteobject~
Edit: figured out how to display itemname, also why objects with spaces didn't want to spawn. Just need to figure out if teleport dead body is working
I suggest when adding prs to squash and merge this way the commit history doesn't appear with it. Cause this branch has a lot lol
if you would like to test yet dont want to build go here to download
Oh shit i forgot to add back changelog n shit
I can
Alright, tell me the results when you are able to
Carry dead body didnt work
Alright, thanks for testing, I'll look into it
Why did you remove the changelog and the credits? Or is it just not loading properly for me?
Oh shit i forgot to add back changelog n shit
Forgot to add back, was debugging
Looks awesome! Do you guys want to make any changes or can I merge it?
Looks awesome! Do you guys want to make any changes or can I merge it?
Carry dead body needs to be fixed other than that it's ready to go, i might just look at how the player grabs objects then use that to make a grabbing function that we could use for future features too
Btw could you take a look at my better hotkeys branch? Im having trouble getting if the user pressed a button with getasynckeystate
this should work if someone wants to try carrydeadbody now
https://github.com/TheGreenBandit/Project-Apparatus/releases/tag/updateddeadbody new dll incase yall dont wanna build
might be an issue with how im getting the dead body, ill remove it from the pr and then ill look into adding it in another pr as this is ready without it, before i do anything though im going to test if it works with normal objects
ok seems the pickup works, just dont go in your hands or have any of that function.
should be ready to go, leaving pickup util in so it can be fixed just as the host override. Also noticed a game bug (not menu bug) that if u can a item with a worth of 10k or more it breaks the scanner
should be ready to go, leaving pickup util in so it can be fixed just as the host override. Also noticed a game bug (not menu bug) that if u can a item with a worth of 10k or more it breaks the scanner
Teleport All Items doesn't seem to work in your branch 🤷♀️
should be ready to go, leaving pickup util in so it can be fixed just as the host override. Also noticed a game bug (not menu bug) that if u can a item with a worth of 10k or more it breaks the scanner
Teleport All Items doesn't seem to work in your branch 🤷♀️
~Hm ill look into it when i get home, i think i modified it testing something and forgot to revert it back~
Nvm got it over anydesk lol
[+] Added Spawning Objects (host) [+] Added Deleting Objects [+] Added Changing Object Value [+] Added if a player is host in the playerlist [+] Added issue templates to clean up repo [+] Added untargetable [/] Changed source directory
TODO if we want to have the client without host be able to spawn shit we would need to figure out a bypass, leaving my non working method in so others can get an idea, SpawnNetworkObjectLocallyCommon in NetworkSpawnManager might allow for bypassing host but i dont wanna look into it