Determining if a func_door is opened

I have a jailbreak server and I’m wanting to determine if the cells are open with a script check, I’ve tried GetPos and it just returns the same position regardless if the door is opened or closed. I’ve looked into Flags, but so far I can’t seem to find anything in there that helps. Perhaps there is a way to determine if a button is pressed or not?

Any help would be greatly appreciated.

Regards,
Jake

I believe there is a flag in door:GetSaveTable() that might help you. No promises.

You can use the variable which I believe is serverside only. Another way is using setup files… Setup the map so you know each door position and angle when in default / closed state. Create a simple function that compares ( if func_door check for pos / angle, else just compare the current angle with the default angle ).

@Revenge282

The only thing I found in there that could be slightly useful was:

m_hActivator Which returns either [NULL Entity] or a player, such as
Player [1][Jake]

That doesn’t return anything if the cell activator was shot however. This looks like a very useful library, i’ll keep looking to see if there are any other helpful keys. Any other suggestions?

@Acecool

I already tried comparing position, for some reason it’s the same regardless if the door is opened or close, probably something with the way sliding doors work. I cannot compare the angle because it’s a sliding door, not a rotating door, plus something tells me that wouldn’t work anyways just based on the fact that GetPos wouldn’t work.

Well if the doors start closed each round, then have that variable saved. Then when they press the button (opening the doors) then change that variable, and then if they press it again (closing) change again.

EX:

Round Starts >> DoorOpened = false >> Player 1 Presses Button >> DoorOpened = True, doors open >> Player 2 Presses Button >> DoorOpened = False, doors closed.

Slight problem: Players can shoot the cells open and currently I can’t think of a way to record that event.

I had thought about making code within the gun where you could do an eye trace then get the entity, but it seems like there’d be something to go wrong there.

Look harder. You might find this useful: https://www.diffchecker.com/izbvrd8g

The original is a closed door, the modified is an open door. My eye is on the m_toggle_state. That’s for standard rotating brush doors.

This is for rotating prop doors: https://www.diffchecker.com/ktzqx7wu (eye on m_eDoorState)

There’s no need to track angles or opens/closes. The entity already has that information built in if you know how to use it. You’d just be creating more work for yourself.

Upon further observation, m_vecFinalDest appears to always be at a Vector(0,0,0) until the opener button is either shot or pressed, this theory has been testing and appears to be working thus far.
I have no idea why that was the one, the way valve does things is a mystery to me, but I’ve tested it about 4 times and it seems to be working every time.
[lua]
if ents.GetMapCreatedEntity( 1331 ):GetSaveTable()[“m_vecFinalDest”] == Vector(0,0,0) then
– whatever
end
[/lua]
Nice and short compared to whatever nightmare I would’ve had to go through to get it to work without this. Thank you for the extended support Revenge282.

I’m not guaranteeing this will be helpful to you, but Zombie Escape has a thing where it’ll draw a material over a button if it hasn’t been pressed:

That seems to just create an additional networked variable within every button. I think it would be better to use data that already exists, like Revenge said.

I can detect when buttons are pressed via PlayerUse, the only thing I’m still having trouble with is determining who shot the button to activate it.

Hmm, maybe this would work?