#plugins-dev-chat
1 messages · Page 38 of 1
Considering the amount of maintenance required on mine i don't think it'd matter
Keep it on an elevated surface
Keeping it on the ground causes it to collect more dust
Doesn't matter if you maintain it often enough
is there any class of SurfaceAccessPass keycard?
@harsh thorn sir
why with task.run server lag to 1-2 seconds each join of the player
bruh
but without it works normal
what if you used awaitables
task.run doesnt do what you think it does when you mix it with async/await, but i wouldnt of thought it would be the cause of hanging the server for 1/2 seconds. so thats abit strange
Are you connecting to the DB somewhere else too?
no
you should show what you are doing in ExistsByUserId and Add
^
that doesnt really tell us anything
did you rewind the writer to its position before reading the uint?
you will need to show all the async code, all the way down. the issue is likely you are blocking somewhere
it shouldn't block the main thread if we're doing Task.Run
it will, after the first await its back on the main thread
thats why i said using task.run doesnt do what you think it does
ugh threadpool
not really todo with the theadpool
its how async/await works, with Unity specifically. see the UnitySynchronizationContext
Wait, after first await it returns to main thread?
Damn that is very obscure
yep
checks out
nvm
unrelated post
again,
Capturing a synchronization context increases the performance overhead of your application and waiting for the next frame Update to resume on the main thread introduces latency at scale. You can avoid both these issues by using Awaitable instead.
tbf unity does say this alot, in multiple places
i haven't come across the unity sync context yet somehow
the returning to main thread that is ^
not many people use async/await in plugins so it doesnt surprise me
So, wait. If there is a Task, which runs an async function, and an await happens, the next frame it'll use unity main thread instead of the ThreadPool task thread?
yes
Holy shit thats why sending discord webhooks kill the game when discord has issues 
its a reason why you dont need Task.Run just do _ = AsyncMethod(); instead
yeah its because you cant use the UnityAPI from another thread and this reduces the chances of devs fucking things up
so how me need do in result?
yeah the problem is that we do a while loop in there, not sure if that blocks despite being asnyc
Awaitables
Hmm, then I suppose I need to refactor it into a Coroutine async instead of Task.Run
Truly Unity moment
far easier to just replace with awaitable
you can do AsyncMethod().ConfigureAwait(false) if you need to contintue on the same thread and not move to the main thread after the await
Task<T> -> Awaitable<T>
and
await Awaitable.BackgroundThreadAsync();
that too
Task.Run is good for Heavy CPU based tasks, using it for I/O is abit weird
but its already that
you return tasks and not awaitables
The main motivation was we are running a while loop that is consuming queue and didn't want to lock up frames for consumption
but I guess this caused the ultimate failures
Task.Run(async () =>
{
if (!await UsersModule.Repository.ExistsByUserId(userId))
{
await UsersModule.Repository.Add(new(userId));
}
});
``` how me need change it then?
private async Awaitable<float> DoHeavyComputationInBackgroundAsync()
{
await Awaitable.BackgroundThreadAsync();
// here we are on a background thread
// do some heavy math here
return 42; // note: we don't need to explicitly get back to the main thread here, depending on the caller thread, DoHeavyComputationInBackgroundAsync will automatically complete on the correct one.
}
public async Awaitable Start()
{
var computationResult = await DoHeavyComputationInBackgroundAsync();
// although DoHeavyComputationInBackgroundAsync() internally switches to a background thread to avoid blocking,
// because we await it from the main thread, we also resume execution on the main thread and can safely call "main thread only APIs" such as LoadSceneAsync()
await SceneManager.LoadSceneAsync("my-scene"); // this will succeed as we resumed on main thread
}
#plugins-dev-chat message whats going on here? why is it return (long)await ExecuteScale(...
that doesnt look like correct code
you go to the background thread and boom
Oh no thats fine
also yeah
SELECT count() returns single value
why count all entries if any match
does long get implicitly converted to bool
Also which DMBS are you using? Oh mysql
let them count the thousands of entries 
You need to do SELECT EXISTS(SELECT * FROM table1 WHERE ...)
it show same what count(*)
Because exists requires a subquery
you in anyway get all lines
Doubt he has more than 200 xd
also with exists you do not get all lines, it stops at first line

Thats still nothing for DB
Still passable without indexes 😛
😐
why it
but easier just make separately service
bruh
why not
it easier than lost 10 hours to do https://docs.unity3d.com/6000.1/Documentation/Manual/async-awaitable-introduction.html
Why are you even awaiting in seperate thread
db calls
it faster
before server have lag
but he have and now lol
Async doesn't make it faster, it just makes it so it can do other stuff in the thread until it is complete 😄
And since that thread is purely for sending db the data..
Bus stop analogy. You can check your phone while waiting for the bus, you do not need to stand still looking for the bus
the illusion of multithreading
so lags doesnt must exists?
Its not like its gonna cook TPS meanwhile
bus.Arrive().Wait()
Also you can combine the queries into a single call
it is not that it is lag. its the problem of the game thread stops handling the database stuff instead of doing game stuff.
Async/Await makes it so it gives the database stuff to a background worker while it continues doing game stuff and then background worker says its done so it continues doing so
bus.Late().Blame(Companies.VOLÁN)
oh yeah they merged in BP

the government-owned train and bus agencies are unified in hungary
yup
yea
therefore, the server delay should disappear
im just wanna do it without lag for server bruh
Technically yes, but I'm pointing out that it doesn't "make it faster", rather it doesn't stop the main thread
i mean it
it makes it faster
by negative amounts of microseconds

-# state machine overhead
Multiply by float instead of division moment
.
Isn't that optimized by the compiler anyway?
Atleast nowadays
by the JIT compiler probably
Idk
by hands
later will be add something
Well why connecting it to DB when your not using it anywhere else?
Just keep it in memory 
because me need access to queries by hands
LA 
im dont wanna download file and restart the server just for change
Add cmds to LA if you need to do any modification at runtime
me need 40-50 specific queries
Or that yea
its stupid
also stupid idea
But why are you editing it manually?
im dont wanna download each time
for checks
Wdym
and add something
manual migrations? 
I guess I'm at the other end of the spectrum, cause I'm parsing LocalAdmin logs for the same reason 
select u.userId, un.nickName from users as u join usernames as un on un.userId = u.id;
example
LA logs
dam
why me need migration?
oh no
why?
are you saying that your current schema will last a lifetime?
it won't
you'll have to change it at some point
= code changes & db changes
plugin automatically generate new tables
Wait, you have auto DBMS on?
me dont need modify it
this is advanced technology we haven't seen before
I think them through in advance
Nah I do know this, this is a feature in Spring as well
where it auto creates all the tables
BUT the caviat is that you cannot:
- rename columns, only create new
- delete columns
- delete tables
they may be correct now but you don't know if they will change
you can only do forward, no deleteion or revert
fair
Don't think you're smarter than everyone else. I don't need to change the schema, just add new ones and receive and modify existing ones.
You never know when we will change the ID system in SL 
i'm not saying i'm smarter
i'm just saying that requirements can change
but you didnt will change it
in anyway
breakable change
who knows
you have to be prepared to modify the schema to add new features
it's not that difficult
just know that it's likely inevitable
no matter how much you think ahead
👌
Yipee
but why you said before Task.Run but now already sent other?
how many drives have you managed to fill up (all clients)
or not you
yes you can make a task
But we told you what to do with the async
Or well riptide explained it
Is there a channel where I can hire developers to create plugins for LabAPI?
We don't have a dedicated one, no
its already task ...
you can write me
xd
There's a list of each channel and what they are used for in #labapi-information
And we told you what to do with the awaits
i didnt understand
rty524t4ht4rht
public override void OnPlayerJoined(PlayerJoinedEventArgs ev)
{
if (ev.Player.IsNpc || ev.Player.IsHost) return;
string userId = ev.Player.UserId;
Task.Run(async () =>
{
if (!await UsersModule.Repository.ExistsByUserId(userId))
{
await UsersModule.Repository.Add(new(userId));
}
});
}
just say how i can make it better then
https://www.youtube.com/watch?v=X9Dtb_4os1o
Perhaps this could help ya?
In this follow-up video, we explore the Awaitable class introduced in Unity 2023.1, which aims to improve asynchronous programming workflows.
See part 1: https://youtu.be/WY-mk-ZGAq8
Topics Covered:
- Learn about the new Awaitable.WaitForSecondsAsync, NextFrameAsync, EndOfFrameAsync & FixedUpdateAsync.
- Learn about cancellation tokens and s...
Understand it more
biggest client log was 120gb
BRUH
dammmmm
I would report your server for that 
but me dont need a script
im just wanna handle on join
oh i've seen this lol

good one
also tbf sl client uses an outdated mirror and this issue is fixed in newer versions
What does it log?
you don't need a script
Did not find target for sync message for 6518. Were all prefabs added to the NetworkManager's spawnable list?```
but on video a script
it would spam this, but i believe that it dosen't contain this log anymore
Eeeee
Oookay
its because we faked primitives for the client
to make everything fully client side
even updating/changing primitives
the client didnt know how to update packets that was technically not spawned for it
Why?
millions of primitives
need to do proper message handling then
(drop sync messages for primitives that arent there)
42 million primitives before a client crash
and yeah we got it all fixed
to now
i created server log files like that once
when working on cmac
our la logs used to be so bad when we first started working that we had to disable it
i allocated 40gb to storage and it would fill in ~ 5 minutes of server uptime
😭
time to performance test the wallhack fucker upper 9000
we were thinking of just adding a huge invis player always in front of the cheater
the wallhack will only render the cham of the one player
theyd just filter it out though
they could ig yeah
they already do this
sunrise is cool but it definetly gives too many false positives
especially on anyone above 50ms
hoping to get something more consistent
ive worked on cmac to specifically account for that
but its hardto test
it processes teslas individually per player based on their ping
yeah teslas are wierd for that
develop your own cheats 
cheaters test for me
tbf midnight was free for a couple days
its just a hwid stealer
then resell that
russian technology
the first proccess it does is checking hardware info
if no vm then check hwid
did you know, when i released the first bit of cmac and sentinal data stuff
i added something that crashed midnight uppon spawn

