#plugins-dev-chat

1 messages · Page 48 of 1

icy knoll
#

hmm

true cedar
#

and with restrictions

upper vapor
#

more than that

unique crane
#

Yea its very useful

true cedar
#

well yea

random scaffold
#

span for noobs

#

use IEnumerable

true cedar
#

think arraysegment but it works on a lot more things, not just arrays, and also you can't store it in anything

upper vapor
#

a span represents a contiguous block of memory
works on arrays, strings, lists with CollectionsMarshal
allows the compiler to optimize a lot

#

with SIMD

upper vapor
#

smart

true cedar
#

its more that it doesn't incur any gc pressure 🤓

upper vapor
random scaffold
unique crane
#

and you can stackalloc array :3

true cedar
#

works for a lot more things too like stackalloc

upper vapor
random scaffold
#

span made on assembler level?

upper vapor
#

might save a few nanoseconds

upper vapor
random scaffold
# upper vapor what

is span made at the assembler level, or does it add c# by inheriting something?

upper vapor
#

what is assembler

true cedar
#

its a ref struct

random scaffold
#

language

true cedar
#

so it has language support

#

compiler?

upper vapor
#

it's in the SDK

true cedar
upper vapor
#

from .NET Standard

true cedar
#

since iirc it has a ByReference<T> or some shit

icy knoll
#

me when you guys obsess over micro-optimisations 😭

true cedar
#

realistically span is not that much of a micro optimization

unique crane
upper vapor
true cedar
#

its pretty useful

unique crane
#

Yea

true cedar
#

i wont lie and pretend like i dont obsess over micro optimizations but

unique crane
#

but general use is as sub array

random scaffold
unique crane
#

where you dont need to do the index math

random scaffold
#

im even using byte, short, ushort

true cedar
#

u do realize

#

that

#

the smaller types are just expanded to ints

upper vapor
#

ints are padded

unique crane
#

Dont c# extend values-

#

yea

true cedar
#

like they're stored as ints

random scaffold
upper vapor
#

lmaoi

random scaffold
#

.....

#

..........................

true cedar
#

the only time it matters is when you're doing interop

random scaffold
#

fuck microsoft

true cedar
#

i mean its not really microsoft

random scaffold
#

im always lost the time for thinking which type use

upper vapor
true cedar
#

no matter what it'd still have to deal with the word size

#

which is usually the size of an int

upper vapor
#

if only we had

true cedar
#

yeah okay

upper vapor
#

alternate lookups

#

in unity

true cedar
#

i do wish we had those

#

i have debated making a new dictionary implementation to support them

hearty shard
#

make them urself

random scaffold
#

you just put all hints in one line?

true cedar
#

blood sweat and tears

upper vapor
hearty shard
upper vapor
#

that's possible

true cedar
random scaffold
true cedar
#

i use math

#

basically

true cedar
#

i use line heights to position things correctly

#

and compute the line height necessary so that a hint is at the same position

upper vapor
random scaffold
true cedar
#

relief

upper vapor
#

what if i told you you could do that already

#

kind of

true cedar
#

wdym

upper vapor
#

text toys

#

parent them to the player

random scaffold
true cedar
#

oh yea

#

okay thats

upper vapor
#

and send fake sync vars to rotate and text them

true cedar
#

i WANNA DO RUST

random scaffold
#

then do rust

hearty shard
#

get out

#

no more rust

upper vapor
true cedar
#

i have already had to make two (2) new collections just for this

hearty shard
random scaffold
true cedar
random scaffold
#

if it have toy.Rotation

upper vapor
hearty shard
upper vapor
true cedar
true cedar
#

In computer science, a radix tree (also radix trie or compact prefix tree or compressed trie) is a data structure that represents a space-optimized trie (prefix tree) in which each node that is the only child is merged with its parent. The result is that the number of children of every internal node is at most the radix r of the radix tree, wher...

hearty shard
upper vapor
#

now that i think about it

hearty shard
#

oh

unique crane
#

Tree xd

upper vapor
#

separate toy for each player

upper vapor
#

i've done that

true cedar
#

radix trie means that i can early return on tags

unique crane
#

Oh wait

#

prefix tree

#

I know that

true cedar
#

yea

upper vapor
#

word processing is uh

#

fun..n't

true cedar
#

they're different from prefix trees technically

#

prefix tries only store one char at a time

random scaffold
#

but not async

true cedar
#

im proud of my valuesorteddictionary

unique crane
#

I love state machines and such

random scaffold
#

im fuck microsoft lol

upper vapor
true cedar
#

prefix trie

#

i think prefix trie = prefix tree

#

but tree =/= trie

upper vapor
#

insanity

random scaffold
#

how i can make invisible door?

upper vapor
upper vapor
random scaffold
#

nw moment

upper vapor
#

david

unique crane
#

axwabo

upper vapor
#

have you tried animator state machines

#

-# SL has them

hearty shard
#

david i dont like you

upper vapor
#

i tried them

true cedar
#

make ur own state machine

unique crane
#

I have never ever touched animations in unity

upper vapor
#

like

#

to handle transitions

#

and conditions

#

like ugh

#

GIVE ME A GRAPH

true cedar
#

block programming

upper vapor
#

i've tried unity visual scripting
not worth it 😭

upper vapor
#

exactly

unique crane
#

When you know c#

#

its useless

true cedar
#

im ean

#

flowchart programming

#

i dont actually use unity

#

like to make games

upper vapor
#

be happy

true cedar
#

im not even a game dev

#

:3

upper vapor
true cedar
#

i would

upper vapor
#

show me

unique crane
#

I dont think its that hard

#

you just make nodes

#

graph

#

condition

#

active node

upper vapor
#

this makes so much more sense

unique crane
#

and check condition for transitions

upper vapor
#

than looking at spaghetti code

true cedar
upper vapor
#

wanna see the code i had for that?

true cedar
#

im already making this dumb fucking parser

upper vapor
#

shoot i leveled up

true cedar
#

im still level 10

#

:(

upper vapor
#

you gotta yap more

true cedar
#

@hearty shard teach me ur ways

#

of yapology

hearty shard
#

get away from me

random scaffold
#

primitives will be hidden by big distance?

unique crane
upper vapor
# upper vapor than looking at spaghetti code
public sealed class DisplayUpdater : DisplayUpdaterBase
{

    private float _remainingTime;

    private State _state;

    private void Update()
    {
        switch (Driver.State)
        {
            case (_, ServiceArea):
                UpdateServiceArea();
                break;
            case (DrivingPhase.Stopped, Terminus):
                UpdateTerminus();
                break;
            case (_, Origin):
            case (DrivingPhase.Stopped, _):
                UpdateStopped();
                break;
            case (_, TrafficTarget):
                UpdateMoving();
                break;
        }
    }

    private void UpdateServiceArea()
    {
        if (_state != State.ServiceArea)
            SetText("Üzemi terület");
        _state = State.ServiceArea;
    }

    private void UpdateStopped()
    {
        if (!TryGetJourney(out var journey) || (_remainingTime -= Clock.Delta) > 0)
            return;
        _remainingTime = 5;
        _state = _state == State.Route ? State.Destination : State.Route;
        UpdateDisplay(journey);
    }

    private void UpdateTerminus()
    {
        if ((_remainingTime -= Clock.Delta) > 0)
            return;
        _remainingTime = 5;
        _state = State.Terminus;
        SetText("végállomás");
    }

    private void UpdateMoving()
    {
        if (!TryGetJourney(out var journey) || (_remainingTime -= Clock.Delta) > 0 || Displays.Any(e => !e.ScrollingCompleted))
            return;
        _remainingTime = 8;
        _state = Driver.State switch
        {
            (DrivingPhase.NearTarget or DrivingPhase.Stopping, Terminus) => _state == State.Terminus ? State.StopName : State.Terminus,
            (DrivingPhase.NearTarget or DrivingPhase.Stopping, _) => State.StopName,
            (_, Terminus) when _state == State.StopName => State.Terminus,
            _ => _state switch
            {
                State.Route => State.StopName,
                State.StopName or State.Terminus => State.Connections,
                _ => State.Route
            }
        };
        UpdateDisplay(journey);
    }

    private void UpdateDisplay(ITrafficJourney journey) => SetText(_state switch
    {
        State.Route => $"{journey.LineName}        {Clock.Now:HH:mm}",
        State.Destination => $"►{journey.Destination}",
        State.StopName when TryGetStop(out var stop) => stop.Name(),
        State.Terminus => "végállomás",
        State.Connections when TryGetStop(out var stop) => stop.Connections(),
        State.ServiceArea => "Üzemi terület",
        _ => throw new InvalidOperationException()
    }, _state == State.Connections || _state == State.StopName && !Driver.IsCloseToStation());

    private enum State
    {

        Route,
        Destination,
        StopName,
        Terminus,
        Connections,
        ServiceArea

    }

}
random scaffold
upper vapor
#

a switch statement which goes to a switch expression that might have a switch expression

upper vapor
random scaffold
#

bruh

upper vapor
#

kinda

unique crane
#

You have to do it yourself

random scaffold
#

nw moment

upper vapor
random scaffold
#

why its exists if its even not in the render distance

random scaffold
#

but im lazy

#

so i will be

#

lol

#

exists easy way connect player with primitives?

#

if im moving primitive, player too

#

but player can override it

#

and moving too

upper vapor
#

no easy way

random scaffold
#

unity moment

#

then how

#

it do

upper vapor
#

override position

#

but that's bad for player experience

#

cuz they won't really be able to move

random scaffold
upper vapor
#

you don't

random scaffold
#

no

#

its possible

#

or not

#

just add offset of the primitive to the player position

#

per frame

upper vapor
#

that kinda works

#

but you still get flickering

random scaffold
#

per frame it must be normal

upper vapor
#

cuz you override the position on the server

#

the client is moving

#

but by the time the position is applied, the player's already moved

random scaffold
#

but it works normal in other unity games

upper vapor
#

other unity games 😭

hearty shard
#

do all unity games use mirror

#

and are all unity games identical

#

😭

upper vapor
#

are all unity games SL

random scaffold
#

yes

upper vapor
#

me when

hearty shard
#

no?

upper vapor
#

netcode for gameobjects

hearty shard
#

Town of Salem is multiplayer

#

does not use Mirror

random scaffold
#

..................

#

fucking mirror

hearty shard
#

anyway

upper vapor
#

it's not mirror's fault

hearty shard
#

yeah its

#

well

upper vapor
#

SL just doesn't have a system to parent players

hearty shard
#

SL has an effect

#

that prevents movement

#

from client

#

i mean

random scaffold
#

i wanna just make bullying/jail system

hearty shard
#

falling will still be a thing

random scaffold
#

bruh

hearty shard
random scaffold
#

i wanna movable cameras

hearty shard
#

and make it so they cant go anywhere from it 😭

#

nuh uh

upper vapor
#

notice the flickering?

#

i'm not even moving

#

TPS != client FPS

random scaffold
upper vapor
#

yes

#

that's the point

#

you won't get smooth movement with the platform

#

let alone moving on the platform

#

petition for NW to add a relativeprimitive toy

#

or something like that

hearty shard
#

@daivd

#

shit

#

i cant spell

upper vapor
#

xd

hearty shard
#

@unique crane

unique crane
#

skill issue

hearty shard
#

david

#

i hate you

#

im gonna reinvent bad things

unique crane
#

I hate you too

upper vapor
#

i've done that

#

:3

hearty shard
upper vapor
hearty shard
#

and

#

secretapi IS the dependency

upper vapor
unique crane
#

me neither

upper vapor
#

i freaking knew it lmao

true cedar
#

i kinda wanna make a giant util thing but also

hearty shard
true cedar
#

i don't wanna make people install it

upper vapor
random scaffold
#

why even animations doesnt smooth

#

........

upper vapor
#

"shit ton of actually useful stuff"
vs
"ugh people need to install"

true cedar
#

rue package manager someday

upper vapor
upper vapor
ionic prawn
#

can someone help me figure out why i cant escape

public static void ProccessRoleEscape(
PlayerEscapingEventArgs ev,
RoleTypeId TargetRole,
RoleTypeId EscapedRole,
bool Disarmed)
{
    ev.EscapeScenario = Escape.EscapeScenarioType.Custom;

    if (ev.Player.IsDisarmed == Disarmed)
    {
        ev.IsAllowed = false;
        ev.NewRole = EscapedRole;
    }  else {
        ev.IsAllowed = false;
        ev.NewRole = EscapedRole;
    }
}


public override void OnPlayerEscaping(PlayerEscapingEventArgs ev)
{
    PluginFunctions.ProccessRoleEscape(ev, RoleTypeId.FacilityGuard, RoleTypeId.NtfSergeant, false);
    PluginFunctions.ProccessRoleEscape(ev, RoleTypeId.FacilityGuard, RoleTypeId.ChaosConscript, true);

    PluginFunctions.ProccessRoleEscape(ev, RoleTypeId.ChaosConscript, RoleTypeId.NtfPrivate, true);
    PluginFunctions.ProccessRoleEscape(ev, RoleTypeId.ChaosMarauder, RoleTypeId.NtfPrivate, true);
    PluginFunctions.ProccessRoleEscape(ev, RoleTypeId.ChaosRepressor, RoleTypeId.NtfCaptain, true);
    PluginFunctions.ProccessRoleEscape(ev, RoleTypeId.ChaosRifleman, RoleTypeId.NtfPrivate, true);

    PluginFunctions.ProccessRoleEscape(ev, RoleTypeId.NtfPrivate, RoleTypeId.ChaosConscript, true);
    PluginFunctions.ProccessRoleEscape(ev, RoleTypeId.NtfSpecialist, RoleTypeId.ChaosConscript, true);
    PluginFunctions.ProccessRoleEscape(ev, RoleTypeId.NtfSergeant, RoleTypeId.ChaosConscript, true);
    PluginFunctions.ProccessRoleEscape(ev, RoleTypeId.NtfCaptain, RoleTypeId.ChaosRepressor, true);

    PluginFunctions.ProccessRoleEscape(ev, RoleTypeId.Tutorial, RoleTypeId.ClassD, true);
}
ionic prawn
#

im not using exiled

random scaffold
#

then skill issue

upper vapor
random scaffold
upper vapor
#

you're canceling the event

true cedar
#

pattern matching switch statements are not faster than a bunch of if statements

upper vapor
#

i know

#

but they look cleaner

grand flower
#

I'm patching it myself atm but any chance of making the bring/goto commands reset the player's fall damage immunity mmLul

true cedar
#

okay good

grand flower
#

just for QoL

upper vapor
#

for type matching, they can be

grand flower
#

if you bring a player to your position their fall damage isn't reset

#

so if they were falling, they'll die the second you teleport them

unique crane
#

Should have not fall /shrug

true cedar
#

im pretty sure its still just compiled to a bunch of if statements

upper vapor
#

if you write the if well enough, no

#

but it compiles to the most optimal

grand flower
#

most of the time you don't use them for performance anyway

#

they're just hella clean

unique crane
#

Depends on the decompiler

#

ive seen Visual studio decompile switch as one giant if else

upper vapor
#

switches have their own opcodes

#

so if the decompiler is stupid

unique crane
#

and dotpeek normally

upper vapor
#

vs decompiler

#

then yes you'll get if-else statements

random scaffold
#

rm rf /f

upper vapor
#

nvm i take it back

royal mica
upper vapor
#

for type matching there's just ifs

true cedar
#

switch statements are only compiled to switch if all the values are consecutive and start at 0

royal mica
#

so for dev QOL just use pattern matching

royal mica
#

wait

ionic prawn
ionic prawn
#

like that

upper vapor
#

there are clever optimizations

royal mica
#

That event just straight up prevents escaping

#

you are IsAllowed = false on both cases

ionic prawn
#

no it dosent?

royal mica
#

that whole code is wrong

#

yes it does

ionic prawn
#

public static void ProccessRoleEscape(
PlayerEscapingEventArgs ev,
RoleTypeId TargetRole,
RoleTypeId EscapedRole,
bool Disarmed)
{
if (ev.Player.Role != TargetRole) { return; }

    if (ev.Player.IsDisarmed == Disarmed)
    {
        ev.IsAllowed = false;
        ev.NewRole = EscapedRole;

    }  else {
        ev.IsAllowed = false;
        ev.NewRole = EscapedRole;
    }
}
royal mica
#

yes exactly. Your both branch is ev.IsAllowed = false

upper vapor
#

ev.IsAllowed = false prevents the escape entirely
no role change will be performed

royal mica
#

that prevent escpaing from running

true cedar
ionic prawn
#

ohh

royal mica
#

and also both of your branched does the same thing

#

you are not using the TargetRole

ionic prawn
#

i feel dumb

royal mica
#

The code in the Event function is executing one by one, meaning the last execution is used

ionic prawn
#

i started like 3 weeks ago and like its for me like isallowed false and then there is an isallowed true 😭

upper vapor
#

it's weird but smart

royal mica
#

and also after some branches, switch is compiled to a jump table anyway

unique crane
#

@ionic prawn You can handle the escaping like this

#

easiest solution

royal mica
#

just use switch how you like and the compiler will handle it tbh

#

if switch becomes if-else, why bother with if else, when switch looks better (personally) and easier to remove / add branches

true cedar
ionic prawn
true cedar
#

i refuse to believe

unique crane
#

and per role

ionic prawn
true cedar
upper vapor
#

look at this insanity

true cedar
#

ah ic

upper vapor
true cedar
upper vapor
#

there's a link to this in the article

#

lowering

true cedar
#

In fact, the switch statement does not exist in C#. There is a step in the compilation of C#, which rewrites switch statements to if-statements. This step is called lowering. It translates high-level language features to low-level language features.

#

that first line is just not true grrr

upper vapor
#

the switch statement does not exist in C#

#

who wrote that

upper vapor
true cedar
#

fuck my life

icy knoll
true cedar
#

i think they meant that the switch statement was syntatic sugar

#

which is true sometimes but sometimes its not

icy knoll
#

me when there is 2 switch statements

upper vapor
#

ye

upper vapor
#

there's a switch statement and a switch expression

icy knoll
#

thing switch { }

#

switch(thing) {}

upper vapor
#

that's the latter one

icy knoll
upper vapor
#

not the same thing

icy knoll
#

to me they are ax!!

upper vapor
#

switch expressions need to find a common type for all casess

#

and they can't be void

upper vapor
true cedar
#

1

upper vapor
#

i agree but that 1 disarmed false condition bugs me

true cedar
#

looks fine

#

i prefer it to the other option

upper vapor
#

if (disarmed && role == guard)
{
newrole = chaos
return
}
// rest of switch

#

i guess

true cedar
#

yea i was thinking that too

#

if u want it more optimized thats prob it but

grand flower
#

Escapes are a one off, you shouldn't care about microoptimizing that

upper vapor
#

it's more about which code looks better

grand flower
#

first one

true cedar
#

think about this if you save 5ns 50,000 times every frame thats 0.25 milliseconds

#

clearly worth it

upper vapor
#

you're the optimize guy

#

how dare you say this

grand flower
#

I optimize stuff that gets us measurable increases in TPS DogKek

unique crane
#

Me when I save 1ns of escape code

#

(its run like 7 times per game)

#

7ns saved

#

yipeeee

upper vapor
#

extending the CPU's lifespan

true cedar
#

by making code more efficient

#

ur helping to reduce energy usage

#

and thus saving the environment

upper vapor
true cedar
#

thats why this 3ns improvement is worth an extra 30 lines of code

grand flower
#

I paid for 16 cores i'm using 16 cores

upper vapor
#

but think of the environment!

plain gazelle
#

What is the intended way of deleting an AdminToy?

upper vapor
#

toy.Destroy

#

for the wrapper

#

which calls NetworkServer.Destroy

true cedar
random scaffold
#

how i can safety destroy gameobject of the door?

#

so that this is handled correctly and removed from the Door.List

#

just Destroy()?

plain gazelle
#

Thanks

upper vapor
#

np

upper vapor
#

be sure to check though

#

iirc the waypoint is removed with it but i'm not entirely sure

true cedar
#

scp doesn

#

't

#

support burst does it

hearty shard
#

What

true cedar
#

burst compiler

grand flower
#

don't think so

#

not the way it's built at least

hearty shard
sinful bronze
grand flower
#

It's fine I'll just make my own SL with blackjack and no relative positioning

#

and 100 player support

sinful bronze
#

U can make it in sl

true cedar
#

can u also add women

#

wow sexism

sinful bronze
#

Im very sexist

#

!!!

grand flower
#

server can handle it, I've gotten them to run with 100 players @ 30 TPS

#

but it's not the ideal experience for the players

#

maps aren't built for it

#

and the clientside performance is abysmal

sinful bronze
#

But server can have more than 100 players

#

But player's pc will explode

grand flower
#

yeah so what's the point hah

#

If I were to embark on my own SCP project I'd target 64 players per server w/ "support" for 100

sinful bronze
#

When multiplayer code rework

unique crane
#

Ah yes lets rewrite whole game

#

great idea buddy

#

Next update in: never

grand flower
#

Hire me and I'll do it out of pure annoyance with some of it

#

for free

sinful bronze
#

Rewrite game NOW

plain gazelle
#

i just wish audio bug >45 players would be fixed

grand flower
#

fix: never

sinful bronze
grand flower
#

At that point might as well start from scratch

true cedar
sinful bronze
#

But it will ever happen

true cedar
#

if too many voicemessages are sent in one frame

#

get rid of some of them

sinful bronze
#

One player before 13.5 can crash voice chat

true cedar
#

i made brights fix for that B)

sinful bronze
#

I think still exist some exploits for this

true cedar
#

it just plays a really really really really loud sound

hearty shard
grand flower
#

unless

#

that wasn't in 14.0

#

not sure

#

had to like, scrap a handful of patches because 14.0/14.1 broke em

true cedar
#

its fixed base game anyways

grand flower
#

fair

#

probably why it broke

plain gazelle
true cedar
#

i think we removed it anyways

grand flower
#

GameOptimizer? yeah it was gone but I rewrote some of the stuff in it and got it back in 14.1

#

added the fpc relative positioning caching and round robin to it too

#

i just wish relative positioning wasn't a thing

sinful bronze
#

NW will legalize mods when they will to lazy to update sl ac

true cedar
#

didnt round robin break

sinful bronze
#

And servers will write own anticheats!!!

grand flower
#

everything's fine with it

#

bit of jitter on very high speed players/scp-173 but nothing game breaking

#

very high speed as in > 150% movement speed

sinful bronze
#

Guys i have an idea how to rework all game code

true cedar
plain gazelle
#

I have this SendFakeSyncVar method, sent/written(?) by @restive turret but i only learnt how to use it for PrimitiveObjects
And now i want to ask anyone here, or the legend himself if he sees this, how i could use this for other Toys like the TextToy, to change what it says for individual players
(Or solve it a different way: How could i make a TextToy only visible for certain players?)

grand flower
true cedar
#

ik but like

grand flower
#

so there's no way to grant an exception unless I add like

#

a second loop

true cedar
#

can u make 173 always send its position

grand flower
#

I could but it's 173

#

the second you look at it, it stops moving

hearty shard
#

nuh uh

#

do it

grand flower
#

so the jitter is really only visible for SCP teammates and spectators, and it's nothing too bad

true cedar
#

oh

#

fix NOW.

hearty shard
#

see pai gets it

grand flower
#

I also made it not send positions to custom dummies

#

could make it not send positions to actual dummies but we never use those outside of testing so w/e

restive turret
#

uh for only visible into individual player

#

that is something like DestroyMessage into player

true cedar
#

use a WriterExtension<T> static class

restive turret
#

just make sure you dont send any info about that net entity to the player

restive turret
true cedar
#

and store the function in there

#

no make ur own class

plain gazelle
true cedar
#
   public static Action<NetworkWriter, T> Action { get; internal set; }
}
plain gazelle
true cedar
#

im sorry that was mean and uncalled for

#

but u can make it a lot more efficient

restive turret
#

@plain gazelle u can make I think is FakeSync the Scale to be Vector.zero

#

This will make receiving player not see the object

plain gazelle
plain gazelle
#

@restive turret taught me how to use the FakeSync on PrimitiveObjects and there i had to go and find the uLong, which were in the PrimitiveObject class for the variables that i wanted to change.
But for Scale, i can't find any uLong value, so i am not sure what to do...

restive turret
true cedar
#

add a type param :3

restive turret
#

So Typeof T will not like work

#

Still doesn't know wtf do i do with the ext

#

And dont wanna grab all existing ones

true cedar
#

i mean

restive turret
#

Scale is 4uL

#

But u have to fix the SendSyncVar.
By just replacing the WriteULong(0) => WriteULong(dirtyBit)
Inside the IsSubClassOf

plain gazelle
#

Like that?

restive turret
#

Ye

plain gazelle
#

Will it still work for the PrimitiveObject stuff? Since it worked before firT

restive turret
#

Ye

#

It will work because I mistakenly set to 0 so even if you send a Base AdminToy SyncVar it will doesn't do anything with it

#

Btw the 4uL was inside the AdminToyBase class

plain gazelle
#

Ohhh

#

ah....

#

Thank you

#

Thank you so so much x.x

restive turret
plain gazelle
#

yeah i had to use textToy.Base ^^

restive turret
#

Neato

#

@true cedar ah btw ye you right with that class only , i can simply just use writer.Write<T>(syncVar) but in other place I dont have type T or any type like that

ionic prawn
hearty shard
ionic prawn
#

yippe 😄

#

does anyonoe knows what causes it evne

#

even

#

like what makes the screen black

hearty shard
#

or smth

#

this

ionic prawn
#

someone will make a plugin to fix it before NW fixes it

unique crane
ionic prawn
#

bruhhh

hearty shard
#

me when the visual bug is client side

ionic prawn
#

easy dr brights suicide vest

#

killed puppet

grand flower
#

i think you're on the wrong server

random scaffold
#

eve moment

ionic prawn
#

legendary item be like

#

i just found it on the floor 💀

grand flower
#

That's generally where those items spawn yeah mmLul

ionic prawn
#

just saw a yellow light with heavy armor in heavy

ionic prawn
#

is it very fine?

random scaffold
#

@sinful bronze scp-127 obscenely expressed SteamHappy

icy knoll
#

in IL, can I use ldloc.1 here to get the output of the code below or do i have to get it from the code below?

random scaffold
#

evve moment

#

it works

random scaffold
#

which will be used in method

#

after callvirt just add stloc.0

#

to save value

#

powered chatgpt

#

how i can get desync animation for each object?

#

one animator

#

but separately objects with desync animation

#

why did the Northwoods steal the stars from 90 angle?

grand flower
#

dummies can't have custom info?

#

seems like the issue was a color tag in the custom info

#

would be nice to get a warning in the console if the game decides to block it for whatever reason

upper vapor
upper vapor
#

you gotta load the local onto the stack again if you wanna do something with it while keeping the original call

#

or use dup

#
ldloc.1 // original
dup
call MyPatch.Print(whatever type)
callvirt // original
teal junco
#

how expensive would it be to initialize a BinaryReader & MemoryStream?

upper vapor
#

not that significant

#

are you reading a custom binary file?

teal junco
#

yes

#

well what i want to do

upper vapor
#

if you don't do it every frame then you'll most likely be fine lol

teal junco
#

is to write/read a shit ton of custom binary formats

teal junco
upper vapor
teal junco
#

for reading

upper vapor
#

but you don't create a new memorystream every frame, right?

upper vapor
#

that's fine

teal junco
#

hmmmm sorry my brain is working at half capacity right now

#

i think i have an efficient solution but i cannot articulate it to you

#

I think if i just directly take a BinaryReader then this will be fine?

#

if I have a FileStream and make a BinaryReader for it, and put in the BinaryReader as an argument, then it skips initialization entirely...

upper vapor
#

oh if you already have the byte array (not recreated every frame) then it's okay to read from that

#

creating new memory streams or arrays every frame is not fun

teal junco
#

but wait this should be fine right

upper vapor
#

also, couldn't you just

#

store the position snapshots

#

and write them every n seconds

upper vapor
teal junco
#

if youre talking about writing them

upper vapor
#

can you show more context?

upper vapor
teal junco
#

I would store a backlog of snapshots into memory and then write it to a file and clear the memory stream every few seconds

grand flower
#

If you're going to have a buffer that you'll re-use, use a circular buffer

teal junco
# upper vapor can you show more context?

I want to have a system that records data like Position, PlayerId, etc every frame, and eventually writes it to a file, and another system that reads that file and gets useful information from it like the Pos, PlayerId

grand flower
#

misread

upper vapor
#

a buffer that wraps around when reaching the end

grand flower
#

ignore me

teal junco
#

Oh alright

upper vapor
#

although in this case it's not applicable

#

cuz you don't know the buffer size and you don't want to overwrite existing data

teal junco
#

Yeah

upper vapor
#

so after you write the memorystream to a file, do you clear the memory stream?

teal junco
#

Yeah, I forgot which method does that but I'm pretty sure there is one

#

I just need to have an efficient serializer so that it can run many times every frame

upper vapor
#

okay just make sure you only copy the amount of bytes actually in the stream
memorystream.Length

restive turret
#

Flush

#

Close

upper vapor
#

again, you can use symlinks

#

mklink

#

although it would be nice to have that

unique crane
#

I though we had global configs

restive turret
#

Just most devs not using it

upper vapor
#

ln -s /home/james james

unique crane
upper vapor
#

getconfig global

#

but you can't configure the file, right?

unique crane
#

You can't?

#

Okay I'll try this out when I get out of bed

upper vapor
#

no option for configs

restive turret
#

.50 maybe

unique crane
#

Sure

upper vapor
#

50 HUFs

unique crane
#

I am more bribeable by food

upper vapor
restive turret
#

Well SCPDiscord has a folder inside configs/global

unique crane
restive turret
#

Google it

upper vapor
#

traditional hungarian cuisine

unique crane
#

Ohhh langos

upper vapor
#

yes

#

fried bread 😭

unique crane
#

@upper vapor

restive turret
#

Fry me

restive turret
upper vapor
restive turret
#

