mass storage wreck

Moderator: JaggedAppliance

mass storage wreck

Postby Ithilis_Quo » 27 Oct 2019, 12:05

There is simply and logical change.

Storage store mass, when someone lose storage should lose also mass that is stored inside (that is logical) not only max amount of mass but also that % portion that was stored in that concrete storage.

When mass storages is destroyed realse wreck with mass. And this mass should contain also portion of mass that was stored inside (that is also logical).

Taking this storages can be a tasty treasure when destroying storages, so mass will be less abstract magnitude but something that is more real and ready for reclaim.



half of this is in some mod that I will not name here.
"Fixed in Equilibrium" Washy
User avatar
Ithilis_Quo
Supreme Commander
 
Posts: 1390
Joined: 29 Dec 2012, 15:55
Location: Slovakia
Has liked: 395 times
Been liked: 181 times
FAF User Name: Ithilis

Re: mass storage wreck

Postby PhilipJFry » 27 Oct 2019, 12:57

can you make a PR on the fa repo for that?
cats>dogs
post logs
User avatar
PhilipJFry
Supreme Commander
 
Posts: 2635
Joined: 23 Mar 2016, 21:16
Location: Austria
Has liked: 232 times
Been liked: 348 times
FAF User Name: PhilipJFry

Re: mass storage wreck

Postby Ithilis_Quo » 27 Oct 2019, 15:02

PhilipJFry wrote:can you make a PR on the fa repo for that?

I fail on publishing new branch, me github don't allow me to publish brunch not even make PR, and im too lazy now to figure out how to fix it. But:

There is code from equilibrium for the first half, second half if far beyond my skill.

fa/lua/sim/unit.lua

Code: Select all
-----
--Mass storages lose the mass contained in them when they die 
-----

    HandleStorage = function(self, to_army)
        if EntityCategoryContains(categories.MOBILE, self) then
            return -- Exclude ACU / SCU / sparky
        end

        local bp = self:GetBlueprint()
        local brain = GetArmyBrain(self:GetArmy())
        for _, t in {'Mass', 'Energy'} do
            if bp.Economy['Storage' .. t] then
                local type = string.upper(t)
                local amount = bp.Economy['Storage' .. t] * brain:GetEconomyStoredRatio(type)

                brain:TakeResource(type, amount)
                if to_army then
                    local to = GetArmyBrain(to_army)
                    to:GiveResource(type, amount)
                end
            end
        end
    end,   
"Fixed in Equilibrium" Washy
User avatar
Ithilis_Quo
Supreme Commander
 
Posts: 1390
Joined: 29 Dec 2012, 15:55
Location: Slovakia
Has liked: 395 times
Been liked: 181 times
FAF User Name: Ithilis


Return to Balance Discussion

Who is online

Users browsing this forum: No registered users and 1 guest