See Cell.update()
for the arguments.
Unique ID of the cell. Positive (non-zero).
Tuple of floats (r, g, b)
, where each channel is between 0.0
and 1.0
.
Sent by server.
Unknown meaning. Open an issue if you know what it's for.
True
iff the cell has no name and its size is between 37 and 38.
True
iff the cell has no name and its size is below 20.
Sent by server.
Official client renders these cells with a spiked border.
mass = size * size / 100
Do not confuse with size
.
String. Can be empty for player-controlled cells.
Vec
instance. Server sends integer coordinates.
The cell's radius. Do not confuse with mass
.
Compares by mass
and cid
in this order.
Compares name
and color
.
Returns True
if both are owned by the same player.
Parameters:
cid=-1
x=0
y=0
size=0
name=''
color=(1, 0, 1)
is_virus=False
is_agitated=False
See the attributes above for their descriptions.
The class this world uses when creating cells.
Override this for storing custom data per cell or extending its functionality.
Defaults to agarnet.world.Cell
.
class MyCustomCellClass(agarnet.world.Cell):
@property
def has_skin(self): # some custom method example
return self.name in special_names
my_world.cell_class = MyCustomCellClass
A dict
mapping cell IDs to their instances.
List of angles (float
) for the pie chart in teams
mode.
List of (cid, name)
pairs, from top to bottom (1st to 10th).
The cid
s seem to always be the lowest ID of that player.
The name can be an empty string. The official client then displays "An unnamed cell" instead.
Vec
of the top left corner coordinates.
Vec
of the bottom right corner coordinates.
Vec
of the center of the world rectangle.
Vec(width, height)
Compares two worlds by comparing their leaderboards.
Creates a new cell in the world.
Override to use a custom cell class.
Clears the cells
and leaderboards, and sets all corners to Vec(0, 0)
.
The center of all controlled cells.
True
iff own_ids
is not empty.
not self.is_alive
String.
All controlled cell instances.
Generated from own_ids
, so use list(player.own_cells)
or loop over it once.
All controlled cell IDs.
Calculated in cells_changed()
.
Combined mass of all controlled cells.
Combined size of all controlled cells.
Calculated like in the official client.
Returns (Vec(left, top), Vec(right, bottom))
.
The world that the player's cells are in.
Calculates total_size
, total_mass
, scale
, and center
.
Has to be called when the controlled cells (own_ids
) change.
Clears nick
and own_ids
, sets center
to world.center
, and then calls cells_changed()
.