Cursed Upgradable Buildings

by L0771

* Blood handling * Upgradable buildings: - Mining drill - Assembling Machine - Furnace - Lab - Fisher - Turret - Wall - Energy Generator - Headquarter * New mecanics * Auto attack base * Auto attack base

Overhaul
4 years ago
0.16 - 1.1
974

i Reach logic

6 years ago

So I realized that the resource reach distance ( player.character_resource_reach_distance_bonus - for mining trees etc) doesn't increase with the talent, so mining trees is a real pain in the ass because you have to go extremely close. Also, the item pickup distance does increase, which makes it impossible to pick things up from belts without picking up like the entire main bus. is this intended behavior or is it a bug?

I changed it locally so that I can mine trees at the same distance as building stuff, and so that the item pickup range is never increased.

gui.lua:

    elseif event.element.name == "talent6c5" then
        if event.shift then player.print({"tip.t6_5"})
        else
        if (functions_talents.removeTalentsAll(player,6,1)) then
            talents[6][5].now = talents[6][5].now + 1
            new_bonus = player.character_build_distance_bonus + 0.5
            player.character_build_distance_bonus  = new_bonus
            player.character_item_drop_distance_bonus  = new_bonus
            player.character_reach_distance_bonus  = new_bonus
            player.character_resource_reach_distance_bonus  = new_bonus
            -- a large item pickup distance is really annoying...
            player.character_item_pickup_distance_bonus = 0
            player.character_loot_pickup_distance_bonus  = math.min(new_bonus, 320)
            updateGui(player,"frameMain1","talentsMain6")
        end end
    elseif event.element.name == "talent6c5p" then
        if event.shift then player.print({"tip.t6_5"})
        else
        local max = player.get_item_count("cursed-talent-6") + inv.talents["pt6"]
        if max > 0 then
            functions_talents.removeTalentsAll(player,6,max)
            talents[6][5].now = talents[6][5].now + max
            new_bonus = player.character_build_distance_bonus + max * 0.5
            player.character_build_distance_bonus = new_bonus
            player.character_item_drop_distance_bonus = new_bonus
            player.character_reach_distance_bonus = new_bonus
            player.character_resource_reach_distance_bonus  = new_bonus
            player.character_item_pickup_distance_bonus = 0 --math.min(new_bonus, 320)
            player.character_loot_pickup_distance_bonus = math.min(new_bonus, 320)
            updateGui(player,"frameMain1","talentsMain6")
        end end

on_player_respawned.lua:

player.character_inventory_slots_bonus = player.character_inventory_slots_bonus + talents[6][3].now
player.character_logistic_slot_count_bonus  = player.character_logistic_slot_count_bonus  + talents[6][4].now
player.character_build_distance_bonus = player.character_build_distance_bonus + talents[6][5].now * 0.5
player.character_item_drop_distance_bonus = player.character_item_drop_distance_bonus + talents[6][5].now * 0.5
player.character_reach_distance_bonus = player.character_reach_distance_bonus + talents[6][5].now * 0.5
player.character_resource_reach_distance_bonus = player.character_resource_reach_distance_bonus + talents[6][5].now * 0.5
player.character_item_pickup_distance_bonus = 0
player.character_loot_pickup_distance_bonus = math.min(player.character_loot_pickup_distance_bonus + talents[6][5].now * 0.5,320)

New response