If you need to access the _teleplayersave from the client, you need a two part component, one that gets added to shards, and another that gets added to every client and server, the shards send the data to the clientserver component, which sends it to the client. Lastly, you should use a net_event(just do a find in files for it, you will see why you should use it for your usecase.) I noticed your adding a ShardRPC from inside the component, while technically no explosions should happen because of that, its generally best to add the RPC outside the component, and use events to "call" functions inside the shard_component. Just digging some more in API Gem Core code and see several "DEPRECIATED" prints, at least for SetupGemCoreEnv which is also printed within my log.Īre you checking to make sure _teleplayersave is being accessed on the server, and not on the client? _teleplayersave:RequestPlayerData()Īdded the sample code from your docu to the mdworldgenmain, but still the same result, so this was not the reason. _requestdata:set(not _requestdata:value()) - simply change the value, the value itself does not matter,we only want to trigger the dirty functionsĪnd outside of this component I would like to call sth like: _world:PushEvent("shard_teleplayersave._requestdata", _requestdata:value()) - push the event to the world, it will save data and send it via rpc in modmain to the master If not _ismastershard then - only do it when you are not master Inst:ListenForEvent("shard_teleplayersave._requestdatadirty", function() - if the master sends a request via netvar to the slaves, save our data and send them via rpc _:DoJumpFinalWithCave() - this will also save for all current players on masterĪddShardRPCHandler("TeleSerp", "PlayerSave", SavePlayerDatainMaster) If not next(missingshards) then - sobald shardReceivedList dieselben id enthält wie shardSendList, kann worldjump gemacht werden Local missingshards = ExceptionArrays(shardSendList, shardReceivedList) If data.timefromsave > player_data_save_MASTER.timefromsave then - if slave data is newer (higher time value), replace our master data If player_data_save_MASTER=nil then - new info? add itĮlse - we already have stuff from that player? check which is newer If userid~="saveinventory" and userid~="savebuilder" and userid~="saveage" then new data from all players currently active at master will be added at lastįor userid, data in pairs(player_data_save) do Local player_data_save_MASTER = _data_save - this is old data from players left the master. Local function SavePlayerDatainMaster(shard_id,player_data_save,shardSendList) SendShardRPCToServer(SHARD_, shardSendList, player_data_save ,shardSendList) - send it to master (currently only identified by forest Tag.) _:SavePlayerData() - will save playerdata within ayer_data_save Local _requestdata = net_bool(inst.GUID, "shard_teleplayersave._requestdata", "shard_teleplayersave._requestdatadirty") - value does not matter, everytime it is changed the slave sends data to master Local _ismastershard = _world.ismastershard So there is no ready to use code already within the GEM API for netvars.Īh, I wasn't aware that netvars for shard communication already exist in the game and where not added by your API mod, just found the shard_a Edited Augby SerpensĪssert(TheWorld.ismastersim, "shard_teleplayersave should not exist on client") I have to write my own component which I will add via AddShardComponent() and I can use shard_globalpause as sample code to write my own (I guess especially the " pausestate " netvar stuff is the one I have to use)? Global Pause/scripts/components/shard_a both of these use similar concepts, though the Gem Core one has a lot of "Gem Core only code", so its quite a bit more complex. Gem Core/scripts/components/shard_a but there is also a simpler component that I made for Global Pause at Firstly, due to time constraints mainly, the wiki is sadly horribly outdated, none of the information is wrong persay, but all older, so if your ever unsure or if something doesn't work peek in the code first, and if that doesn't help ask me, until I can update the wiki(which is a really big task)this is just gonna have to be how it is.Īs for your netvar "issue", I have a "sample component"(by that I mean a component that is added for shards that uses netvars) at
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |