Skip to content

Commit

Permalink
Add function to rescale remnants
Browse files Browse the repository at this point in the history
  • Loading branch information
kirazy committed Jul 6, 2020
1 parent b95fdde commit 9641ea2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
4 changes: 3 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---------------------------------------------------------------------------------------------------
Version: 0.00.8
Date: 2020.06.XX
Date: 2020.07.06
Features:
- Added function "rescale_remnant"
---------------------------------------------------------------------------------------------------
Version: 0.00.7
Date: 2020.06.24
Expand Down
22 changes: 22 additions & 0 deletions prototypes/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -822,4 +822,26 @@ function reskins.lib.setting(name)
end

return startup_setting
end

-- Rescale remnant entities
function reskins.lib.rescale_remnant(entity, scale)
-- Check the entity exists
if not entity then return end

-- Fetch remnant
local remnant_name = entity.corpse

-- Create, rescale, and assign rescaled remnant
if remnant_name then
local remnant = data.raw.corpse[remnant_name]

if remnant then
rescaled_remnant = util.copy(remnant)
rescaled_remnant.name = "rescaled-"..rescaled_remnant.name
reskins.lib.rescale_entity(rescaled_remnant, scale)
data:extend({rescaled_remnant})
entity.corpse = rescaled_remnant.name
end
end
end

0 comments on commit 9641ea2

Please sign in to comment.