View Single Post
Old 03-25-14, 04:18 PM   #3054
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by gap View Post
There are parts of your code I don't fully get.

Can you please express it in a numerical format (or just as pseudo-code)?
I read that function just fine and can follow exactly what it's doing

- checks to see if daytime
- if already nighttime then jump to end
- compare current available light (0.35) to start of nighttime value for player's unit (0.5)
- if current available light is greater than or equal to start of nighttime value for player's unit then jump to end
- subtract sunlight value - used to determine if nighttime (0.238) from start of nighttime value (0.5 - gets range) - result is 0.262
- if the result above is negative then jump to end
- subtract sunlight value - used to determine if nighttime (0.238) from current available sunlight (0.35) - result is 0.112
- if the result above is negative then clamp to 0.0
- divides 0.112 by 0.262 - result is 0.4275
- subtract 0.4275 from 1.0 thus getting % of range - result is 0.5725
- get nighttime multiplier (3.0) and add nighttime multiplier addition to it (1.0) - result is 4.0
- subtract 1.0 from 4.0 - this converts to 0 based - result is 3.0
- if the result above is negative then clamp to 0.0
- multiply 0.5725 by 3.0 - result is 1.7175
- add 1.0 to result above thus converting back to 1 based - result is 2.7175
- multiply minimum signal strength (0.1) by 2.7175 - result is 0.27175

0.27175 is new minimum signal strength
TheDarkWraith is offline   Reply With Quote