Skip to content

Commit

Permalink
COMPLETELY NORMAL COMMIT NOTHING TO SEE HERE
Browse files Browse the repository at this point in the history
  • Loading branch information
notnotmelon committed Nov 2, 2024
1 parent 1fe2a7d commit d35256f
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
---------------------------------------------------------------------------------------------------
Version: 3.0.10
Date: ????
Changes:
- Added NOTHING
---------------------------------------------------------------------------------------------------
Version: 3.0.9
Date: 2024-11-1
Changes:
Expand Down
40 changes: 40 additions & 0 deletions lib/metas/item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
---@field public add_flag fun(self: data.ItemPrototype, flag: string): data.ItemPrototype
---@field public remove_flag fun(self: data.ItemPrototype, flag: string): data.ItemPrototype
---@field public has_flag fun(self: data.ItemPrototype, flag: string): boolean
---@field public spoil fun(self: data.ItemPrototype, spoil_result: (string | table), spoil_ticks: number): data.ItemPrototype

local item_prototypes = defines.prototypes.item
ITEM = setmetatable({}, {
Expand Down Expand Up @@ -57,4 +58,43 @@ metas.has_flag = function(self, flag)
return false
end

py.spoil_triggers = {
-- typically used for items that evaporate at room temperature
puff_of_smoke = function()
return {
trigger = {
type = "direct",
action_delivery = {
type = "instant",
source_effects = {
type = "create-trivial-smoke",
smoke_name = "smoke-building",
repeat_count = 4,
affects_target = true,
offset_deviation = {{-0.2, -0.2}, {0.2, 0.2}},
starting_frame_deviation = 5,
speed_from_center = 0.03
}
}
},
items_per_trigger = 1,
}
end
}

metas.spoil = function(self, spoil_result, spoil_ticks)
if not feature_flags.space_travel then return end
if not spoil_ticks then error("No spoil ticks provided for item " .. self.name) end

if type(spoil_result) == "string" then
self.spoil_result = spoil_result
elseif type(spoil_result) == "table" and spoil_result.trigger then
self.spoil_to_trigger_result = spoil_result
else
error("Invalid spoil result provided for item " .. self.name)
end

self.spoil_ticks = spoil_ticks
end

return metas

0 comments on commit d35256f

Please sign in to comment.