Weaver

class games.spiders.weaver.Weaver

Bases: games.spiders.spiderling.Spiderling

The class representing the Weaver in the Spiders game.

A Spiderling that can alter existing Webs by weaving to add or remove silk from the Webs, thus altering its strength.

attack(spiderling: games.spiders.spiderling.Spiderling) → bool

Attacks another Spiderling.

Parameters

spiderling (games.spiders.spiderling.Spiderling) – The Spiderling to attack.

Returns

True if the attack was successful, False otherwise.

Return type

bool

property busy

When empty string this Spiderling is not busy, and can act. Otherwise a string representing what it is busy with, e.g. ‘Moving’, ‘Attacking’.

Type

‘’, ‘Moving’, ‘Attacking’, ‘Strengthening’, ‘Weakening’, ‘Cutting’, or ‘Spitting’

property game_object_name

String representing the top level Class that this game object is an instance of. Used for reflection to create new instances on clients, but exposed for convenience should AIs want this data.

Type

str

property id

A unique id for each instance of a GameObject or a sub class. Used for client and server communication. Should never change value after being set.

Type

str

property is_dead

If this Spider is dead and has been removed from the game.

Type

bool

log(message: str) → None

Adds a message to this GameObject’s logs. Intended for your own debugging purposes, as strings stored here are saved in the gamelog.

Parameters

message (str) – A string to add to this GameObject’s log. Intended for debugging.

property logs

Any strings logged will be stored here. Intended for debugging.

Type

list[str]

move(web: games.spiders.web.Web) → bool

Starts moving the Spiderling across a Web to another Nest.

Parameters

web (games.spiders.web.Web) – The Web you want to move across to the other Nest.

Returns

True if the move was successful, False otherwise.

Return type

bool

property moving_on_web

The Web this Spiderling is using to move. None if it is not moving.

Type

games.spiders.web.Web or None

property moving_to_nest

The Nest this Spiderling is moving to. None if it is not moving.

Type

games.spiders.nest.Nest or None

property nest

The Nest that this Spider is currently on. None when moving on a Web.

Type

games.spiders.nest.Nest or None

property number_of_coworkers

The number of Spiderlings busy with the same work this Spiderling is doing, speeding up the task.

Type

int

property owner

The Player that owns this Spider, and can command it.

Type

games.spiders.player.Player

strengthen(web: games.spiders.web.Web) → bool

Weaves more silk into an existing Web to strengthen it.

Parameters

web (games.spiders.web.Web) – The web you want to strengthen. Must be connected to the Nest this Weaver is currently on.

Returns

True if the strengthen was successfully started, False otherwise.

Return type

bool

property strengthening_web

The Web that this Weaver is strengthening. None if not strengthening.

Type

games.spiders.web.Web or None

weaken(web: games.spiders.web.Web) → bool

Weaves more silk into an existing Web to strengthen it.

Parameters

web (games.spiders.web.Web) – The web you want to weaken. Must be connected to the Nest this Weaver is currently on.

Returns

True if the weaken was successfully started, False otherwise.

Return type

bool

property weakening_web

The Web that this Weaver is weakening. None if not weakening.

Type

games.spiders.web.Web or None

property work_remaining

How much work needs to be done for this Spiderling to finish being busy. See docs for the Work formula.

Type

float