SEModCommunity / SE-Community-Mod-API

Space Engineers Community Modding API
GNU Lesser General Public License v3.0
60 stars 47 forks source link

BUG: State changes on DoorEntity reverts to original value #124

Closed hwinther closed 10 years ago

hwinther commented 10 years ago

Using DoorEntity.State to open/close a door by setting the true/value false does not seem to register with the game

DraygoKorvan commented 10 years ago

You need to force the server to update the client. Best way to do that is to disable then enable the door

chessmaster42 commented 10 years ago

Disabling and re-enabling the door isn't enough. The code wasn't broadcasting the change to the clients but this has been fixed now and will be in the next dev build.

chessmaster42 commented 10 years ago

This should be fixed now on the latest dev build. Please update and re-test and let us know if this is still an issue.

hwinther commented 10 years ago

As far as i can tell the bug is still there, I have tried disabling the doors and then waiting 200ms before enabling and closing them but with no result.

I'll include a code snippet here in case im simply going about it wrong:

List doors = new List(); m_resourceLock.AcquireExclusive(); List cubeBlocks = aicore.Parent.CubeBlocks; foreach(CubeBlockEntity cubeBlock in cubeBlocks) { if (cubeBlock is DoorEntity) { DoorEntity door = (DoorEntity)cubeBlock; if (door.State == true) { //door is open door.Enabled = false; doors.Add(door); } } } m_resourceLock.ReleaseExclusive();

            if (doors.Count != 0)
            {
                Thread.Sleep(250);
                m_resourceLock.AcquireExclusive();
                foreach (DoorEntity door in doors)
                {
                    door.Enabled = true;
                    door.State = false; //close it
                }
                m_resourceLock.ReleaseExclusive();
            }
chessmaster42 commented 10 years ago

Can you please re-test on the latest dev build? I have tested this several times myself and it seems to be working fine but please let me know if it is also working for you.

hwinther commented 10 years ago

Yes, thank you - it works for me now, I might have tested wrong by using mostly non-vanilla doorblocks. The door in question is MyObjectBuilder_Door/DockingTubeDoor (http://steamcommunity.com/sharedfiles/filedetails/?id=294619787) - do you have any idea why that identifies as a DoorEntity but doesnt close? It can be disabled however

Not a big deal but would be nice if all modded doors (those that actually work in the first place) behaved like the vanilla door block :)

chessmaster42 commented 10 years ago

I'm not sure why the modded door would have issues but also I can't do support for any issues that arise from using modded blocks. That is something the mod author needs to contact me about.

As such I am closing this issue.