This commit is contained in:
PJB3005
2015-06-27 12:51:11 +02:00
parent 6b63a2286c
commit 5c75d4b51f
3 changed files with 18 additions and 8 deletions

View File

@@ -20,12 +20,12 @@ var/list/sqrtTable = list(1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4,
var/invcos = arccos(x / sqrt(x * x + y * y))
return y >= 0 ? invcos : -invcos
proc/arctan(x)
/proc/arctan(x)
var/y=arcsin(x/sqrt(1+x*x))
return y
/proc/Ceiling(x)
return -round(-x)
/proc/Ceiling(x, y = 1)
. = -round(-x / y) * y
//Moved to macros.dm to reduce pure calling overhead, this was being called shitloads, like, most calls of all procs.
/*
@@ -50,8 +50,8 @@ proc/arctan(x)
/proc/Default(a, b)
return a ? a : b
/proc/Floor(x)
return round(x)
/proc/Floor(x, y = 1)
. = round(x / y) * y
// Greatest Common Divisor - Euclid's algorithm
/proc/Gcd(a, b)

View File

@@ -16,7 +16,6 @@
update_icon()
..()
/obj/item/weapon/gun/energy/process_chambered()
if(in_chamber) return 1
if(!power_supply) return 0
@@ -25,13 +24,20 @@
in_chamber = new projectile_type(src)
return 1
/obj/item/weapon/gun/energy/update_icon()
if(!power_supply.maxcharge)
ASSERT(power_supply.maxcharge > 0)
return
var/ratio = power_supply.charge / power_supply.maxcharge
ratio = round(ratio, 0.25) * 100
ratio *= 100
if(ratio >= 50)
ratio = Floor(ratio, 25)
else
ratio = Ceiling(ratio, 25)
if(modifystate && charge_states)
icon_state = "[modifystate][ratio]"
else if(charge_states)

View File

@@ -0,0 +1,4 @@
author: PJB3005
delete-after: true
changes:
- tweak: Makes the code that changes the charge meter on an energy weapon round up below 50% and down above 50%.