Updating character location based on occupied tile
This commit is contained in:
@@ -34,6 +34,14 @@ public class CharacterStore
|
||||
public async Task<Character?> GetByIdAsync(string id) =>
|
||||
await _col.Find(c => c.Id == id).FirstOrDefaultAsync();
|
||||
|
||||
public async Task<bool> UpdateCoordAsync(string id, Coord coord)
|
||||
{
|
||||
var filter = Builders<Character>.Filter.Eq(c => c.Id, id);
|
||||
var update = Builders<Character>.Update.Set(c => c.Coord, coord);
|
||||
var result = await _col.UpdateOneAsync(filter, update);
|
||||
return result.ModifiedCount > 0 || result.MatchedCount > 0;
|
||||
}
|
||||
|
||||
public Task<List<VisibleLocation>> GetVisibleLocationsAsync(Character character)
|
||||
{
|
||||
return GetVisibleLocationsInternalAsync(character, ensureGenerated: false);
|
||||
|
||||
Reference in New Issue
Block a user