Skip to content

Commit 8fb3acd

Browse files
authored
Add new features to Diggy (#1494)
Add Shelob & flaming Pumpjacks to Diggy
1 parent 3b69b78 commit 8fb3acd

File tree

5 files changed

+84
-1
lines changed

5 files changed

+84
-1
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
-- Destroy oilwells when pumpjack explodes from fire
2+
-- created by perfectwill
3+
4+
local Event = require 'utils.event'
5+
6+
local explosions = {
7+
'massive-explosion',
8+
'big-artillery-explosion',
9+
}
10+
11+
local Public = {}
12+
13+
Public.register = function()
14+
Event.add(defines.events.on_entity_died, function(event)
15+
local entity = event.entity
16+
if not (entity and entity.valid) then
17+
return
18+
end
19+
if entity.name == 'pumpjack' and (event.damage_type and event.damage_type.name == 'fire') then
20+
local oilwell = entity.surface.find_entity('crude-oil', entity.position)
21+
if not oilwell then
22+
return
23+
end
24+
25+
oilwell.surface.create_entity({
26+
name = explosions[math.random(#explosions)],
27+
position = oilwell.position,
28+
})
29+
oilwell.destroy()
30+
end
31+
end)
32+
end
33+
34+
return Public
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
-- Invincible vehicles with enough experience
2+
3+
local Event = require 'utils.event'
4+
local ForceControl = require 'features.force_control'
5+
6+
local Public = {}
7+
8+
Public.register = function()
9+
Event.on_built(function(event)
10+
local entity = event.entity
11+
if not (entity and entity.valid) then
12+
return
13+
end
14+
if entity.type ~= 'spider-vehicle' then
15+
return
16+
end
17+
local data = ForceControl.get_force_data(entity.force)
18+
if not (data and data.current_level and data.current_level > 300) then
19+
return
20+
end
21+
entity.destructible = false
22+
end)
23+
end
24+
25+
return Public

map_gen/maps/diggy/presets/danger_ores.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,14 @@ local config = {
372372
load = function() return require 'map_gen.maps.diggy.feature.mining_productivity' end,
373373
replace = script.active_mods['redmew-data'] == nil, -- replace mining productivity with robot cargo capacity
374374
},
375+
flaming_pumpjack = {
376+
enabled = true,
377+
load = function() return require('map_gen.maps.diggy.feature.flaming_pumpjack') end,
378+
},
379+
shelob = {
380+
enabled = true,
381+
load = function() return require('map_gen.maps.diggy.feature.shelob') end,
382+
},
375383
}
376384
}
377385

map_gen/maps/diggy/presets/danger_ores_BnB.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,14 @@ local config = {
371371
enabled = true,
372372
load = function() return require 'map_gen.maps.diggy.feature.mining_productivity' end,
373373
replace = script.active_mods['redmew-data'] == nil, -- replace mining productivity with robot cargo capacity
374+
},
375+
flaming_pumpjack = {
376+
enabled = true,
377+
load = function() return require('map_gen.maps.diggy.feature.flaming_pumpjack') end,
378+
},
379+
shelob = {
380+
enabled = true,
381+
load = function() return require('map_gen.maps.diggy.feature.shelob') end,
374382
},
375383
belts_n_bullets = {
376384
enabled = true,

map_gen/maps/diggy/presets/normal.lua

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,15 @@ local config = {
353353
weapon_balance = {
354354
enabled = true,
355355
load = function() return require('map_gen.maps.diggy.feature.weapon_balance') end
356-
}
356+
},
357+
flaming_pumpjack = {
358+
enabled = true,
359+
load = function() return require('map_gen.maps.diggy.feature.flaming_pumpjack') end,
360+
},
361+
shelob = {
362+
enabled = true,
363+
load = function() return require('map_gen.maps.diggy.feature.shelob') end,
364+
},
357365
}
358366
}
359367

0 commit comments

Comments
 (0)