Skip to content

Player damage

Junior edited this page Nov 26, 2025 · 1 revision

At the moment this will only contain reference links and minimal examples to the API for future development, with the understanding that the desired method may not be possible when attempting to implement. If a custom explosive prototype can be created at runtime, that would allow Customizable death event (#11) to utilize an explosive not declared in the game, but extremely unlikely with how the game is designed and runs.

Referring to (STEAM_APPS_COMMON)\Factorio\data\base\prototypes\entity\projectiles.lua as an example.

Direct

{
  type = "direct",
  action_delivery = {
    type = "instant",
    target_effects = {
      {
        type = "create-entity",
        entity_name = "explosion"
      },
      {
        type = "damage",
        damage = { amount = 100, type = "explosion" }
      }
    }
  }
}

Area

cannon-projectile fragment

{
  type = "area",
  radius = 4.0,
  action_delivery =
  {
    type = "instant",
    target_effects =
    {
      {
        type = "damage",
        damage = {amount = 1000 , type = "physical"}
      },
      {
        type = "damage",
        damage = {amount = 1000 , type = "explosion"}
      }
    }
  }
}

Cluster

cluster-grenade fragment

{
  type = "cluster",
  cluster_count = 7,
  distance = 4,
  distance_deviation = 3,
  action_delivery =
  {
    type = "projectile",
    projectile = "grenade",
    direction_deviation = 0.6,
    starting_speed = 0.25,
    starting_speed_deviation = 0.3
  }
}

Nested outcome

{
  type = "instant",
  target_effects = {
    {
      type = "nested-result",
      action = {
        -- TriggerEffectItem[]
      }
    }
  }
}

Clone this wiki locally