thats amazing
lmfao
they fixed it like a day after, but it was still funny
now midnight detects cedmod and disabled noclip (for pickup through wall) and harmless tesla
albeit i dont actually see any record of it doing so
cuz their users are either dumb and are ignoring the "you will get banned"
or its not working
surely if your cheat client tells you you will get nuked you should not enable it
i wonder when i finish the sentinalsimulator to do aimbot and shit, will they disable that too

incase you wonder, what is the simulator
cheating in a free micspam unity game
what a great way to spend your time
yeah they did it already
their playerlist bypass was just cache if its filmmaker
so i make it send spectator now

sometimes overwatch
That is crazy
What are you doing with them
pvp server, parkour server, and just general limit testing
😭
the main thing is getting the updating components to work client side
thats what caused the client logs
out of the ~ 65k primitives say 5k of them are constantly updating
client shits itself bc most of them werent loaded
this is what i did for anti wallhack
i would say performance is quite decent
ignore my serverside wallhack that isnt actually a wallhack™️
hows the perf impact of that with ~ 60 players though
i feel like that would start to stack fast
i can test with 60 players
why are there 5k updates 😭
couldn't you parent objects?
each of these is a different parkour tower
all with spinners, keys, client objects, teleporters, damage blocks, etc
hm i need to get a better tps metric
spam the tps command like Zero 
tbf it works though
if you spam it enough it works
Okay that is...
parkour is fun
did you just highlight "client objects"
fghjturyterwartyhjydtse
your method freeze the server to 2-3 secodns
only loaded for a client in a specific tower
yeah
ye good
then your doing it wrong
task.run in on player joined
works fine for me
but its normal
idk if it will embed but let me get a vid rq
cedmod is litterally the largest plugin that has most task usage of any plugin
and has no such issues
what here can be wrong?
if your tasks use too much cpu it will bleed over into the actual main thread
it just select and insert into
cpu stable
idk then, it works fine for me
@unique crane showcase
https://i.e-z.host/📸/eeafl2ne.mp4
oh hey it does embed
Am I crazy or is this from roblox
Roblox obby in sl
what you think of it tho
Nice fps
thats what happens when everything is client side
Or more of seconds per frame
the vid compresses itself so much on this host
i gotta change it eventually
the client fps is fine though
103 fps with ~ 60k prims
I love black magic
black magic parkour
btw zero when the thing i sent you is fixed can you merge everything to main
This server is powered the shadow organization
Yes :3
theres some kind of "hard limit" but im not sure if this is sl itself, or the patch
cuz i know my server shoots upt to 260% cpu in the lobby with 70 dumies
yeah thats the issue i was talking about
albeit it could be as simple as it detecting if its killing tps and just turning itself off
those 1% dips to less than 40tps is gonna be noticeable
By FakeSynced what you mean?
the client thinks the person is a spectator
make a graph with hints 
Oh
so you randomly decided who is a spectator
but why async event works normal?
doesn't this make it obv?
in round start?
no?
because in round start everyone should be spawned
yeah but the clients dont receive that
anyone out of range (30 units) will appear as spectator
that includes as soon as the game spawns everyone
ignore cedric 
the point is that cheaters cant see the player roles accurately
because everyone out of their range shows up as spectator for them
So you are sending to the client a fake sync var
about their role?
yes
and if the raycast pos checker cant obtain a LOS on the player it will send them to 0 0 0 for the receiver
.
the PLAYER themselves will know what their role is
they wont know what OTHERS are unless they are close to them
that isnt the tps part
thats the raycasting
albeit i need to test if it really is
or if its just sl not liking that many dummies
honestly i thought about another idea to make wallhack annoying
i just wanna leave it annoying
dummies actually lag the server more than players
test it out after 10
each dummy drops tps by 2
im gonna run it without the raycast
and see if my tps also shits itself
because in my console you can see the avg of how much MS the method takes
for syncing the entire server
in most of the test we did on AM for maps and stuff that happend
always dummies lowering down tps
in the vid it only looked like if they were alive
was that the case for you aswel?
yeah
we were testing dummies for our pvp server
60tps until 10 dummies
at 11 its 58
12 is 56
etc
ok yeah its not my patch
gaming
with 10 dummies and the sync stuff the tps stays at 60, drops to 59 for about 0.2s every 10-20s
i call that success
someone has to look into why dummes cause such an issue
before dummies the npcs didnt cause this kind of drops
Its the server position distributor
it was only after dummies were officially implemented
i think its just Relative Positioning
: trollface:
at Cyn
nah thats pretty fast
I know that because i was tlaking with someone from bright and im planning to release a plugin for fixing that
cuz thats what im patching and i have a benchmark on it printing evert 300 frames
Well running the profiler for dedicated server...
whats the issue with the positionsyncer btw
that shouldnt cause as much tps drops as it does though
cuz im patching that in cm
ServerPositionDistributor was number 1
Yeah
they are like player^2
what did you expect
it doesnt even hit a ms other than when its raycasting
Whats this patch
relative positioning does NOT take nanoseconds
FpcServerPositionDistributor.WriteAll
yes that one
it re-evaluates it for every player to every player instead of caching
well yeah but im prefixing the entire method
Hmm
so it should be my stuff + game stuff
Here
well how does it cache
create a dictionary
cuz it has to eval the entire playerlist ^2 still
it doesn't need to
players won't move between passes
that's the point of caching
either the receivers position changes requiring you to check if the receiver moved
or the hub moved
so you need to check if the receivers cache is invalid
and if the player its going to receive is invalid

