cityrpg / CityRPG

A sandbox-simulation styled mod for the game Blockland that simulates the life of a blocky city. Live, build, and thrive in a city made of blocks.
4 stars 3 forks source link

Jail spawns are overrided through checkpoints #2

Closed homosapine closed 4 years ago

Dglider commented 4 years ago

I would suggest that the host disable checkpoints, however he may desire to keep them for some reason.

Checkpoint bricks store two points of data: %client.checkPointBrick %client.checkPointBrickPos

%client.checkPointBrick is used in GameConnection::getSpawnPoint(%client) %client.checkPointBrickPos is used in Gameconnection::applyPersistence(%client, %gotPlayer, %gotCamera) to attempt to recover a player's checkpoint brick.

The code affecting our situation is here near line 74 of Brick_Checkpoint/server.cs

package CheckpointPackage
{
   function GameConnection::getSpawnPoint(%client)
   {
      if(isObject(%client.checkPointBrick))
         return (%client.checkPointBrick.getSpawnPoint());

      return Parent::getSpawnPoint(%client);   
   }

There are a few ways to deal with this. We could clear the two saved values when a player get's jailed, however we may be screwing with their progress through, idk, a player made challenge? Or we could disable CheckPointPackage and write checkpoints into the current spawn point heirarchy. We would also need to copy over GameConnection::applyPersistence.

homosapine commented 4 years ago

I actually thought of just disabling checkpoints after I made this, and I think that's a good idea because personal spawns exist anyway, so checkpoints are redundant. But I don't think it would be hard to fix anyway.

LakeYS commented 4 years ago

Disabling checkpoints is fine short-term, but I'd like to to it within the add-on so hosts don't need to go through the ordeal of finding out they're broken. Furthermore, long-term I'd like to find a more elegant solution like detecting whether they're in jail.

Marked as critical as this allows players to bypass jail time.

Dglider commented 4 years ago

I'll do this one tomorrow. I'll use the overwrite checkpoint package method.

LakeYS commented 4 years ago

Now fixed in 7bd016ab, see PR #14