mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 18:32:03 +00:00
Fixes #2182
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
4
html/changelogs/PJB3005-eguns.yml
Normal file
4
html/changelogs/PJB3005-eguns.yml
Normal 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%.
|
||||
Reference in New Issue
Block a user