im confused
static Dictionary<ReferenceHub, RelativePosition> Positions = [];
bool WriteAllPatch()
{
Positions.Clear();
foreach (var hub in allhubs)
{
var position = Positions.TryGetValue(out var existing) ? existing : hub.pos();
foreach (var receiver in allhubs)
{
// if visibilitycontroller hides then send 0,0,0 or something, otherwise the position
}
}
}
something like that
also update the dictionary
wait
no
you don't need the dictionary
just put the position variable outside the 2nd foreach
ok so basically, you are saying to cache the syncinfo call
just the position
it doesnt have a position though
this is the position, this object is sent to clients
unless you create your own
you might break something with that now that i think about it, unless actually no you can just update the previouslysent one manually so the game doesnt implode
im talking about FpcServerPositionDistributor.PreviouslySent
cuz getnewsyncdata adds what it retrieved
yeah that should not be touched
but you can just write to it manually
because if you cache the syncdata
youre going to be skipping a bunch of calls
cuz first player will eval
and everything (in range) would be cached
then for the second player, all the in range players for 1 would already be cachedm so getnewsyncdata wouldnt be called for them
thus previouslysent isnt updated for them
hm i wonder, let me just spawn some of my old type dummies and see if it also fucks tps like dummies do
the answer is yes
wtf
also, should probs just statically define the syncdata cache
to save allocing a new dict every frame
lol
me when the unity proccess throws errors

