1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-04 00:15:45 +02:00

rpg - add more buttons

This commit is contained in:
Gerkiz 2021-11-20 00:37:35 +01:00
parent 7150c04318
commit 9848941de2
2 changed files with 32 additions and 13 deletions

View File

@ -21,7 +21,7 @@ pool_reward=[color=blue]Global Pool Reward:[/color]\n __1__ received nothing. Re
[rpg_gui]
gain_info_tooltip=XP gain from mining, moving, crafting, repairing and combat.
allocate_info=Right-click to allocate __1__ points.\nShift + click to allocate all points.
allocate_info=Right-click to allocate __1__ points.\nShift + left-click to allocate all points\nShift + right-click to allocate half your points.
player_name=Hello __1__!
class_info=You're a __1__.
settings_frame=Configure your RPG player-settings here!

View File

@ -86,17 +86,36 @@ local function on_gui_click(event)
end
if shift then
local count = rpg_t.points_left
if not count then
return
if event.button == defines.mouse_button_type.left then
local count = rpg_t.points_left
if not count then
return
end
rpg_t.points_left = 0
rpg_t[index] = rpg_t[index] + count
if not rpg_t.reset then
rpg_t.total = rpg_t.total + count
end
Public.toggle(player, true)
Public.update_player_stats(player)
elseif event.button == defines.mouse_button_type.right then
local left = rpg_t.points_left / 2
if left > 2 then
for _ = 1, left, 1 do
if rpg_t.points_left <= 0 then
Public.toggle(player, true)
return
end
rpg_t.points_left = rpg_t.points_left - 1
rpg_t[index] = rpg_t[index] + 1
if not rpg_t.reset then
rpg_t.total = rpg_t.total + 1
end
Public.update_player_stats(player)
end
end
Public.toggle(player, true)
end
rpg_t.points_left = 0
rpg_t[index] = rpg_t[index] + count
if not rpg_t.reset then
rpg_t.total = rpg_t.total + count
end
Public.toggle(player, true)
Public.update_player_stats(player)
elseif event.button == defines.mouse_button_type.right then
for _ = 1, points_per_level, 1 do
if rpg_t.points_left <= 0 then
@ -590,8 +609,8 @@ local function one_punch(character, target, damage, get_health_pool)
if max_unit_health <= 0 then
max_unit_health = 4
end
if max_unit_health >= 15 then
max_unit_health = 15
if max_unit_health >= 10 then
max_unit_health = 10
end
local final = floor(damage * max_unit_health)
character.surface.create_entity(