as title asks.
I want to prevent or at least give side effects to player if player decides to attack the chest containing that specific item (it is not an entity).
background: lets assume you use item A and B in a recipe and create item "Dangerous". then player puts the item "Dangerous" to a chest. there is no recipe using "Dangerous" so players has to get rid of it expensively or keep it in storage. obviously a player can put it into a chest and then shoot it. I want player not to do this so I want an explosion (nuclear bomb like) upon destroying that "Dangerous" item. it can be similar to nuclear reactor explosion but it is not an entity, just a regular item.
is it possible?
is it possible to create an explosion upon an item's destruction?
Re: is it possible to create an explosion upon an item's destruction?
Code: Select all
script.on_event(defines.events.on_entity_died, function(event)
if event.entity and event.entity.valid and event.entity.get_item_count("dangerous-item") > 0 then
-- create explosion
end
end)
Re: is it possible to create an explosion upon an item's destruction?
awesome. thank you. I shall try this tonight.
Is there a mod you have in mind as an example so I can steal some code ?
Is there a mod you have in mind as an example so I can steal some code ?