#Getting special weapon locker and putting item instance in it.

1 messages · Page 1 of 1 (latest)

civic rose
#

Right now I have a respawn system that when a special item is thrown in the void, it teleports back to the right locker (unless jailbird or particle disruptor).

My first question is, how do you get the locker that corrilates to the right item, then my second question is, how do you put an item instance back in without resetting it's charge/use state? If the 2nd question is impossible, please just say so, would be useful if it wasn't tho!

dapper light
#

get the ExperimentalLocker
Chambers[0]
Content.Add(pickup)

fiery marlin
hexed warren
#

then MicroHidPedestal

#

or wtv

fiery marlin
# civic rose Right now I have a respawn system that when a special item is thrown in the void...

you could go through each chamber and get their contents when creating the pickup
the LabApi LockerChamber has GetAllItems which gives you a set of pickup wrappers
store the locker, the chamber's id and position in a dictionary (or your own custom data store, doesn't matter)
when you wanna respawn the item, teleport the item back and add it to the locker's contents
not sure if we need to mess with the locker anyway, why couldn't you just teleport the item back to the original position?

civic rose
#

they must be included

#

i want to put them back in their lockers

#

rn it just goes to the first experimental locker it can find

#

rather than the right one

fiery marlin
#

aren't the position and rotation sufficient?

civic rose
#

yes, but i want to put them back

#

rather than drop

#
            Locker locker = Locker.Get(LockerType.ExperimentalWeapon).First();
            Locker scp127 = Locker.Get(LockerType.Scp127Pedestal).First();
            Locker micro = Locker.Get(LockerType.MicroHid).First();
            Locker lockerToUse = pickup.Type switch
            {
                ItemType.MicroHID => micro,
                ItemType.Jailbird or ItemType.ParticleDisruptor => locker,
                ItemType.GunSCP127 => scp127,
                _ => null
            };
            if (lockerToUse == null) return;
            Vector3 pos = lockerToUse.Position;
            pos.y += 1;
            pickup.Position = pos;```
fiery marlin
#

yes, but i want to put them back
rather than drop
what

#

you have a pickup

civic rose
fiery marlin
#

you store the position and rotation when you spawn the pickup

#

and reset when it gets thrown into the void

#

that should do the trick

civic rose
#

i dont spawn the pickup?

#

and setting the position wont work

#

because it will just warp out

#

i want to put it back in.

fiery marlin
fiery marlin
civic rose
#

it just grabs the pickup from the item thrown?

#

what? 😭

#

it's not a custom item

#

😭

fiery marlin
#

ohhhhh

#

you

#

oh

#

the items are separate, okay

#

i did not get that part skullbutreal

civic rose
# fiery marlin wdym 😭

i know there is a method to put the item back at it's initial state with the chamber, i just dont know if it will reset it's uses or charge

#

i just want to put the item back at it's spawn

fiery marlin
civic rose
#

really? damn

#

so i do just have to slap it ontop

#

ok

#

fine

fiery marlin
#

use the ItemSpawningEventArgs

#

to determine when it spawns and what its position and rotation are

#

wait no

#

omfg

#

ItemSpawned

#

i'm not reading the code 😭

civic rose
#

ok

#

i dont think that is needed

#

😭

#

better question then

#

is there a way to get the chamber/locker an item is supposed to spawn in

#

idc about putting it back

fiery marlin
#

loop through the chambers and check if its contents contain the pickup

civic rose
#

contain?

#

the item will be out of the chamber

#

😭

fiery marlin
#

you store the chamber when it spawns in a dictionary

civic rose
#

is there no method for getting all the chambers husk

fiery marlin
hexed warren
#

💀

#

properties >>>

fiery marlin
#

also there's LockerChamber.Dictionary.Values for every chamber

civic rose
#

mb

#

like "is there a way"

#

"is there a method"

#

i meant it that way, mb

fiery marlin
#

english SteamHappy

fiery marlin
dapper light
#

If lockerchamber has content that is a pickup i gonna scream at u

civic rose
#
LockerChamber chamber = LockerChamber.Dictionary.Values.FirstOrDefault(chamber => chamber.AcceptableItems.Contains(pickup.Type));
            if (chamber == null) return;
            Vector3 pos = chamber.Locker.Position;
            pos.y += 1;
            pickup.Position = pos;```
#

this will be sufficient ig?

fiery marlin
civic rose
fiery marlin
#

okay that's fine then

civic rose
#

yeah

fiery marlin
#

but

#

what if

#

someone makes another one in 914

civic rose
#

just teleport to the same place

#

idgaf

#

😭

dapper light
#

It's literally what i sent except reset started and stuff

#

😭

civic rose
#

thanks so much

civic rose
#

THERE IS NO TYPE??

#

I CANT GET LOCKERTYPE?

#

unless that's exiled specific

fiery marlin
#

get the locker

#

from the chamber

civic rose
#

still no type

dapper light
#

Or y'know

fiery marlin
#

structure type

dapper light
#

Get the exactly licker you want

civic rose
#

makes the code lengthy

#

then i need to do a switch

#

blegh

civic rose
#

THERE ISNT A 127 LOCKER

#

😭

dapper light
#

I think thats a standard locker

civic rose
#

still cant get lockertype

#

grrr

#

will pedestal locker have 127 maybe?

#

pedestal locker scp items

#

fuck

fiery marlin
#

it's specific to the room so probably not

dapper light
#

Start the game get all locker and show it's content and the type of it

fiery marlin
#

i mean
get the room
if name is Hcz127 then you know thats it

civic rose
#

how the hell is there no roomtype

fiery marlin
#

there's roomname

#

but no roomtype

#

cuz

#

NW

civic rose
#

classic

dapper light
#

Rooming around in types

civic rose
#

if (chamber == null || chamber.Locker is ExperimentalWeaponLocker or MicroPedestal || chamber.Locker.Room?.Name != RoomName.Hcz127) return;

#

i think this is a valid if check then

fiery marlin
#

what

civic rose
dapper light
#

I don't think 127 is either locker or exp one

fiery marlin
#

didn't you say you only wanted micro, disruptor, jailbird and 127?

fiery marlin
#

then

#

chamber.Locker is not (ExperimentalWeaponLocker or MicroPedestal)

civic rose
#

fuck

#

thanks

fiery marlin
#

wait no

#

your condition is weird

#
if (chamber == null || !(chamber.Locker is ExperimentalWeaponLocker or MicroPedestal || chamber.Locker.Room?.Name == RoomName.Hcz127)) 
    return;
#

or

#
if (chamber == null || chamber.Locker is not (ExperimentalWeaponLocker or MicroPedestal) && chamber.Locker.Room?.Name != RoomName.Hcz127)
    return;
civic rose
#

thanks