god we fucked this game so much
hm, im confused what the relativeposition is actually used for there
because that isnt sent to clients at all
cuz thats in FpcSyncData and thats still done by FpcServerPositionDistributor.GetNewSyncData
oh you just patched both i see
lol
ye
hm lemme pull something like that off
imo you could save some more by caching the syncdata itself
cuz your still instantiating a bunch
Next update fix?
probably
although
it wants the prevsync
im not sure what for
seems like to check if the position has changed
but that shouldnt matter if you make sure the prevsyncs are always in-sync and would work just fine
It only serializes the data if they changed
you can also do
so you dont make a new one each time
not sure how much overhead it is
i suppose a little cookery cant do harm
we'll see about that
i dont work on the game unless i abaolutely have to
this is for programmers or any bored labapi maintainers
david
or if you could show the code i could recreate a lovely transpiler and in a day everything should be out :3
i love making transpilers
no i mean
and i basically lobotomize the entire method
litterally
):
omg david!!!
eve!!!!
Hiiiii :3
hai :3
haiii :3
haii
god i need to make a bunch of cmd binds to control dummies with
ok cool the random dips to 59tps also happen in the waiting for players menu, so its not from the patch either
gaming
Even Cedric is fed up with this shit
Lel
Hey guys, new to this disc but anybody have tips for managing player Effects with LabAPI? I'm migrating an old plugin from Exiled to LabAPI and everything is much better, except for effects... seems difficult to enable/disable effects by name
60*60
Not 60*2
(even worse)
@harsh thorn caching relative positions in GetNewSyncData got us 4/7 tps back on 48 player servers
why not cache the fpcsyncdata itself though
Hmmm I'll have to recheck but I'm pretty sure the rest isn't of much consequence
I just allocate the cache dictionary once with a capacity of 128
So we never reallocate that
not sure how much impact a unbound dictionary would have vs a static size one tbh
Round robin is also a nice boost but heavily dependent on the amount of resources you're giving to the machine
my thought was doing this, so it only create the entire object once for every player
i.e. 17 tps to 33 tps on a 100 player server if you're not starving it
oh yeah and using a static one for invis
Wasn't sure either but decided to just do it anyway, can't be worse
with what i did so far i cant really tell any negative performance impacts
but dummies causing 20 tps when you have 70 of them makes it hard to tell

