screeps / engine

ISC License
133 stars 66 forks source link

created/owned structures missing from API in private server with broken patch #65

Open sparr opened 6 years ago

sparr commented 6 years ago

I have just init'd a brand new server, connected and created a player, then placed a spawn. Immediately I check and find that Game.spawns.Spawn is undefined, Game.rooms.W8N3.find(FIND_MY_STRUCTURES) finds only the room controller, Game.getObjectById(idofthespawn) returns null.

I have no idea how to further troubleshoot this. I encountered this problem first while using the cli to create some buildings to run some experiments, but later boiled it down to just a spawn on a fresh server.

sparr commented 6 years ago

Here's the db entry for the spawn in question:

[ { type: 'spawn',
    room: 'W8N3',
    x: 32,
    y: 17,
    name: 'Spawn1',
    user: 'c27ea75f29baff7',
    energy: 300,
    energyCapacity: 300,
    hits: 5000,
    hitsMax: 5000,
    spawning: null,
    notifyWhenAttacked: true,
    _id: 'bb91a769218034d',
    meta:
     { revision: 1,
       created: 1509051240984,
       version: 0,
       updated: 1509051241595 },
    '$loki': 349,
    off: false } ]
sparr commented 6 years ago

Here's how it appears in the client:

screenshot

sparr commented 6 years ago

It appears this was potentially caused by my using a patched engine, but I cannot find anything in my patch that would cause this behavior. Please keep this issue open for a short while as I attempt to narrow down the misbehavior?

sparr commented 6 years ago

https://gist.github.com/sparr/7935d9a533ecfc47b8657b013227b9f3

sparr commented 6 years ago

Fixing some uses of global/C in that patch made the problem go away. However, I believe there still remains a bug here in that this failure was silent on the server/log side. Whatever was going wrong, it should have produced some error log output.