Merge pull request #5829 from kevinz000/tg_vv

Ports TGstation view variables + admin proccall guards, and all the baggage that comes with it
This commit is contained in:
Neerti
2019-01-15 22:18:50 -05:00
committed by GitHub
81 changed files with 2264 additions and 1687 deletions
+1 -1
View File
@@ -94,7 +94,7 @@ var/list/fusion_cores = list()
. = owned_field.bullet_act(Proj)
/obj/machinery/power/fusion_core/proc/set_strength(var/value)
value = Clamp(value, MIN_FIELD_STR, MAX_FIELD_STR)
value = CLAMP(value, MIN_FIELD_STR, MAX_FIELD_STR)
field_strength = value
active_power_usage = 5 * value
if(owned_field)
@@ -140,7 +140,7 @@
return
if(href_list["access_device"])
var/idx = Clamp(text2num(href_list["toggle_active"]), 1, connected_devices.len)
var/idx = CLAMP(text2num(href_list["toggle_active"]), 1, connected_devices.len)
cur_viewed_device = connected_devices[idx]
updateUsrDialog()
return 1
@@ -73,7 +73,7 @@
if(!new_val)
to_chat(usr, "<span class='warning'>That's not a valid number.</span>")
return 1
G.mega_energy = Clamp(new_val, 1, 50)
G.mega_energy = CLAMP(new_val, 1, 50)
G.active_power_usage = G.mega_energy * 1500
updateUsrDialog()
return 1
@@ -83,7 +83,7 @@
if(!new_val)
to_chat(usr, "<span class='warning'>That's not a valid number.</span>")
return 1
G.rate = Clamp(new_val, 1, 10)
G.rate = CLAMP(new_val, 1, 10)
updateUsrDialog()
return 1
+2 -2
View File
@@ -65,7 +65,7 @@
set_dir(tesla_zap(src.loc, 7, TESLA_DEFAULT_POWER, TRUE))
for (var/ball in orbiting_balls)
var/range = rand(1, Clamp(orbiting_balls.len, 3, 7))
var/range = rand(1, CLAMP(orbiting_balls.len, 3, 7))
tesla_zap(ball, range, TESLA_MINI_POWER/7*range, TRUE)
else
energy = 0 // ensure we dont have miniballs of miniballs
@@ -285,7 +285,7 @@
closest_grounding_rod.tesla_act(power, explosive, stun_mobs)
else if(closest_mob)
var/shock_damage = Clamp(round(power/400), 10, 90) + rand(-5, 5)
var/shock_damage = CLAMP(round(power/400), 10, 90) + rand(-5, 5)
closest_mob.electrocute_act(shock_damage, source, 1 - closest_mob.get_shock_protection(), ran_zone())
log_game("TESLA([source.x],[source.y],[source.z]) Shocked [key_name(closest_mob)] for [shock_damage]dmg.")
message_admins("Tesla zapped [key_name_admin(closest_mob)]!")