Skip to content

Commit

Permalink
Map change and module change
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerkiz committed Nov 6, 2024
1 parent d464c5f commit 72eb140
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 49 deletions.
2 changes: 1 addition & 1 deletion locale/en/rpg.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ flameboots_tooltip=When the bullets simply don´t bite.
explosive_bullets_label=Enable explosive bullets?
explosive_bullets_tooltip=Hurts the biters a bit extra
magic_label=Enable spawning with fish?
magic_label_custom=Enable casting spells with __CONTROL__mtn-ctrl-cast-spell__?
magic_label_custom=Enable casting spells with __CONTROL__mtn-shift-cast-spell__?
toggle_cast_spell_label=Toggles the ability to cast spells.
cast_spell_enabled_label=Casting spells with fish has been enabled!
cast_spell_disabled_label=Casting spells with fish has been disabled!
Expand Down
90 changes: 68 additions & 22 deletions maps/mountain_fortress_v3/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ local function draw_notice_frame(player)
label_flow.style.top_padding = 10
label_flow.style.left_padding = 24

local info_message = '[font=heading-1]Work in progress - balance not guaranteed[/font]\n\nPlease note that this experience is a work in progress, and the gameplay balance may vary significantly.\nSome features are still being fine-tuned, so expect occasional bugs or unbalanced elements.\nYour feedback is welcome at our discord in #mount-fortress.\n\nEnjoy and explore, but proceed with caution! ☺\n\n/Gerkiz'
local info_message = '[font=heading-1]Work in progress - balance not guaranteed[/font]\n\nPlease note that this experience is a work in progress, and the gameplay balance may vary significantly.\nSome features are still being fine-tuned, so expect occasional bugs or unbalanced elements.\nPlease post your feedbacks in #mount-fortress.\n\nEnjoy and explore, but proceed with caution! ☺\n\n/Gerkiz'

