Spoiler: The code you're talking about. 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);
so.. damaging hurts more than sabotaging? that's just weird.. Scout can't even do a proper sabotage.. useless guy..
? Sabotage deals 50% of the health as damage to the building. So with sabotage it's 3s, without sabotage it's 2s.
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?
I bet it was a multiplication once and then got 'refined' into an addition. No other reason to call it a multiplier.
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?
*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.
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.
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.
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?: Spoiler: 2.9.X testing
I suggest you reread the thread, because some of the questions you've asked are already answered Or an e or d...
// 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.