unsure why that happens
maybe because they are considered a local player or something
Had 33 tps at 99 dummies so idk
i had 20, with and without patches that could impact tps
but cpu does make a difference so
i was testing on a 3600
Fair enough
im sure if i tested it on my 7950x itd hit higher aswel 
but the point is to test on more common hardware as not every host has a cpu of that caliber
Was mostly targeting optimizations @ 2 cores per server
Since it's what we use
Round robin does help a little but a lot less with those constraints
i mean tecnically speaking sl is singlethread
but hyperthreading stretches it a little
Compared to my 17 -> 33 tps increase on my end
Yeah
Tbf I did see a huge drop between giving it all my CPU and starving it at 2 cores
you mean like only processing X chunk of the players in 1 frame?
or what
Odd players one frame, even players the next
i guess that works
Minimal gameplay impact
i think the game might not even care if you just dont include players in the fpcsync buffer
173 looks a tiny bit jittery but who cares, and players at hyper speeds teleport a little too
(but who cares)
Hitreg still works perfectly fine
at most youd be skipping 1 frame
It's enough to add a bit of jitter to 173 and players with > 150% movement speed
But nothing that kills gameplay
173 stops when you look as always
well obviously youd me missing about 0.3f of velocity
may be a bit more than 0.3
but around that range
It's just that it seems SL doesn't interpolate players over a certain distance
the game tries to lerp so its not that noticable unless the gap becomes too obig
Thanks for that, yeah I saw those methods, but the problem is I need a way to search for ANY active effects on the player. I see StatusEffectBase but can't find a list of classes that subclass that anywhere. Am I looking in the wrong place? Or is this base game code that I'm unfamiliar with
i believe lerping is limited to a certain range
Guessing that's clientside right?
yeah
as otherwise it becomes weird
cuz people go fast slow fast slow when going out and in of lerp range
player.ActiveEffects
StatusEffectBase is all effects
well
Yeah I've seen players lerp through an elevator door if you teleport them to you at the right time
Kek
its what every effect inherits from
Scp207 inherits ColaBase which inherits StatusEffectBase
omfg im stupid
i think the distance is like 2-4f or something
im debating whether or not to add some autistic system that will make my fpc movement patch detect if its impacting tps and disable itself
exactly lol I was seeing all these methods with <T> where T is StatusEffectBase but I was looking for something that actually lists all of those classes. BUT i think ActiveEffects will work for now thank you! ❤️
(its a patch thatl do some raycasts every X to fuck with wallhack users), i cant get any performance impact, but its hard to test because dummies fucking kill the server tps
but the method itself generally stays under the 1 ms from what i can see, occasion 3-7ms every few s
remember ActiveEffects are only for ones with intensity above 1 (aka enabled)
wait ABOVE 1? I assumed 0 was "disabled", is 1 also disabled?
1 is enabled
i meant above 0
my bad
so just to confirm, there is no enum or other collection that defines types of Effects? I'm migrating some code that serializes Exiled...EffectType and I guess I need to store the name of the StatusEffectBase subclass or something
orrrrrr if those classes have an effectName field that is compatible with the screenshot you sent earlier then i guess i could try using that
StatusEffectBase::name
its the unity name