label_flow.style.horizontally_stretchable = false
local label = label_flow.add { type = 'label', caption = info_message }
Expand Down Expand Up @@ -741,27 +741,68 @@ local set_worm_raffle_token =
Task.register(
function (event)
local level = event.level
WD.set(
'worm_raffle',
{
['small-worm-turret'] = round(1000 - level * 1.75, 6),
['medium-worm-turret'] = round(level, 6),
['big-worm-turret'] = 0,
['behemoth-worm-turret'] = 0
}
)
local worm_raffle = WD.get('worm_raffle') --[[@as table]]

if level > 500 then
worm_raffle['medium-worm-turret'] = round(500 - (level - 500), 6)
worm_raffle['big-worm-turret'] = round((level - 500) * 2, 6)
end
if level > 800 then
worm_raffle['behemoth-worm-turret'] = round((level - 800) * 3, 6)
end
for k, _ in pairs(worm_raffle) do
if worm_raffle[k] < 0 then
worm_raffle[k] = 0
if not is_modded then
WD.set(
'worm_raffle',
{
['small-worm-turret'] = round(1000 - level * 1.75, 6),
['medium-worm-turret'] = round(level, 6),
['big-worm-turret'] = 0,
['behemoth-worm-turret'] = 0
}
)
local worm_raffle = WD.get('worm_raffle') --[[@as table]]

if level > 500 then
worm_raffle['medium-worm-turret'] = round(500 - (level - 500), 6)
worm_raffle['big-worm-turret'] = round((level - 500) * 2, 6)
end
if level > 800 then
worm_raffle['behemoth-worm-turret'] = round((level - 800) * 3, 6)
end
for k, _ in pairs(worm_raffle) do
if worm_raffle[k] < 0 then
worm_raffle[k] = 0
end
end
else
WD.set(
'worm_raffle',
{
['small-worm-turret'] = round(1000 - level * 1.75, 6),
['mtn-addon-small-explosive-worm-turret'] = round(1000 - level * 1.75, 6),
['mtn-addon-small-fire-worm-turret'] = round(1000 - level * 1.75, 6),
['mtn-addon-small-piercing-worm-turret'] = round(1000 - level * 1.75, 6),
['mtn-addon-small-poison-worm-turret'] = round(1000 - level * 1.75, 6),
['mtn-addon-small-electric-worm-turret'] = round(1000 - level * 1.75, 6),
['medium-worm-turret'] = round(level, 6),
['big-worm-turret'] = 0,
['behemoth-worm-turret'] = 0
}
)
local worm_raffle = WD.get('worm_raffle') --[[@as table]]

if level > 500 then
worm_raffle['mtn-addon-medium-explosive-worm-turret'] = round(500 - (level - 500), 6)
worm_raffle['mtn-addon-medium-fire-worm-turret'] = round(500 - (level - 500), 6)
worm_raffle['mtn-addon-medium-piercing-worm-turret'] = round(500 - (level - 500), 6)
worm_raffle['mtn-addon-medium-poison-worm-turret'] = round(500 - (level - 500), 6)
worm_raffle['mtn-addon-medium-electric-worm-turret'] = round(500 - (level - 500), 6)
worm_raffle['medium-worm-turret'] = round(500 - (level - 500), 6)
worm_raffle['big-worm-turret'] = round((level - 500) * 2, 6)
end
if level > 800 then
worm_raffle['mtn-addon-big-explosive-worm-turret'] = round((level - 800) * 3, 6)
worm_raffle['mtn-addon-big-fire-worm-turret'] = round((level - 800) * 3, 6)
worm_raffle['mtn-addon-big-piercing-worm-turret'] = round((level - 800) * 3, 6)
worm_raffle['mtn-addon-big-poison-worm-turret'] = round((level - 800) * 3, 6)
worm_raffle['mtn-addon-big-electric-worm-turret'] = round((level - 800) * 3, 6)
worm_raffle['behemoth-worm-turret'] = round((level - 800) * 3, 6)
end
for k, _ in pairs(worm_raffle) do
if worm_raffle[k] < 0 then
worm_raffle[k] = 0
end
end
end
end
Expand Down Expand Up @@ -2126,6 +2167,7 @@ function Public.on_player_joined_game(event)
local players = Public.get('players')
local player = game.players[event.player_index]


Difficulty.clear_top_frame(player)
Modifiers.update_player_modifiers(player)
local active_surface_index = Public.get('active_surface_index')
Expand Down Expand Up @@ -2156,6 +2198,10 @@ function Public.on_player_joined_game(event)
Alert.alert_player(player, 15, death_message)
end
player.clear_items_inside()
if Public.is_modded then
draw_notice_frame(player)
end

for item, data in pairs(this.starting_items) do
player.insert({ name = item, count = data.count })
end
Expand Down
50 changes: 25 additions & 25 deletions modules/autostash.lua
Original file line number Diff line number Diff line change
Expand Up @@ -809,14 +809,14 @@ Gui.on_click(
)

if script.active_mods['MtnFortressAddons'] then
Event.add("mtn-ctrl-autostash-all", function (event)
local is_spamming = SpamProtection.is_spamming(event.player, nil, 'Autostash click')
if is_spamming then
Event.add("mtn-shift-autostash-all", function (event)
local player = game.get_player(event.player_index)
if not player or not player.valid then
return
end

local player = game.get_player(event.player_index)
if not player or not player.valid then
local is_spamming = SpamProtection.is_spamming(player, nil, 'Autostash click')
if is_spamming then
return
end

Expand All @@ -835,14 +835,14 @@ if script.active_mods['MtnFortressAddons'] then
auto_stash(player, event)
end)

Event.add("mtn-ctrl-autostash-ores", function (event)
local is_spamming = SpamProtection.is_spamming(event.player, nil, 'Autostash click')
if is_spamming then
Event.add("mtn-shift-autostash-ores", function (event)
local player = game.get_player(event.player_index)
if not player or not player.valid then
return
end

local player = game.get_player(event.player_index)
if not player or not player.valid then
local is_spamming = SpamProtection.is_spamming(player, nil, 'Autostash click')
if is_spamming then
return
end

Expand All @@ -861,14 +861,14 @@ if script.active_mods['MtnFortressAddons'] then
auto_stash(player, event)
end)

Event.add("mtn-ctrl-autostash-furnaces", function (event)
local is_spamming = SpamProtection.is_spamming(event.player, nil, 'Autostash click')
if is_spamming then
Event.add("mtn-shift-autostash-furnaces", function (event)
local player = game.get_player(event.player_index)
if not player or not player.valid then
return
end

local player = game.get_player(event.player_index)
if not player or not player.valid then
local is_spamming = SpamProtection.is_spamming(player, nil, 'Autostash click')
if is_spamming then
return
end

Expand All @@ -888,14 +888,14 @@ if script.active_mods['MtnFortressAddons'] then
auto_stash(player, event)
end)

Event.add("mtn-ctrl-autostash-filtered", function (event)
local is_spamming = SpamProtection.is_spamming(event.player, nil, 'Autostash click')
if is_spamming then
Event.add("mtn-shift-autostash-filtered", function (event)
local player = game.get_player(event.player_index)
if not player or not player.valid then
return
end

local player = game.get_player(event.player_index)
if not player or not player.valid then
local is_spamming = SpamProtection.is_spamming(player, nil, 'Autostash click')
if is_spamming then
return
end

Expand All @@ -915,14 +915,14 @@ if script.active_mods['MtnFortressAddons'] then
auto_stash(player, event)
end)

Event.add("mtn-ctrl-autostash-wagon", function (event)
local is_spamming = SpamProtection.is_spamming(event.player, nil, 'Autostash click')
if is_spamming then
Event.add("mtn-shift-autostash-wagon", function (event)
local player = game.get_player(event.player_index)
if not player or not player.valid then
return
end

local player = game.get_player(event.player_index)
if not player or not player.valid then
local is_spamming = SpamProtection.is_spamming(player, nil, 'Autostash click')
if is_spamming then
return
end

Expand Down
2 changes: 1 addition & 1 deletion modules/rpg/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,7 @@ Event.add(defines.events.on_player_respawned, on_player_respawned)
Event.add(defines.events.on_player_rotated_entity, on_player_rotated_entity)
Event.add(defines.events.on_pre_player_mined_item, on_pre_player_mined_item)
if script.active_mods['MtnFortressAddons'] then
Event.add('mtn-ctrl-cast-spell', on_player_used_capsule_custom)
Event.add('mtn-shift-cast-spell', on_player_used_capsule_custom)
end
Event.add(defines.events.on_player_used_capsule, on_player_used_capsule)
Event.add(defines.events.on_player_changed_surface, on_player_changed_surface)
Expand Down

0 comments on commit 72eb140

Please sign in to comment.