Now what

unique crane
#

Well thats in the labapi now...

restive turret
#

I dont get it

unique crane
#

You just have to do this

#

@full wedge

upper vapor
#

that's

#

i know that

#

they want the configs to be global for all plugins

restive turret
#

LoadConfig of other config that is checks if its a global plugin

#

Funny

#

Well not all plugins made like that in mind

unique crane
#

It is kind of a flaw yea

#

that only plugin dev can specify

#

it

restive turret
#

Also there is no such a thing in the plugin's config as "useGlobal" in this plugin

upper vapor
#

just use symlinks bruh 😭
ln -s /path/to/file /path/to/symlink

unique crane
#

Thats one way yea

upper vapor
#

until we get official supoprt

restive turret
upper vapor
restive turret
unique crane
#

is that unity version or what

restive turret
#

That's when

#

David

unique crane
#

Hmmmmmm if I add a list to LabApi-yourserverport.yaml

restive turret
#

Is beryl okay?

unique crane
#

for server hosts to set which plugin to load with global config

#

that could work?

unique crane
restive turret
upper vapor
#

for port or global

restive turret
#

Where

upper vapor
#

you wouldn't load two of the config, would you?

restive turret
#

In my

unique crane
#

oh wait

#

properties

restive turret
#

Wha

#

Oh the is_enabled one

unique crane
#

Yea

#

add like

#

force_use_global_config

upper vapor
#

but you'd need to set that for each plugin

unique crane
#

Yes

#

but only once

upper vapor
#

uh

unique crane
#

Like

#

you just load the plugin, set that property to true

#

and you can use the global config

#

Instead of the local one

upper vapor
#

i guess yea

#

it would require like a 2-line change

#

3

icy knoll
#

we havent had an update to the repo in ages

unique crane
#

No.. its just that Jesus is new labapi team lead

icy knoll
#

oh that's confirmed?

upper vapor
#

then... is jesus okay

unique crane
#

He has the role yea..

upper vapor
icy knoll
unique crane
#

Well

icy knoll
#

beryl usually did it

#

and they arent labapi team

unique crane
#

Yea

#

team lead for labapi prs

#

Beryl for base game ones

upper vapor
icy knoll
unique crane
#

I cannot confirm anything

#

or promise

#

I can just do it and ping with the PR

restive turret
#

Or u mean internally?

unique crane
#

Yes

#

Ofc you can do that

#

Labapi is open source and you can just switch the dll in the server files with your own

#

Works fine

#

Yea

#

modded flag is added whenever any plugin is loaded

restive turret
upper vapor
unique crane
#

😐

restive turret
#

Gone

#

Forever

unique crane
#

Too bad

#

go back to nwapi

restive turret
#

Going back to synapse

unique crane
#

I was also thinking about editing wiki

#

like

#

yea..

upper vapor
#

me when CustomEventHandlers in the wiki

restive turret
#

Me when

#

I just type LabApi. And balling with the search

icy knoll
#

does anyone know how to get a property from a method im patching?

unique crane
icy knoll
#

yeah sorry

#

parameter

unique crane
#

ref type name

#

in the patch method

icy knoll
#

forgot to mention transpiler

#

oops

unique crane
#

@upper vapor

icy knoll
#

cant do that in a transpiler can i? or can i 😭

unique crane
#

Ofc you can?

#

its like ldargs or something

icy knoll
#

yeah i just cant see anything in IL for it idk

unique crane
#

Idk I dont use transpliers much

#

Ax will know

icy knoll
#

im just replacing 1 line of code with smth different lol

#

and it's getting more complicated now

unique crane
#

I would go to the base game code

#

copy it

upper vapor
#

Wha

unique crane
#

change my thing

#

make prefix patch

upper vapor
#

Ldarg.0 (this)

#

Call

unique crane
upper vapor
#

The method can be accessed with AccessTools.PropertyGetter

icy knoll
#

wdym "call" now?

upper vapor
#

The property getter

icy knoll
#

yeah but what property am i getting

restive turret
#

The property you want

#

Like

#

food { get; set; }

icy knoll
#

i dont want a property rn lol

restive turret
#

Internally you do is virtcall get_food()

icy knoll
#

i just want the argument

restive turret
#

Tell more indepth

#

Cus no idea what u want nor talking about

icy knoll
#

ok

#

ill explain it

#

eve made a silly mistake and she told me what to do

I need to replace this:

ServerSpecificSettingsSync.SendToPlayer(player.ReferenceHub, specificSettingBaseList.ToArray(), version);

with this

player.Connection.Send(new SSSEntriesPack(specificSettingBaseList.ToArray(), version))

which is why I am using a transpiler

upper vapor
#

Then just load the argument

restive turret
#

.. yeah

upper vapor
#

Create a method in your patch class that does the heavy lifting and call that with the arg

icy knoll
#

true

restive turret
#

But ye axwabo was right

#

Its ldarg (index)

#

ldarg 2 is the 3rd arg

#

Or 2nd

#

Whateve

#

0 being this usually

icy knoll
#

wait turns out that i didnt actually need to do this patch

#

lol

restive turret
#

Cus u have the source

icy knoll
#

no

#

