init
This commit is contained in:
commit
d8d0e9d536
2567 changed files with 167778 additions and 0 deletions
27
kubejs/client_scripts/mods/RPC.js
Normal file
27
kubejs/client_scripts/mods/RPC.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* Discord RPC status
|
||||
*/
|
||||
|
||||
global.tier = 0; // this is clientside tier anyways
|
||||
ClientEvents.loggedIn(() => {
|
||||
SDRP.setState("sdrp.ulv", "ULV", "ulv")
|
||||
})
|
||||
|
||||
ClientEvents.loggedOut(() => {
|
||||
global.tier = 0;
|
||||
})
|
||||
|
||||
NetworkEvents.dataReceived("moni:rpc", (e) => {
|
||||
global.tier = Number(e.data.tier ?? TIER_ULV);
|
||||
let tierID = TIER_ID_MAPPING[Math.round(global.tier)]; // putting val inside the global var turns it into float
|
||||
SDRP.setState(`sdrp.${tierID.toLowerCase()}`, tierID, tierID.toLowerCase())
|
||||
// console.log("SDRP Update Client By Network")
|
||||
// console.log(`New tier: ${global.tier} ${tierID}`)
|
||||
})
|
||||
|
||||
// this event is slightly delayed when running an integrated server
|
||||
sdrp.dimension_change(ev => {
|
||||
let tierID = TIER_ID_MAPPING[Math.round(global.tier)];
|
||||
ev.updateSDRPState(`sdrp.${tierID.toLowerCase()}`, tierID, tierID.toLowerCase())
|
||||
// console.log("SDRP Update Client By Dim")
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue