mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Mapper sanity checks
- Checks that mapped values add up to 100% so mappers can't set unusual ratios
This commit is contained in:
@@ -17,20 +17,32 @@
|
|||||||
/obj/machinery/atmospherics/omni/mixer/New()
|
/obj/machinery/atmospherics/omni/mixer/New()
|
||||||
..()
|
..()
|
||||||
if(mapper_set())
|
if(mapper_set())
|
||||||
|
var/con = 0
|
||||||
for(var/datum/omni_port/P in ports)
|
for(var/datum/omni_port/P in ports)
|
||||||
switch(P.dir)
|
switch(P.dir)
|
||||||
if(NORTH)
|
if(NORTH)
|
||||||
if(tag_north_con)
|
if(tag_north_con && tag_north == 1)
|
||||||
P.concentration = tag_north_con
|
P.concentration = tag_north_con
|
||||||
|
con += max(0, tag_north_con)
|
||||||
if(SOUTH)
|
if(SOUTH)
|
||||||
if(tag_south_con)
|
if(tag_south_con && tag_south == 1)
|
||||||
P.concentration = tag_south_con
|
P.concentration = tag_south_con
|
||||||
|
con += max(0, tag_south_con)
|
||||||
if(EAST)
|
if(EAST)
|
||||||
if(tag_east_con)
|
if(tag_east_con && tag_east == 1)
|
||||||
P.concentration = tag_east_con
|
P.concentration = tag_east_con
|
||||||
|
con += max(0, tag_east_con)
|
||||||
if(WEST)
|
if(WEST)
|
||||||
if(tag_west_con)
|
if(tag_west_con && tag_west == 1)
|
||||||
P.concentration = tag_west_con
|
P.concentration = tag_west_con
|
||||||
|
con += max(0, tag_west_con)
|
||||||
|
|
||||||
|
//mappers who are bad at maths will be punished (total concentration must be 100%)
|
||||||
|
if(con != 1)
|
||||||
|
tag_north_con = null
|
||||||
|
tag_south_con = null
|
||||||
|
tag_east_con = null
|
||||||
|
tag_west_con = null
|
||||||
|
|
||||||
/obj/machinery/atmospherics/omni/mixer/Del()
|
/obj/machinery/atmospherics/omni/mixer/Del()
|
||||||
inputs.Cut()
|
inputs.Cut()
|
||||||
|
|||||||
Reference in New Issue
Block a user