just that the patch is useless

#

this is the patch to fix the issue:

hearty shard
icy knoll
#

EVEEEEEEEEEEEEEEEEEEEEE

hearty shard
#

its wip

#

it also will include breaking changes so id like to not push it yet kek

restive turret
#

Wnever iwillbe preleased

hearty shard
#

1.1.2 is what we got to before i decided to finally do SSSS how i wanted

restive turret
#

Lel

hearty shard
#

LINQ my beloved

#

i forgot to put red on the first foreach

#

still

#

😭

unique crane
#

GroupBy(static setting => setting.Header)

#

Less alloc :3

#

Saved you few bytes no need to thank

hearty shard
#

i want to stab you

#

but yeah

#

i might have to do that more often

unique crane
#

And you could perhaps

#

Use pooled list

hearty shard
#

oh yeah

unique crane
#

for the ordered

hearty shard
#

i deleted that

#

at some point

#

i dont remember why

restive turret
#

What if want more bytes

unique crane
#

Create a gigabyte int array

restive turret
#

Nah

#

Allocate all ram

#

Into a big array

#

An ulong array

hearty shard
#

the other was dev

#

this is the new one

#

ill make the first list listpool too dw

#

i could also replace hasAccess with an if statement inside the first foreach

#

@unique crane do you agree

#

!!!!

unique crane
#

Same for select

#

static setting => ...

hearty shard
#

mightve missed it

icy knoll
#

is this how string builder pools work?

StringBuilder builder = StringBuilderPool.Shared.Rent()

...

return StringBuilderPool.Shared.ToStringReturn(builder);```
icy knoll
#

and i get more performance from this? crazy

unique crane
#

No you get less allocation when working with strings

hearty shard
#

is nicer to work with strings with it

icy knoll
#

no like

#

i was using StringBuilder before

#

just moved to pools

#

so idk what it does but people say it's better so

hearty shard
#

a pool just stores existing of an object

#

to be reused

#

so you dont new() it

#

every tick or wtv

restive turret
#

Pool?

#

Like

#

Swimpool

hearty shard
#

@icy knoll show what you did

#

for the uh

#

teleport thing

#

safe position

#

whatever

icy knoll
#

i never got round to testing it

hearty shard
#

i was gonna

#

use basegame

#
public static Vector3 GetSafePosition(
    Vector3 position,
    Vector3 direction,
    float range,
    CharacterController charController)
  {
    direction = Quaternion.Euler(0.0f, UnityEngine.Random.Range(-30f, 30f), 0.0f) * direction;
    float radius = charController.radius;
    float num = Mathf.Lerp(radius, range, UnityEngine.Random.value);
    Vector3 vector3 = Vector3.up * charController.height / 2f;
    Vector3 origin = position + charController.center + SafeLocationFinder.GroundOffset + Vector3.up * radius;
    RaycastHit hitInfo;
    return !Physics.SphereCast(origin, radius, direction, out hitInfo, num + radius, (int) FpcStateProcessor.Mask) ? origin + direction * num + vector3 : hitInfo.point + hitInfo.normal * radius + vector3;
  }
#

but i need charController

#

i guess this?

upper vapor
#

you want this for a player, right?

hearty shard
#

well i guess so yeah

upper vapor
#

check if they have an ifpcrole and get the fpmm, which should contain the cc

icy knoll
#

reminder to check if the best position for the player is safe too

#

check it first ofc

restive turret
#

But please don't fucking put them in the elevator

#

Larry sent me into pocket in elevator and when I'm escaped it put me into the same elevator with 106 inside too

hearty shard
#
public static bool GetSafeTeleportPoint(this Player player, FacilityZone zone, float range, out Vector3 teleportPoint)
        {
            if (player.RoleBase is not IFpcRole fpcRole)
            {
                teleportPoint = Vector3.zero;
                return false;
            }

            Pose[] poses = Scp106PocketExitFinder.GetPosesForZone(zone);
            if (poses.IsEmpty())
            {
                teleportPoint = Vector3.zero;
                return false;
            }

            Pose pose = Scp106PocketExitFinder.GetRandomPose(poses);
            Vector3 position = SafeLocationFinder.GetSafePosition(pose.position, pose.rotation.eulerAngles, range, fpcRole.FpcModule.CharController);
            teleportPoint = position;
            return true;
        }
#

i wish i understood the math

restive turret
#

Please check is 106 not inside that pose

#

Or room

#

Or whatever

hearty shard
#

shouldnt i check for any

#

player?

#

well

restive turret
#

Ye

hearty shard
#

"enemy" player

restive turret
#

Do it

hearty shard
#

💔

#

why would you do this to me

restive turret
#

You did this to yourself

hearty shard
#

nuh uh

#

what if i just

#

dont

#

sounds like a YOU problem

#

i also realize

#

this should fail if nuke has gone off

#

and its not surface

#

or decontam for lcz

#

or should they?

restive turret
#

Idk

#

Skill issue on your part

#

@hearty shard you should make it 2/8 change that you go back to pocket

hearty shard
hearty shard
#

why would I do that

#

thats for plugin

#

im making extensions

#

to find a safe place to teleport

#

😭

#

not replacing 106