for PMER questions ask in PMER server
There, they rarely answer
it takes days for them
I think that makes sense here. Sometimes its kinda nice (like in Exiled you can apply an effect on a player with just the enum which is super easy), but other times it gets wayyy too excessive when EVERYTHING has an enum
ObjectSpawner.TrySpawnSchematic
also are you using ProjectMER or MapEditorReborn? MER is broken I think but ProjectMER was upgraded to use LabAPI
PMER
bet than ya what EVE said
i need help how can i get item as fiream and how can i edit attachment of this firearm and ammo in mag.?
You can set the attachments code using
firearm.Base.ApplyAttachmentsCode(value, true);
For now
how can i get firearm from item?
cast it
And ammo is dependant on the type of the weapon, but generally it is
firearm.Base.TryGetModule(out IPrimaryAmmoContainerModule magazineModule)
magazineModule.AmmoStored = value
if check for the try get reccomended
like that?
Item item = player.AddItem(ItemType.GunE11SR);
FirearmItem firearmItem = item as FirearmItem;
Yes
couldnt you just do FirearmItem item = ... as FirearmItem rather than item as FirearmItem?
does anyone know how to reverse engineer the CASSIE jam?
they both work fine
Also, yield is defined in seconds, right?
i could but i will use a lot of Item class too so i want to have them apart
I think the first number 000 is where the jam starts (in ms maybe) and the last one after the underscore is the repeat amount
Fuck around and find out
Also. Does anyone know how I could playback audio in Killer's AudioPlayerApi at a slowed down or sped up speed?
Hold on let me see something
Is there a way I can get the default fuse time for a grenade?
When spawning a grenade, I need to specify fuse time in order to make it not explode instantly, but I can't seem to figure out where to do this
I don't mean I need to change fuse time
I mean I need to figure out what it is by default
Because when you spawn one it defaults to -1 and instantly explodes
This is an open issue: https://github.com/northwood-studios/LabAPI/issues/164
TimedGrenadeProjectile::SpawnActive has a timeOverride parameter with the default value of -1 However, there is no check for -1 when setting the target time of the grenade. Passing a value of -1 sh...
I'm just looking to circumvent it
TimedGrenadeProjectile.SpawnActive(player.Position, ItemType.GrenadeHE, player, 3);
3 is the fuse time
How should I do that?
uh
math magic
:3
interpolation
2x or 0.5x speed is rather simple in theory
arbitrary speeds get complicated
Sick
Samples are a byte[] right?
That's all I needed haha thank you
I think...
Well unless there's a way to get the default fuse time so I don't have to worry about it if fuse time changes
get the fuse time from the template
or the base
.
and then somehow process it
hm do you think that theres a library which has a method to do that
never heard of this
basically if you can resample audio then you can tell the resampler that it's a different rate
info and libraries for audio stuff like this are surprisingly rare
so you set the out sample rate to 48000 and divide that by the speed to get the input sample rate
Then I can take that audio and add it to the AudioClipStorage (using VorbisReader)
load it using the storage, get the data, process it and set the data back
or
modify the data
nvm
if you wanna read a file then use the storage to read it
i mean you already need NVorbis so you can read it yourself
bybygaga
sorry for trouble but "value" is type of uint is there any list what uint value mean what attachment it is(?) or how i can know what attachment i giving the gun?
It is basically a sum of values of the indexes of the active attachments
With each index being power of 2
so 0^2+1^2+2^2
Of the active attachments
I reccomend getting the attachments base game and then printing the current value
Via a plugin
use the forceatt command
wdym?
to show what attachments you have on the gun in-game
itsa ingame command or vs?
in-game
im gonna check it out
THX SO MUCH
np
Oh it shows you the current attachment combination
Yeah op thb
magazineModule.AmmoStored isnt a read-only variable?
namespace InventorySystem.Items.Firearms.Modules;
public interface IAmmoContainerModule
{
int AmmoStored { get; }
int AmmoMax { get; }
int GetAmmoStoredForSerial(ushort serial);
}
Oh right
Get the implementation
MagazineModule
or
CylinderAmmoModule
(for revolver)
And then there is ServerSetInstanceAmmo(ushort serial, int amount)
@main zenith
ok this will be best for this thx so much
ServerSetInstanceAmmo(ushort serial, int amount) its can be called by NetworkServer or what?
Wdym?
Its meant to be called on server
and then it syncs data to the client automatically
like for example i have this code and how i can call the ServerSetInstanceAmmo?
public void AddCutomItem(CustomItemsData CustomItem,Player player,int amount)
{
Item itemplayer = player.AddItem(CustomItem.BasicItem);
FirearmItem firearmItem = itemplayer as FirearmItem;
Firearm gun = firearmItem.Base;
MothCustomItemsMain.Instance.CreateCustomWeapon(itemplayer.Serial, CustomItem.CustomItem);
ServerSetInstanceAmmo(itemplayer.Serial, amount);
}
gun.Base.TryGetModule(out MagazineModule magazineModule);
magazineModule.ServerSetInstanceAmmo(gun.Serial, yourAmmoAmount) ;
preferred safer way
ok im stupid sorry for trouble
if(gun.Base.TryGetModule(out MagazineModule magazineModule))
{
magazineModule.ServerSetInstanceAmmo(gun.Serial, yourAmmoAmount);
}
There are firearms wrappers coming eventually
to make this easier
I'm being dumb how should I get the template
Why did you what
itemBase.PickupDropModel is not TimeGrenade grenade returns true
Why you need what
What are you saying
TimedGrenadeProjectile flash = (TimedGrenadeProjectile)TimedGrenadeProjectile.SpawnActive(player.Position, ItemType.GrenadeFlash, player);
flash.Base._fuseTime = 1;
you have the item instance, right?
they want the original fuse time
^
Oh
Well check how the.SpawnActive does it and you can do that there
It doesn't
SpawnActive doesn't set the proper fusetime
at this point just copy the spawning code from labapi
Is what I'm saying
^
Otherwise i would've stolen that code
If it worked 
Wdym proper fusetime?
If you edit or patch the method it will not set the fusetime
I'm just gonna patch SpawnActive to fix this
Ye that's what I would do, or just copy paste to my own
if you use that method
you can just copy the code
without patching
Yeah but
what Slejm said
Well, only update we get this point is either 14.2 or 14.1.1 which i think will be months away
so you can just replace your SpawnActive call with the LabApi method when it gets fixed
If I patch it it gives me an excuse to actually learn how to do transpiler BS
good luck
Have fun
I think only need to remove like 4 instructions at max
but what if they wanna fix it
and not just remove the fuse time setter
but check for -1
lot of nerding required
-# not bad
It's really just:
Check for -1, skip instruction if true
Which means for IL you need to insert a label after the code and run a conditional jump before the code to the label if true
ye it's uh
pretty cool
i gotta use it sometime
leaving behind exiled-style patches:
heist with markiplier was peak
Is this the right LabAPI-way to Spawn a new item (Pickup) at a given position?
Pickup pickup = myItem.DropItem();
pickup.Position = myVector3;
why r u dropping item
Do you already have an item?
Or r u creating it
for this
Cuz then Pickup.Create
skibidi
No im creating, awesome thank you ❤️
You'll also need to spawn it for it to be visible
{
Pickup pickup = Pickup.Create(Type, position)!;
OnCustomItemCreated(pickup.Serial);
if (shouldSpawn)
pickup.Spawn();

Does SL use a custom interest management system for Mirror
or am I free to make my own
nope
i tried using it in the past from a plugin and it causes all sorts of problems
not to discourage you, it could of been entierly my fault
what kind of problems are we talking
kinda just wanna manually implement this for now
null character controllers
when one of them breaks, movement for most players breaks(they get stuck in place on the server)
fun
I'll try not to touch players then
Even though it would've been cool for another plan I had with it heh
huh
kinda surprised SL doesn't
this is the kind of stuff you'd use to stop networking players when they're invisible/in other zones or w/e
game isnt really made to work with it
fair
since it would "disconnect" players outisde the range
not to say they could make it work, it just would require reworking alot of stuff
fair enough
i could see it working well for pickups/ragdoll(maybe ?) tho
just used to the
way which does that by default, the default "interest management" solution is distance based
yeah perhaps
but don't pickups/ragdolls get culled anyway
or are they still costly to clients even when culled
not really
the culling from what i see is only visual, which doesnt impact fps that much since the gameobjects are still enabled
so you're telling me there's another avenue I can explore to squeeze performance out of servers & clients too this time?
maybe, although not sure how much of an impact you can make from just plugins
if I can stop networking of pickups and ragdolls that's already good in my books
did notice clients retained some hefty fps drops when we had a ton of them, even in different zones/culled
im pretty sure the networking for both of those is extremely low, any gains would probably be in fps
yeah that's the goal
well my primary goal is to be able to do this without sending an object destroy message to clients
but if I can get the latter done too, that's just gravy
yeah im reading that now, i dont think it will happen mostly because it would require the game to be reworked to use AOI
would it though
can just go with the default outside of the admin toys
default seemingly being "just add to observers lol"
unsure myself, typically for this kind of thing you would just send your own spawn messages to the clients you wanted to see it. but i understand why that would be unoptimal due to the way mirror works
its been awhile but i dont think custom interest management is very performant on the server side
should be fine as long as you're careful with the checks you do
i could be wrong by i think you need to rebuild all observers everytime something spawns, and that involved looping over every connection/network id combo
you also had to trigger fulll rebuilds yourself to account for anything that moves, so a full rebuild every second if you wanted to be safe
well that sucks




