⚙️ function core_action_build(...)

Last updated: 11/17/2025

URL

https://github.com/42core-team/monorepo/blob/dev/client_lib/src/public/actions.c#L119

Description

Builds a new object.

The e_build_type of the builder unit in the config will determine what gets built (e.g. bomb or wall). (More info on bombs).

The builder must hold enough money to be able to afford the object it is building as defined by the config.

  • Objects can only be built one tile up, down, left or right from the builder; for more see Action Position Limits.
  • Builders objects can only build if their action cooldown is 0, for more see Cooldowns.

Signature

void core_action_build(const t_obj *builder, t_pos pos);

Parameters

  • const t_obj *builder: The unit object that has a unit type that is able to build. Must have a t_build_typethat is not BUILD_TYPE_NONE in the config.
  • t_pos pos: The position to build the object at.

Return

void

Examples

t_obj *unit = ft_get_wall_builder_unit();
if (unit && unit->s_unit.gems >= game.config.wall_build_cost)
{
	core_action_build(unit, (t_pos){ unit->pos.x + 1, unit->pos.y });
}