Forged Alliance Forever Forged Alliance Forever Forums 2015-03-14T11:15:46+02:00 /feed.php?f=45&t=9581 2015-03-14T11:15:46+02:00 2015-03-14T11:15:46+02:00 /viewtopic.php?t=9581&p=96072#p96072 <![CDATA[Re: Update for FAF unitview.lua to allow for custom shield t]]> Statistics: Posted by Resin_Smoker — 14 Mar 2015, 11:15


]]>
2015-03-13T18:31:10+02:00 2015-03-13T18:31:10+02:00 /viewtopic.php?t=9581&p=96045#p96045 <![CDATA[Re: Update for FAF unitview.lua to allow for custom shield t]]>
Resin_Smoker wrote:
Wasnt talking about PR's but modding in general.


Okay well, let me know if there's any particular place where you feel we did something wrong.

Statistics: Posted by Sheeo — 13 Mar 2015, 18:31


]]>
2015-03-13T17:21:29+02:00 2015-03-13T17:21:29+02:00 /viewtopic.php?t=9581&p=96043#p96043 <![CDATA[Re: Update for FAF unitview.lua to allow for custom shield t]]>
Sheeo wrote:
Resin_Smoker wrote:
ckitching wrote:Please file a pull request:
https://github.com/FAForever/fa


My prior attempts all met with either disapproval or someone got pissy with the formatting. Not going to bother with that gain so either take it or leave it... after all i not only fixed my problem but a divide by zero error in faf as well.

Resin


Which PR's have you submitted that you feel were badly reviewed?


Wasnt talking about PR's but modding in general.

Statistics: Posted by Resin_Smoker — 13 Mar 2015, 17:21


]]>
2015-03-13T13:30:49+02:00 2015-03-13T13:30:49+02:00 /viewtopic.php?t=9581&p=96026#p96026 <![CDATA[Re: Update for FAF unitview.lua to allow for custom shield t]]>
Resin_Smoker wrote:
ckitching wrote:Please file a pull request:
https://github.com/FAForever/fa


My prior attempts all met with either disapproval or someone got pissy with the formatting. Not going to bother with that gain so either take it or leave it... after all i not only fixed my problem but a divide by zero error in faf as well.

Resin


Which PR's have you submitted that you feel were badly reviewed?

Statistics: Posted by Sheeo — 13 Mar 2015, 13:30


]]>
2015-03-13T02:12:21+02:00 2015-03-13T02:12:21+02:00 /viewtopic.php?t=9581&p=95999#p95999 <![CDATA[Re: Update for FAF unitview.lua to allow for custom shield t]]>
ckitching wrote:
Please file a pull request:
https://github.com/FAForever/fa


My prior attempts all met with either disapproval or someone got pissy with the formatting. Not going to bother with that gain so either take it or leave it... after all i not only fixed my problem but a divide by zero error in faf as well.

Resin

Statistics: Posted by Resin_Smoker — 13 Mar 2015, 02:12


]]>
2015-03-13T01:53:36+02:00 2015-03-13T01:53:36+02:00 /viewtopic.php?t=9581&p=95998#p95998 <![CDATA[Re: Update for FAF unitview.lua to allow for custom shield t]]> https://github.com/FAForever/fa

Statistics: Posted by ckitching — 13 Mar 2015, 01:53


]]>
2015-03-13T01:03:22+02:00 2015-03-13T01:03:22+02:00 /viewtopic.php?t=9581&p=95996#p95996 <![CDATA[Update for FAF unitview.lua to allow for custom shield types]]>
Spoiler: show
Code:
            if info.shieldRatio > 0 and info.userUnit:GetBlueprint().Defense.Shield.ShieldMaxHealth then
                local ShieldMaxHealth = info.userUnit:GetBlueprint().Defense.Shield.ShieldMaxHealth
                controls.shieldText:Show()
                if info.userUnit:GetBlueprint().Defense.Shield.ShieldRegenRate then
                    controls.shieldText:SetText(string.format("%d / %d +%d/s", math.floor(ShieldMaxHealth*info.shieldRatio), info.userUnit:GetBlueprint().Defense.Shield.ShieldMaxHealth , info.userUnit:GetBlueprint().Defense.Shield.ShieldRegenRate))
                else
                    controls.shieldText:SetText(string.format("%d / %d", math.floor(ShieldMaxHealth*info.shieldRatio), info.userUnit:GetBlueprint().Defense.Shield.ShieldMaxHealth ))
                end
            end

            if info.shieldRatio > 0 and info.userUnit:GetBlueprint().Defense.Shield.ShieldMaxHealth == nil then
                local ShieldMaxHealth = info.userUnit:GetBlueprint().Enhancements[getEnh.GetEnhancements(info.entityId).Back].ShieldMaxHealth
                controls.shieldText:Show()
                if info.userUnit:GetBlueprint().Enhancements[getEnh.GetEnhancements(info.entityId).Back].ShieldRegenRate then
                    controls.shieldText:SetText(string.format("%d / %d +%d/s", math.floor(ShieldMaxHealth*info.shieldRatio), ShieldMaxHealth , info.userUnit:GetBlueprint().Enhancements[getEnh.GetEnhancements(info.entityId).Back].ShieldRegenRate))
                else
                    controls.shieldText:SetText(string.format("%d / %d", math.floor(ShieldMaxHealth*info.shieldRatio), ShieldMaxHealth ))
                end
            end


Replacement script
Spoiler: show
Code:
if info.shieldRatio > 0 then
   local unitBp = info.userUnit:GetBlueprint()
   local ShieldMaxHealth, ShieldRegenRate
   if unitBp.Defense.Shield.ShieldMaxHealth > 0 then
      ShieldMaxHealth = unitBp.Defense.Shield.ShieldMaxHealth
      ShieldRegenRate = unitBp.Defense.Shield.ShieldRegenRate or 0
   elseif unitBp.Enhancements[getEnh.GetEnhancements(info.entityId).Back].ShieldMaxHealth > 0 then
      ShieldMaxHealth = unitBp.Enhancements[getEnh.GetEnhancements(info.entityId).Back].ShieldMaxHealth
      ShieldRegenRate = unitBp.Enhancements[getEnh.GetEnhancements(info.entityId).Back].ShieldRegenRate or 0
   elseif GetShieldParams(info.userUnit, 'MyShield') then
      local CustomShield = GetShieldParams(info.userUnit, 'MyShield')
      ShieldMaxHealth = CustomShield.ShieldMaxHealth or 0
      ShieldRegenRate = CustomShield.ShieldRegenRate or 0
   end
   if ShieldMaxHealth > 0 then
      controls.shieldText:Show()
      if ShieldRegenRate > 0 then
         controls.shieldText:SetText(string.format("%d / %d +%d/s", math.floor(ShieldMaxHealth*info.shieldRatio), ShieldMaxHealth, ShieldRegenRate))
      else
         controls.shieldText:SetText(string.format("%d / %d", math.floor(ShieldMaxHealth*info.shieldRatio), ShieldMaxHealth))
      end
   end
end


This is proposed to allow 4DC custom shield types to display without triggering a lua / ui error.

Resin

Statistics: Posted by Resin_Smoker — 13 Mar 2015, 01:03


]]>