did you know refineries output slower when they're damaged?...

Discussion in 'General' started by Xyaminou, Aug 2, 2016.

  1. Smithy

    Smithy Developer Staff Member Administrator

    Messages:
    333
    Likes Received:
    68
    Trophy Points:
    0
    Code:
    // Sabotaging a refinery causes it to output resources at a reduced rate
        int iSabotageMultiplier = 1;
        if (IsSabotaged())
            iSabotageMultiplier = 2;
    
        if (m_iHealth >= 75)
            SetNextThink(gpGlobals->curtime + iSabotageMultiplier);
        else if (m_iHealth >= 50)
            SetNextThink(gpGlobals->curtime + 1.0f + iSabotageMultiplier);
        else if (m_iHealth >= 25)
            SetNextThink(gpGlobals->curtime + 2.0f + iSabotageMultiplier);
        else if (m_iHealth > 0)
            SetNextThink(gpGlobals->curtime + 3.0f + iSabotageMultiplier);
     
  2. Caelo

    Caelo Member

    Messages:
    2,371
    Likes Received:
    5
    Trophy Points:
    0
    so.. damaging hurts more than sabotaging? that's just weird..
    Scout can't even do a proper sabotage.. useless guy..
     
  3. flasche

    flasche Member Staff Member Moderator

    Messages:
    13,299
    Likes Received:
    168
    Trophy Points:
    0
    i like how its called multiplier
     
  4. LordDz_2

    LordDz_2 Strange things happens here

    Messages:
    2,956
    Likes Received:
    93
    Trophy Points:
    0
    ?
    Sabotage deals 50% of the health as damage to the building.
    So with sabotage it's 3s, without sabotage it's 2s.
     
  5. Caelo

    Caelo Member

    Messages:
    2,371
    Likes Received:
    5
    Trophy Points:
    0
    ah yes.. sabotage also damages the building.. I forgot to take that into account.
     
  6. Xyaminou

    Xyaminou Member

    Messages:
    1,369
    Likes Received:
    156
    Trophy Points:
    0
    I don't understand the SabotageMultiplier, it seems like it's 1 when the building is not sabotaged and 2 when it is. It makes sense as a multiplier but it seems like it's not used as a multiplier instead it's a simple addition.
    Also, what does the "f" stand for in "1.0f"?
    Also also, how can a building be sabotaged above 50% HP, doesn't getting it above 50% HP remove the sabotaged part?

    so if I'm reading this right:
    From 100% to 75% = normal output = 1 second
    From 75% to 50% = half output = 2 seconds
    From 50% to 25% = 1/3 output = 3 seconds
    From 25% to 0% = 1/4 output = 4 seconds

    and sabotage just adds +1 second?
     
    Last edited: Aug 3, 2016
  7. Caelo

    Caelo Member

    Messages:
    2,371
    Likes Received:
    5
    Trophy Points:
    0
    I bet it was a multiplication once and then got 'refined' into an addition. No other reason to call it a multiplier.
     
  8. Xyaminou

    Xyaminou Member

    Messages:
    1,369
    Likes Received:
    156
    Trophy Points:
    0
    Maybe but then it means that a non-sabotaged building still gets +1s by default, according to that bit of code. Or am I reading this wrong?
     
  9. Caelo

    Caelo Member

    Messages:
    2,371
    Likes Received:
    5
    Trophy Points:
    0
    *1 with multiplication, but it's just speculation. Code like this tends to be rewritten, but original naming kept in place. I see it all the time @ work. Only way to see if it is true is to look into the git log.
     
  10. Smithy

    Smithy Developer Staff Member Administrator

    Messages:
    333
    Likes Received:
    68
    Trophy Points:
    0
    I think the code was slightly different before the interval timer was removed but it didnt act as a multiplier even before that. SabotageMultiplier is named falsely it is actually used as the interval right now. So sabotage doubles the res income interval.
     
  11. LordDz_2

    LordDz_2 Strange things happens here

    Messages:
    2,956
    Likes Received:
    93
    Trophy Points:
    0
    1.0f means it's a float, you can't write a decimal value in most coding languages without adding a f to it after.

    It's defined somewhere else that a building is not sabotaged when over 50% health, the code there just makes it easier to change that value without having to add code,
    if you wanted to require buildings to be 99% repaired to not be sabotaged. Probably in the IsSabotaged() function.
     
  12. Xyaminou

    Xyaminou Member

    Messages:
    1,369
    Likes Received:
    156
    Trophy Points:
    0
    Wait, so the default refinery resource output interval is defined by "int iSabotageMultiplier = 1;"?
    That raises so many questions...
    Is that intended?
    Is that from 2.9 after Tama removed the refinery resource output interval variable? or was it always that way?
    Did the refinery resource output interval variable ever do anything? did it modify the sabotage value? and therefore did the sabotaged refinery get fucked up when you'd change the refinery resource output interval?
    That's some pretty scary coding if you ask me.

    is it related to that?:
     
  13. Caelo

    Caelo Member

    Messages:
    2,371
    Likes Received:
    5
    Trophy Points:
    0
    I suggest you reread the thread, because some of the questions you've asked are already answered ^^

    Or an e or d...
     
  14. Smithy

    Smithy Developer Staff Member Administrator

    Messages:
    333
    Likes Received:
    68
    Trophy Points:
    0
    // Refinery output can't go below this percentage.
    emp_sv_refinery_diminishing_returns_basevalue - default 0.25
    // For each refinery, diminish output by this amount.
    emp_sv_refinery_diminishing_returns_valueperrefinery - default 0 - or OFF

    So lets say all your refineries output 100 (just to make this example simple), and you have 5 refineries. As an example consider the following:
    emp_sv_refinery_diminishing_returns_basevalue = 0.25
    emp_sv_refinery_diminishing_returns_valueperrefinery = 0.2

    Code:
    Refinery 1 - 100 output - Total team ref output = 100 - First refinery outputs full output set by map.
    Refinery 2 - 80 output - Total team ref output = 180 - Second value is full output multiplied by 1 - emp_sv_refinery_diminishing_returns_valueperrefinery
    Refinery 3 - 60 output - Total team ref output = 240 - Third value is full output multiplied by 1 - (emp_sv_refinery_diminishing_returns_valueperrefinery * 2)
    Refinery 4 - 40 output - Total team ref output = 280 - Fourth value is full output multiplied by 1 - (emp_sv_refinery_diminishing_returns_valueperrefinery * 3)
    Refinery 5 - 25 output - Total team ref output = 305 - Fifth value is full output multiplied by emp_sv_refinery_diminishing_returns_basevalue because 1 - (emp_sv_refinery_diminishing_returns_valueperrefinery * 4) is below emp_sv_refinery_diminishing_returns_basevalue.
     
    complete_ likes this.

Share This Page