Skip to content

Commit

Permalink
0.4.3 - Using pre_mined for mod compatibility
Browse files Browse the repository at this point in the history
Fixes #1
  • Loading branch information
dustine committed Oct 7, 2017
1 parent 8660fbc commit d8fef13
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"lua.targetVersion": "5.2"
}
13 changes: 9 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). Mostly.

## [Unreleased]

## [0.4.3] - 2017-10-07
### Fixed
- Chargers are disassembled on pre_mined event now for mod compatibility

## [0.4.2] - 2017-10-03
### Fixed
- Ensure valid unpaired index before iterating (could cause desync)
Expand All @@ -21,8 +25,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). Mostly.
### Added
- Description on bot charger, to hint at rotating mechanic
### Changed
- Remade the overtaxed graphic to be more intuitive and in line with the new warning basegame design
- Bots can be charged more than once a second (less than sucessful optimization removed)
- Remade the overtaxed graphic to be more intuitive and in line with the new warning base-game design
- Bots can be charged more than once a second (less than successful optimization removed)
- Buffed chargers so they can accept up to 24MW (previously 10MW)
- Made bot chargers respect `worker_robots_battery_modifier`
### Fixed
Expand All @@ -40,7 +44,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). Mostly.
- Changelog
- Referral in README for KoS
### Changed
- Reworked README for better compatability with Factorio's mod portal
- Reworked README for better compatibility with Factorio's mod portal
- .gitignore ignores mod portal images (including icon)
- Mod metadata points at forum thread
### Fixed
Expand All @@ -52,7 +56,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). Mostly.
- Custom overtaxing
- README as mod documentation

[Unreleased]: https://github.com/dustine/ChargeTransmission/compare/v0.4.2...HEAD
[Unreleased]: https://github.com/dustine/ChargeTransmission/compare/v0.4.3...HEAD
[0.4.3]: https://github.com/dustine/ChargeTransmission/compare/v0.4.2...v0.4.3
[0.4.2]: https://github.com/dustine/ChargeTransmission/compare/v0.4.1...v0.4.2
[0.4.1]: https://github.com/dustine/ChargeTransmission/compare/v0.4.0...v0.4.1
[0.4.0]: https://github.com/dustine/ChargeTransmission/compare/v0.3.2...v0.4.0
Expand Down
14 changes: 8 additions & 6 deletions control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,13 @@ local function on_mined_charger(charger)
if(charger.name:find("charge%-transmission_charger")) then
-- remove composite partners
local data = Entity.get_data(charger)
if data.transmitter and data.transmitter.valid then data.transmitter.destroy() end
if data.warning and data.warning.valid then data.warning.destroy() end
if data then
if data.transmitter and data.transmitter.valid then data.transmitter.destroy() end
if data.warning and data.warning.valid then data.warning.destroy() end

-- erase data
Entity.set_data(charger, nil)
-- erase data
Entity.set_data(charger, nil)
end

-- remove oneself from nodes
unpair_charger(charger)
Expand Down Expand Up @@ -265,8 +267,8 @@ Event.register(defines.events.on_robot_built_entity, function(event) on_built_ch

-- TODO: the function is kind of a misnamer now, isn't it
Event.register(defines.events.on_entity_died, function(event) on_mined_charger(event.entity) end)
Event.register(defines.events.on_player_mined_entity, function(event) on_mined_charger(event.entity) end)
Event.register(defines.events.on_robot_mined_entity, function(event) on_mined_charger(event.entity) end)
Event.register(defines.events.on_preplayer_mined_item, function(event) on_mined_charger(event.entity) end)
Event.register(defines.events.on_robot_pre_mined, function(event) on_mined_charger(event.entity) end)

Event.register(defines.events.on_player_rotated_entity, function(event)
if(event.entity.name:find("charge%-transmission_charger%-transmitter")) then
Expand Down
2 changes: 1 addition & 1 deletion info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ChargeTransmission",
"version": "0.4.2",
"version": "0.4.3",
"title": "Charge Transmission",
"author": "Dustine",
"dependencies": ["base >= 0.15.34"],
Expand Down

0 comments on commit d8fef13

Please sign in to comment.