Added tray lighting verb.

This commit is contained in:
Zuhayr
2015-02-22 17:25:15 +10:30
parent d0ca48cd25
commit 23b93e7540
5 changed files with 27 additions and 13 deletions

View File

@@ -233,7 +233,7 @@
origin_turf.visible_message("<span class='danger'>The [thrown.name] splatters against [target]!</span>")
del(thrown)
/datum/seed/proc/handle_environment(var/turf/current_turf, var/datum/gas_mixture/environment, var/check_only)
/datum/seed/proc/handle_environment(var/turf/current_turf, var/datum/gas_mixture/environment, var/light_supplied, var/check_only)
var/health_change = 0
// Handle gas consumption.
@@ -261,17 +261,18 @@
// Handle gas production.
if(exude_gasses && exude_gasses.len && !check_only)
for(var/gas in exude_gasses)
environment.adjust_gas(gas, max(1,round((exude_gasses[gas]*get_trait(TRAIT_POTENCY))/exude_gasses.len)))
environment.adjust_gas(gas, max(1,round((exude_gasses[gas]*(get_trait(TRAIT_POTENCY)/5))/exude_gasses.len)))
// Handle light requirements.
var/area/A = get_area(current_turf)
if(A)
var/light_available
if(A.lighting_use_dynamic)
light_available = max(0,min(10,current_turf.lighting_lumcount)-5)
else
light_available = 5
if(abs(light_available - get_trait(TRAIT_IDEAL_LIGHT)) > get_trait(TRAIT_LIGHT_TOLERANCE))
if(!light_supplied)
var/area/A = get_area(current_turf)
if(A)
if(A.lighting_use_dynamic)
light_supplied = max(0,min(10,current_turf.lighting_lumcount)-5)
else
light_supplied = 5
if(light_supplied)
if(abs(light_supplied - get_trait(TRAIT_IDEAL_LIGHT)) > get_trait(TRAIT_LIGHT_TOLERANCE))
health_change += rand(1,3) * HYDRO_SPEED_MULTIPLIER
return health_change

View File

@@ -30,7 +30,7 @@
// Handle life.
var/turf/simulated/T = get_turf(src)
if(istype(T))
health -= seed.handle_environment(T, T.return_air(),1)
health -= seed.handle_environment(T,T.return_air(),null,1)
if(health < max_health)
health += rand(3,5)
refresh_icon()

View File

@@ -27,6 +27,7 @@
var/mutation_mod = 0 // Modifier to mutation chance
var/toxins = 0 // Toxicity in the tray?
var/mutation_level = 0 // When it hits 100, the plant mutates.
var/tray_light = 1 // Supplied lighting.
// Mechanical concerns.
var/health = 0 // Plant health.
@@ -350,6 +351,14 @@
return
/obj/machinery/portable_atmospherics/hydroponics/verb/set_light()
set name = "Set Light"
set category = "Object"
set src in view(1)
var/new_light = input("Specify a light level.") as null|anything in list(0,1,2,3,4,5,6,7,8,9,10)
if(new_light)
tray_light = new_light
usr << "You set the tray to a light level of [tray_light] lumens."
/obj/machinery/portable_atmospherics/hydroponics/proc/check_level_sanity()
//Make sure various values are sane.

View File

@@ -60,7 +60,6 @@
// Check that pressure, heat and light are all within bounds.
// First, handle an open system or an unconnected closed system.
var/turf/T = loc
var/datum/gas_mixture/environment
// If we're closed, take from our internal sources.
@@ -71,7 +70,10 @@
if(!environment) return
// Seed datum handles gasses, light and pressure.
health -= seed.handle_environment(T,environment)
if(mechanical && closed_system)
health -= seed.handle_environment(T,environment,tray_light)
else
health -= seed.handle_environment(T,environment)
// If we're attached to a pipenet, then we should let the pipenet know we might have modified some gasses
if (closed_system && connected_port)

View File

@@ -4,6 +4,7 @@
density = 0
use_power = 0
mechanical = 0
tray_light = 0
/obj/machinery/portable_atmospherics/hydroponics/soil/attackby(var/obj/item/O as obj, var/mob/user as mob)
if(istype(O,/obj/item/weapon/tank))
@@ -15,6 +16,7 @@
..()
verbs -= /obj/machinery/portable_atmospherics/hydroponics/verb/close_lid_verb
verbs -= /obj/machinery/portable_atmospherics/hydroponics/verb/remove_label
verbs -= /obj/machinery/portable_atmospherics/hydroponics/verb/set_light
/obj/machinery/portable_atmospherics/hydroponics/soil/CanPass()
return 1