This is my first go at modding, and I'm basically trying to make a better (if a little overpowered ) version of the basic grenade, called ' advanced grenade' .
Reason I'm trying to make it, is to easily clear trees
I'm aware there is a Thermite mod for that (or ofcourse the vanilla way, construction robots), but it seemed like a good opportunity to teach myself to to make my own mod.
My problem is that I can't figure out how to use my own projectile.
I can make my custom item throw the basic grenade projectile, just not my own.
Whenever I add "advanced-grenade-projectile" at
Code: Select all
ammo_type =
{
category = "capsule",
target_type = "position",
action =
{
type = "direct",
action_delivery =
{
type = "projectile",
projectile = "advanced-grenade-projectile",
starting_speed = 0.6
}
}
}
I get the following error:
If someone could help me figure out what I'm doing wrong it'd be greatly appreciated!
Full Code below.
info.json
Code: Select all
require("prototypes.item")
require("prototypes.recipe")
require("prototypes.projectile")
item.lua
Code: Select all
data:extend({
{
type = "capsule",
name = "advanced-grenade",
icon = "__base__/graphics/icons/basic-grenade.png",
flags = {"goes-to-quickbar"},
capsule_action =
{
type = "throw",
attack_parameters =
{
type = "projectile",
ammo_category = "capsule",
cooldown = 5,
projectile_creation_distance = 0.6,
range = 50,
ammo_type =
{
category = "capsule",
target_type = "position",
action =
{
type = "direct",
action_delivery =
{
type = "projectile",
projectile = "advanced-grenade-projectile",
starting_speed = 0.6
}
}
}
}
},
subgroup = "capsule",
order = "a[basic-grenade]",
stack_size = 100
}
})
Code: Select all
data:extend({
{
type = "recipe",
name = "advanced-grenade",
enabled = "true",
ingredients =
{
{"coal", 1},
},
result = "advanced-grenade"
},
})
Code: Select all
data:extend(
{
type = "projectile",
name = "advanced-grenade-projectile",
flags = {"not-on-map"},
acceleration = 0.03,
action =
{
{
type = "direct",
action_delivery =
{
type = "instant",
target_effects =
{
{
type = "create-entity",
entity_name = "massive-explosion"
},
{
type = "create-entity",
entity_name = "medium-scorchmark",
check_buildability = true
}
}
}
},
{
type = "area",
perimeter = 16.5,
action_delivery =
{
type = "instant",
target_effects =
{
{
type = "damage",
damage = {amount = 80, type = "explosion"}
},
{
type = "create-entity",
entity_name = "explosion"
}
}
}
}
},
light = {intensity = 0.5, size = 4},
animation =
{
filename = "__base__/graphics/entity/basic-grenade/basic-grenade.png",
frame_count = 1,
width = 24,
height = 24,
priority = "high"
},
shadow =
{
filename = "__base__/graphics/entity/basic-grenade/basic-grenade-shadow.png",
frame_count = 1,
width = 24,
height = 32,
priority = "high"
}
}
)