Dev merge.

This commit is contained in:
Zuhayr
2015-05-11 18:45:14 +09:30
182 changed files with 2647 additions and 2741 deletions
+15 -15
View File
@@ -208,8 +208,8 @@
O.vars[variable]) as num|null
if(new_value == null) return
if(variable=="luminosity")
O.SetLuminosity(new_value)
if(variable=="light_range")
O.set_light(new_value)
else
O.vars[variable] = new_value
@@ -217,24 +217,24 @@
if(istype(O, /mob))
for(var/mob/M in mob_list)
if ( istype(M , O.type) )
if(variable=="luminosity")
M.SetLuminosity(new_value)
if(variable=="light_range")
M.set_light(new_value)
else
M.vars[variable] = O.vars[variable]
else if(istype(O, /obj))
for(var/obj/A in world)
if ( istype(A , O.type) )
if(variable=="luminosity")
A.SetLuminosity(new_value)
if(variable=="light_range")
A.set_light(new_value)
else
A.vars[variable] = O.vars[variable]
else if(istype(O, /turf))
for(var/turf/A in world)
if ( istype(A , O.type) )
if(variable=="luminosity")
A.SetLuminosity(new_value)
if(variable=="light_range")
A.set_light(new_value)
else
A.vars[variable] = O.vars[variable]
@@ -242,24 +242,24 @@
if(istype(O, /mob))
for(var/mob/M in mob_list)
if (M.type == O.type)
if(variable=="luminosity")
M.SetLuminosity(new_value)
if(variable=="light_range")
M.set_light(new_value)
else
M.vars[variable] = O.vars[variable]
else if(istype(O, /obj))
for(var/obj/A in world)
if (A.type == O.type)
if(variable=="luminosity")
A.SetLuminosity(new_value)
if(variable=="light_range")
A.set_light(new_value)
else
A.vars[variable] = O.vars[variable]
else if(istype(O, /turf))
for(var/turf/A in world)
if (A.type == O.type)
if(variable=="luminosity")
A.SetLuminosity(new_value)
if(variable=="light_range")
A.set_light(new_value)
else
A.vars[variable] = O.vars[variable]
@@ -372,4 +372,4 @@
A.vars[variable] = O.vars[variable]
log_admin("[key_name(src)] mass modified [original_name]'s [variable] to [O.vars[variable]]")
message_admins("[key_name_admin(src)] mass modified [original_name]'s [variable] to [O.vars[variable]]", 1)
message_admins("[key_name_admin(src)] mass modified [original_name]'s [variable] to [O.vars[variable]]", 1)
+2 -2
View File
@@ -455,10 +455,10 @@ var/list/forbidden_varedit_object_types = list(
O.vars[variable] = var_new
if("num")
if(variable=="luminosity")
if(variable=="light_range")
var/var_new = input("Enter new number:","Num",O.vars[variable]) as null|num
if(var_new == null) return
O.SetLuminosity(var_new)
O.set_light(var_new)
else if(variable=="stat")
var/var_new = input("Enter new number:","Num",O.vars[variable]) as null|num
if(var_new == null) return
+10 -6
View File
@@ -18,6 +18,7 @@
var/list/sources = new() //List of sources triggering the alarm. Used to determine when the alarm should be cleared.
var/list/sources_assoc = new() //Associative list of source triggers. Used to efficiently acquire the alarm source.
var/list/cameras //List of cameras that can be switched to, if the player has that capability.
var/cache_id //ID for camera cache, changed by invalidateCameraCache().
var/area/last_area //The last acquired area, used should origin be lost (for example a destroyed borg containing an alarming camera).
var/area/last_name //The last acquired name, used should origin be lost
var/area/last_camera_area //The last area in which cameras where fetched, used to see if the camera list should be updated.
@@ -74,8 +75,12 @@
return last_name
/datum/alarm/proc/cameras()
// reset camera cache
if(camera_cache_id != cache_id)
cameras = null
cache_id = camera_cache_id
// If the alarm origin has changed area, for example a borg containing an alarming camera, reset the list of cameras
if(cameras && (last_camera_area != alarm_area()))
else if(cameras && (last_camera_area != alarm_area()))
cameras = null
// The list of cameras is also reset by /proc/invalidateCameraCache()
@@ -96,18 +101,17 @@
* Assisting procs *
******************/
/atom/proc/get_alarm_area()
var/area/A = get_area(src)
return A.master
return get_area(src)
/area/get_alarm_area()
return src.master
return src
/atom/proc/get_alarm_name()
var/area/A = get_area(src)
return A.master.name
return A.name
/area/get_alarm_name()
return master.name
return name
/mob/get_alarm_name()
return name
+1 -2
View File
@@ -84,8 +84,7 @@
return src
/turf/get_alarm_origin()
var/area/area = get_area(src)
return area.master // Very important to get area.master, as dynamic lightning can and will split areas.
return get_area(src)
/datum/alarm_handler/proc/register(var/object, var/procName)
listeners[object] = procName
+11
View File
@@ -305,3 +305,14 @@
'icons/spideros_icons/sos_13.png',
'icons/spideros_icons/sos_14.png'
)
mob/proc/MayRespawn()
return 0
client/proc/MayRespawn()
if(mob)
return mob.MayRespawn()
// Something went wrong, client is usually kicked or transfered to a new mob at this point
return 0
+5 -34
View File
@@ -264,37 +264,19 @@ BLIND // can't see anything
return
on = !on
user << "You [on ? "enable" : "disable"] the helmet light."
update_light(user)
update_flashlight(user)
else
return ..(user)
/obj/item/clothing/head/proc/update_light(var/mob/user = null)
/obj/item/clothing/head/proc/update_flashlight(var/mob/user = null)
if(on && !light_applied)
if(loc == user)
user.SetLuminosity(user.luminosity + brightness_on)
SetLuminosity(brightness_on)
set_light(brightness_on)
light_applied = 1
else if(!on && light_applied)
if(loc == user)
user.SetLuminosity(user.luminosity - brightness_on)
SetLuminosity(0)
set_light(0)
light_applied = 0
update_icon(user)
/obj/item/clothing/head/equipped(mob/user)
..()
spawn(1)
if(on && loc == user && !light_applied)
user.SetLuminosity(user.luminosity + brightness_on)
light_applied = 1
/obj/item/clothing/head/dropped(mob/user)
..()
spawn(1)
if(on && loc != user && light_applied)
user.SetLuminosity(user.luminosity - brightness_on)
light_applied = 0
/obj/item/clothing/head/update_icon(var/mob/user)
overlays.Cut()
@@ -308,18 +290,6 @@ BLIND // can't see anything
var/mob/living/carbon/human/H = user
H.update_inv_head()
/obj/item/clothing/head/equipped(mob/user)
..()
update_light(user)
/obj/item/clothing/head/pickup(mob/user)
..()
update_light(user)
/obj/item/clothing/head/dropped(mob/user)
..()
update_light(user)
/obj/item/clothing/head/update_clothing_icon()
if (ismob(src.loc))
var/mob/M = src.loc
@@ -357,6 +327,7 @@ BLIND // can't see anything
permeability_coefficient = 0.50
slowdown = SHOES_SLOWDOWN
force = 2
var/overshoes = 0
species_restricted = list("exclude","Unathi","Tajara")
sprite_sheets = list("Vox" = 'icons/mob/species/vox/shoes.dmi')
@@ -43,7 +43,7 @@
item_state = "lgloves"
siemens_coefficient = 1.0 //thin latex gloves, much more conductive than fabric gloves (basically a capacitor for AC)
permeability_coefficient = 0.01
germ_level = 0
/obj/item/clothing/gloves/botanic_leather
desc = "These leather work gloves protect against thorns, barbs, prickles, spikes and other harmful objects of floral origin."
name = "botanist's leather gloves"
+44 -3
View File
@@ -1,31 +1,72 @@
/obj/item/clothing/shoes/magboots
desc = "Magnetic boots, often used during extravehicular activity to ensure the user remains safely attached to the vehicle."
desc = "Magnetic boots, often used during extravehicular activity to ensure the user remains safely attached to the vehicle. They're large enough to be worn over other footwear."
name = "magboots"
icon_state = "magboots0"
species_restricted = null
force = 3
overshoes = 1
var/magpulse = 0
var/icon_base = "magboots"
icon_action_button = "action_blank"
action_button_name = "Toggle the magboots"
var/obj/item/clothing/shoes/shoes = null //Undershoes
var/mob/living/carbon/human/wearer = null //For shoe procs
/obj/item/clothing/shoes/magboots/proc/set_slowdown()
slowdown = shoes? max(SHOES_SLOWDOWN, shoes.slowdown): SHOES_SLOWDOWN //So you can't put on magboots to make you walk faster.
if (magpulse)
slowdown += 3
/obj/item/clothing/shoes/magboots/attack_self(mob/user)
if(magpulse)
flags &= ~NOSLIP
slowdown = SHOES_SLOWDOWN
magpulse = 0
set_slowdown()
force = 3
if(icon_base) icon_state = "[icon_base]0"
user << "You disable the mag-pulse traction system."
else
flags |= NOSLIP
slowdown = 2
magpulse = 1
set_slowdown()
force = 5
if(icon_base) icon_state = "[icon_base]1"
user << "You enable the mag-pulse traction system."
user.update_inv_shoes() //so our mob-overlays update
/obj/item/clothing/shoes/magboots/mob_can_equip(mob/user)
var/mob/living/carbon/human/H = user
if(H.shoes)
shoes = H.shoes
if(shoes.overshoes)
user << "You are unable to wear \the [src] as \the [H.shoes] are in the way."
shoes = null
return 0
H.drop_from_inventory(shoes) //Remove the old shoes so you can put on the magboots.
shoes.loc = src
if(!..())
if(shoes) //Put the old shoes back on if the check fails.
if(H.equip_to_slot_if_possible(shoes, slot_shoes))
src.shoes = null
return 0
if (shoes)
user << "You slip \the [src] on over \the [shoes]."
set_slowdown()
wearer = H
return 1
/obj/item/clothing/shoes/magboots/dropped()
..()
var/mob/living/carbon/human/H = wearer
if(shoes)
if(!H.equip_to_slot_if_possible(shoes, slot_shoes))
shoes.loc = get_turf(src)
src.shoes = null
wearer = null
/obj/item/clothing/shoes/magboots/examine(mob/user)
..(user)
var/state = "disabled"
@@ -96,10 +96,7 @@
helmet.canremove = 0
if(boots)
if(H.shoes)
M << "You are unable to deploy your suit's magboots as \the [H.shoes] are in the way."
else if (H.equip_to_slot_if_possible(boots, slot_shoes))
M << "Your suit's boots deploy with a hiss."
if (H.equip_to_slot_if_possible(boots, slot_shoes))
boots.canremove = 0
if(tank)
@@ -115,18 +112,18 @@
var/mob/living/carbon/human/H
if(helmet)
helmet.canremove = 1
H = helmet.loc
if(istype(H))
if(helmet && H.head == helmet)
helmet.canremove = 1
H.drop_from_inventory(helmet)
helmet.loc = src
if(boots)
boots.canremove = 1
H = boots.loc
if(istype(H))
if(boots && H.shoes == boots)
boots.canremove = 1
H.drop_from_inventory(boots)
boots.loc = src
+4 -5
View File
@@ -63,11 +63,10 @@
//world << " checking [areapath]"
var/area/A = locate(areapath)
//world << " A: [A], contents.len: [A.contents.len]"
for(var/area/B in A.related)
//world << " B: [B], contents.len: [B.contents.len]"
for(var/turf/simulated/floor/F in B.contents)
if(!F.contents.len)
turfs += F
for(var/turf/simulated/floor/F in A.contents)
if(!F.contents.len)
turfs += F
var/list/spawn_types = list()
var/max_number
@@ -116,4 +115,4 @@
#undef VERM_MICE
#undef VERM_LIZARDS
#undef VERM_SPIDERS
#undef VERM_SPIDERS
+1 -1
View File
@@ -400,7 +400,7 @@
/mob/living/simple_animal/hostile/carp/holodeck/New()
..()
SetLuminosity(2) //hologram lighting
set_light(2) //hologram lighting
/mob/living/simple_animal/hostile/carp/holodeck/proc/set_safety(var/safe)
if (safe)
-9
View File
@@ -341,9 +341,6 @@
..()
if(!seed)
return
if(seed.get_trait(TRAIT_BIOLUM))
user.SetLuminosity(user.luminosity + seed.get_trait(TRAIT_BIOLUM))
SetLuminosity(0)
if(seed.get_trait(TRAIT_STINGS))
var/mob/living/carbon/human/H = user
if(istype(H) && H.gloves)
@@ -354,12 +351,6 @@
seed.do_thorns(H,src)
seed.do_sting(H,src,pick("r_hand","l_hand"))
/obj/item/weapon/reagent_containers/food/snacks/grown/dropped(mob/user)
..()
if(seed && seed.get_trait(TRAIT_BIOLUM))
user.SetLuminosity(user.luminosity - seed.get_trait(TRAIT_BIOLUM))
SetLuminosity(seed.get_trait(TRAIT_BIOLUM))
// Predefined types for placing on the map.
/obj/item/weapon/reagent_containers/food/snacks/grown/mushroom/libertycap
+11 -10
View File
@@ -165,9 +165,10 @@
if(!istype(splat)) // Plants handle their own stuff.
splat.name = "[thrown.name] [pick("smear","smudge","splatter")]"
if(get_trait(TRAIT_BIOLUM))
var/clr
if(get_trait(TRAIT_BIOLUM_COLOUR))
splat.l_color = get_trait(TRAIT_BIOLUM_COLOUR)
splat.SetLuminosity(get_trait(TRAIT_BIOLUM))
clr = get_trait(TRAIT_BIOLUM_COLOUR)
splat.set_light(get_trait(TRAIT_BIOLUM), l_color = clr)
if(get_trait(TRAIT_PRODUCT_COLOUR))
splat.color = get_trait(TRAIT_PRODUCT_COLOUR)
@@ -276,12 +277,11 @@
// Handle light requirements.
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
var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in current_turf
if(L)
light_supplied = max(0,min(10,L.lum_r + L.lum_g + L.lum_b)-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
@@ -696,9 +696,10 @@
product.desc += " On second thought, something about this one looks strange."
if(get_trait(TRAIT_BIOLUM))
var/clr
if(get_trait(TRAIT_BIOLUM_COLOUR))
product.l_color = get_trait(TRAIT_BIOLUM_COLOUR)
product.SetLuminosity(get_trait(TRAIT_BIOLUM))
clr = get_trait(TRAIT_BIOLUM_COLOUR)
product.set_light(get_trait(TRAIT_BIOLUM), l_color = clr)
//Handle spawning in living, mobile products (like dionaea).
if(istype(product,/mob/living))
+2 -2
View File
@@ -13,7 +13,7 @@
spawn(75)
if(!host.ckey && !host.client)
host.death() // This seems redundant, but a lot of mobs don't
host.stat = 2 // handle death() properly. Better safe than etc.
host.stat = DEAD // handle death() properly. Better safe than etc.
host.visible_message("<span class='danger'>[host] is malformed and unable to survive. It expires pitifully, leaving behind some seeds.</span>")
var/total_yield = rand(1,3)
@@ -27,7 +27,7 @@
for(var/mob/dead/observer/O in player_list)
if(jobban_isbanned(O, "Dionaea"))
continue
if(O.client)
if(O.client && O.MayRespawn())
if(O.client.prefs.be_special & BE_PLANT && !(O.client in currently_querying))
currently_querying |= O.client
question(O.client,host)
+20 -13
View File
@@ -1,22 +1,28 @@
#define DEFAULT_SEED "glowshroom"
#define VINE_GROWTH_STAGES 5
/proc/spacevine_infestation()
/proc/spacevine_infestation(var/potency_min=70, var/potency_max=100, var/maturation_min=5, var/maturation_max=15)
spawn() //to stop the secrets panel hanging
var/list/turf/simulated/floor/turfs = list() //list of all the empty floor turfs in the hallway areas
for(var/areapath in typesof(/area/hallway))
var/area/A = locate(areapath)
for(var/area/B in A.related)
for(var/turf/simulated/floor/F in B.contents)
if(!F.contents.len)
turfs += F
for(var/turf/simulated/floor/F in A.contents)
if(!F.contents.len)
turfs += F
if(turfs.len) //Pick a turf to spawn at if we can
var/turf/simulated/floor/T = pick(turfs)
var/datum/seed/seed = plant_controller.create_random_seed(1)
seed.set_trait(TRAIT_SPREAD,2) // So it will function properly as vines.
seed.set_trait(TRAIT_POTENCY,rand(70,100)) // Guarantee a wide spread and powerful effects.
new /obj/effect/plant(T,seed)
seed.set_trait(TRAIT_POTENCY,rand(potency_min, potency_max)) // 70-100 potency will help guarantee a wide spread and powerful effects.
seed.set_trait(TRAIT_MATURATION,rand(maturation_min, maturation_max))
//make vine zero start off fully matured
var/obj/effect/plant/vine = new(T,seed)
vine.health = vine.max_health
vine.mature_time = 0
vine.process()
message_admins("<span class='notice'>Event: Spacevines spawned at [T.loc] ([T.x],[T.y],[T.z])</span>")
/obj/effect/dead_plant
@@ -57,6 +63,7 @@
var/spread_chance = 40
var/spread_distance = 3
var/evolve_chance = 2
var/mature_time //minimum maturation time
var/last_tick = 0
var/obj/machinery/portable_atmospherics/hydroponics/soil/invisible/plant
@@ -112,6 +119,7 @@
if(max_growth > 2 && prob(50))
max_growth-- //Ensure some variation in final sprite, makes the carpet of crap look less wonky.
mature_time = world.time + seed.get_trait(TRAIT_MATURATION) + 15 //prevent vines from maturing until at least a few seconds after they've been created.
spread_chance = seed.get_trait(TRAIT_POTENCY)
spread_distance = ((growth_type>0) ? round(spread_chance*0.6) : round(spread_chance*0.3))
update_icon()
@@ -146,14 +154,13 @@
color = icon_colour
// Apply colour and light from seed datum.
if(seed.get_trait(TRAIT_BIOLUM))
SetLuminosity(1+round(seed.get_trait(TRAIT_POTENCY)/20))
var/clr
if(seed.get_trait(TRAIT_BIOLUM_COLOUR))
l_color = seed.get_trait(TRAIT_BIOLUM_COLOUR)
else
l_color = null
clr = seed.get_trait(TRAIT_BIOLUM_COLOUR)
set_light(1+round(seed.get_trait(TRAIT_POTENCY)/20), l_color = clr)
return
else
SetLuminosity(0)
set_light(0)
/obj/effect/plant/proc/refresh_icon()
var/growth = min(max_growth,round(health/growth_threshold))
@@ -256,4 +263,4 @@
die_off()
/obj/effect/plant/proc/is_mature()
return (health >= (max_health/3))
return (health >= (max_health/3) && world.time > mature_time)
@@ -70,7 +70,10 @@
update_neighbors()
if(is_mature() && neighbors.len && prob(spread_chance))
for(var/i=1,i<=seed.get_trait(TRAIT_YIELD),i++)
//spread to 1-3 adjacent turfs depending on yield trait.
var/max_spread = between(1, round(seed.get_trait(TRAIT_YIELD)*3/14), 3)
for(var/i in 1 to max_spread)
if(prob(spread_chance))
sleep(rand(3,5))
if(!neighbors.len)
@@ -7,8 +7,11 @@
if(!istype(M))
return
if(!buckled_mob && !M.buckled && !M.anchored && (M.small || prob(round(seed.get_trait(TRAIT_POTENCY)/2))))
entangle(M)
if(!buckled_mob && !M.buckled && !M.anchored && (M.small || prob(round(seed.get_trait(TRAIT_POTENCY)/6))))
//wait a tick for the Entered() proc that called HasProximity() to finish (and thus the moving animation),
//so we don't appear to teleport from two tiles away when moving into a turf adjacent to vines.
spawn(1)
entangle(M)
/obj/effect/plant/attack_hand(mob/user as mob)
// Todo, cause damage.
@@ -60,13 +63,11 @@
if(buckled_mob)
return
if(!Adjacent(victim))
if(victim.buckled)
return
victim.buckled = src
victim.update_canmove()
buckled_mob = victim
if(!victim.anchored && !victim.buckled && victim.loc != get_turf(src))
//grabbing people
if(!victim.anchored && Adjacent(victim) && victim.loc != get_turf(src))
var/can_grab = 1
if(istype(victim, /mob/living/carbon/human))
var/mob/living/carbon/human/H = victim
@@ -75,4 +76,9 @@
if(can_grab)
src.visible_message("<span class='danger'>Tendrils lash out from \the [src] and drag \the [victim] in!</span>")
victim.loc = src.loc
victim << "<span class='danger'>Tendrils [pick("wind", "tangle", "tighten")] around you!</span>"
//entangling people
if(victim.loc == src.loc)
buckle_mob(victim)
victim.set_dir(pick(cardinal))
victim << "<span class='danger'>Tendrils [pick("wind", "tangle", "tighten")] around you!</span>"
+6 -7
View File
@@ -350,7 +350,7 @@
usr << "There is no label to remove."
return
/obj/machinery/portable_atmospherics/hydroponics/verb/set_light()
/obj/machinery/portable_atmospherics/hydroponics/verb/setlight()
set name = "Set Light"
set category = "Object"
set src in view(1)
@@ -596,13 +596,12 @@
if(closed_system && mechanical)
light_string = "that the internal lights are set to [tray_light] lumens"
else
var/area/A = T.loc
var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T
var/light_available
if(A)
if(A.lighting_use_dynamic)
light_available = max(0,min(10,T.lighting_lumcount)-5)
else
light_available = 5
if(L)
light_available = max(0,min(10,L.lum_r + L.lum_g + L.lum_b)-5)
else
light_available = 5
light_string = "a light level of [light_available] lumens"
usr << "The tray's sensor suite is reporting [light_string] and a temperature of [environment.temperature]K."
+1 -1
View File
@@ -16,7 +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
verbs -= /obj/machinery/portable_atmospherics/hydroponics/verb/setlight
/obj/machinery/portable_atmospherics/hydroponics/soil/CanPass()
return 1
@@ -73,12 +73,11 @@
// Update bioluminescence.
if(seed)
if(seed.get_trait(TRAIT_BIOLUM))
SetLuminosity(round(seed.get_trait(TRAIT_POTENCY)/10))
var/clr
if(seed.get_trait(TRAIT_BIOLUM_COLOUR))
l_color = seed.get_trait(TRAIT_BIOLUM_COLOUR)
else
l_color = null
clr = seed.get_trait(TRAIT_BIOLUM_COLOUR)
set_light(round(seed.get_trait(TRAIT_POTENCY)/10), l_color = clr)
return
SetLuminosity(0)
return
set_light(0)
return
+67
View File
@@ -0,0 +1,67 @@
/*
BS12 object based lighting system
*/
/*
Changes from tg DAL:
- Lighting is done using objects instead of subareas.
- Animated transitions. (newer tg DAL has this)
- Full colours with mixing.
- Support for lights on shuttles.
- Code:
- Instead of one flat luminosity var, light is represented by 3 atom vars:
- light_range; range in tiles of the light, used for calculating falloff,
- light_power; multiplier for the brightness of lights,
- light_color; hex string representing the RGB colour of the light.
- SetLuminosity() is now set_light() and takes the three variables above.
- Variables can be left as null to not update them.
- SetOpacity() is now set_opacity().
- Areas have luminosity set to 1 permanently, no hard-lighting.
- Objects inside other objects can have lights and they properly affect the turf. (flashlights)
- area/master and area/list/related have been eviscerated since subareas aren't needed.
*/
/*
Relevant vars/procs:
atom: (lighting_atom.dm)
- var/light_range; range in tiles of the light, used for calculating falloff
- var/light_power; multiplier for the brightness of lights
- var/light_color; hex string representing the RGB colour of the light
- var/datum/light_source/light; light source datum for this atom, only present if light_range && light_power
- var/list/light_sources; light sources in contents that are shining through this object, including this object
- proc/set_light(l_range, l_power, l_color):
- Sets light_range/power/color to non-null args and calls update_light()
- proc/set_opacity(new_opacity):
- Sets opacity to new_opacity.
- If opacity has changed, call turf.reconsider_lights() to fix light occlusion
- proc/update_light():
- Updates the light var on this atom, deleting or creating as needed and calling .update()
turf: (lighting_turf.dm)
- var/list/affecting_lights; list of light sources that are shining onto this turf
- proc/reconsider_lights():
- Force all light sources shining onto this turf to update
- proc/lighting_clear_overlays():
- Delete (manual GC) all light overlays on this turf, used when changing turf to space
- proc/lighting_build_overlays():
- Create lighting overlays for this turf
atom/movable/lighting_overlay: (lighting_overlay.dm)
- var/lum_r, var/lum_g, var/lum_b; lumcounts of each colour
- var/needs_update; set on update_lumcount, checked by lighting process
- var/xoffset, var/yoffset; (only present when using sub-tile overlays) fractional offset of this overlay in the tile
- proc/update_lumcount(delta_r, delta_g, delta_b):
- Change the lumcount vars and queue the overlay for update
- proc/update_overlay()
- Called by the lighting process to update the color of the overlay
*/
+10
View File
@@ -0,0 +1,10 @@
#define LIGHTING_INTERVAL 5 // frequency, in 1/10ths of a second, of the lighting process
#define LIGHTING_FALLOFF 1 // type of falloff to use for lighting; 1 for circular, 2 for square
#define LIGHTING_LAMBERTIAN 1 // use lambertian shading for light sources
#define LIGHTING_HEIGHT 1 // height off the ground of light sources on the pseudo-z-axis, you should probably leave this alone
#define LIGHTING_TRANSITIONS 1 // smooth, animated transitions, similar to /tg/station
#define LIGHTING_RESOLUTION 1 // resolution of the lighting overlays, powers of 2 only, max of 32
#define LIGHTING_LAYER 10 // drawing layer for lighting overlays
#define LIGHTING_ICON 'icons/effects/lighting_overlay.dmi' // icon used for lighting shading effects
+169
View File
@@ -0,0 +1,169 @@
/datum/light_source
var/atom/top_atom
var/atom/source_atom
var/turf/source_turf
var/light_power
var/light_range
var/light_color // string, decomposed by parse_light_color()
var/lum_r
var/lum_g
var/lum_b
var/list/effect_r
var/list/effect_g
var/list/effect_b
var/list/effect_turf
var/applied
var/needs_update
var/destroyed
var/force_update
/datum/light_source/New(atom/owner, atom/top)
source_atom = owner
if(!source_atom.light_sources) source_atom.light_sources = list()
source_atom.light_sources += src
top_atom = top
if(top_atom != source_atom)
if(!top.light_sources) top.light_sources = list()
top_atom.light_sources += src
source_turf = top_atom
light_power = source_atom.light_power
light_range = source_atom.light_range
light_color = source_atom.light_color
parse_light_color()
effect_r = list()
effect_g = list()
effect_b = list()
effect_turf = list()
update()
return ..()
/datum/light_source/proc/destroy()
destroyed = 1
force_update()
if(source_atom) source_atom.light_sources -= src
if(top_atom) top_atom.light_sources -= src
/datum/light_source/proc/update(atom/new_top_atom)
if(new_top_atom && new_top_atom != top_atom)
if(top_atom != source_atom) top_atom.light_sources -= src
top_atom = new_top_atom
if(top_atom != source_atom)
if(!top_atom.light_sources) top_atom.light_sources = list()
top_atom.light_sources += src
lighting_update_lights += src
needs_update = 1
/datum/light_source/proc/force_update()
needs_update = 1
force_update = 1
lighting_update_lights += src
/datum/light_source/proc/check()
if(!source_atom)
destroy()
return 1
if(!top_atom)
top_atom = source_atom
. = 1
if(istype(top_atom, /turf))
if(source_turf != top_atom)
source_turf = top_atom
. = 1
else if(top_atom.loc != source_turf)
source_turf = top_atom.loc
. = 1
if(source_atom.light_power != light_power)
light_power = source_atom.light_power
. = 1
if(source_atom.light_range != light_range)
light_range = source_atom.light_range
. = 1
if(source_atom.light_color != light_color)
light_color = source_atom.light_color
parse_light_color()
. = 1
if(light_range && light_power && !applied)
. = 1
/datum/light_source/proc/parse_light_color()
if(light_color)
lum_r = GetRedPart(light_color) / 255
lum_g = GetGreenPart(light_color) / 255
lum_b = GetBluePart(light_color) / 255
else
lum_r = 1
lum_g = 1
lum_b = 1
/datum/light_source/proc/falloff(atom/movable/lighting_overlay/O)
#if LIGHTING_FALLOFF == 1 // circular
#if LIGHTING_RESOLUTION == 1
. = (O.x - source_turf.x)**2 + (O.y - source_turf.y)**2 + LIGHTING_HEIGHT
#else
. = (O.x - source_turf.x + O.xoffset)**2 + (O.y - source_turf.y + O.yoffset)**2 + LIGHTING_HEIGHT
#endif
#if LIGHTING_LAMBERTIAN == 1
. = CLAMP01((1 - CLAMP01(sqrt(.) / light_range)) * (1 / (sqrt(. + 1))))
#else
. = 1 - CLAMP01(sqrt(.) / light_range)
#endif
#elif LIGHTING_FALLOFF == 2 // square
#if LIGHTING_RESOLUTION == 1
. = abs(O.x - source_turf.x) + abs(O.y - source_turf.y) + LIGHTING_HEIGHT
#else
. = abs(O.x - source_turf.x + O.xoffset) + abs(O.y - source_turf.y + O.yoffset) + LIGHTING_HEIGHT
#endif
#if LIGHTING_LAMBERTIAN == 1
. = CLAMP01((1 - CLAMP01(. / light_range)) * (1 / (sqrt(.)**2 + )))
#else
. = 1 - CLAMP01(. / light_range)
#endif
#endif
/datum/light_source/proc/apply_lum()
applied = 1
if(istype(source_turf))
for(var/atom/movable/lighting_overlay/O in view(light_range, source_turf))
var/strength = light_power * falloff(O)
effect_r[O] = lum_r * strength
effect_g[O] = lum_g * strength
effect_b[O] = lum_b * strength
O.update_lumcount(lum_r * strength, lum_g * strength, lum_b * strength)
for(var/turf/T in view(light_range, source_turf))
if(!T.affecting_lights) T.affecting_lights = list()
T.affecting_lights += src
effect_turf += T
/datum/light_source/proc/remove_lum()
applied = 0
for(var/atom/movable/lighting_overlay/O in effect_r)
O.update_lumcount(-effect_r[O], -effect_g[O], -effect_b[O])
for(var/turf/T in effect_turf)
if(T.affecting_lights) T.affecting_lights -= src
effect_r.Cut()
effect_g.Cut()
effect_b.Cut()
effect_turf.Cut()
+81
View File
@@ -0,0 +1,81 @@
/atom
var/light_power = 1 // intensity of the light
var/light_range = 0 // range in tiles of the light
var/light_color // RGB string representing the colour of the light
var/datum/light_source/light
var/list/light_sources
/atom/proc/set_light(l_range, l_power, l_color)
if(l_power != null) light_power = l_power
if(l_range != null) light_range = l_range
if(l_color != null) light_color = l_color
update_light()
/atom/proc/update_light()
if(!light_power || !light_range)
if(light)
light.destroy()
light = null
else
if(!istype(loc, /atom/movable))
. = src
else
. = loc
if(light)
light.update(.)
else
light = new /datum/light_source(src, .)
/atom/New()
. = ..()
if(light_power && light_range)
update_light()
/atom/Destroy()
if(light)
light.destroy()
light = null
return ..()
/atom/movable/Destroy()
var/turf/T = loc
if(opacity && istype(T))
T.reconsider_lights()
return ..()
/atom/movable/Move()
var/turf/old_loc = loc
. = ..()
if(loc != old_loc)
for(var/datum/light_source/L in light_sources)
L.source_atom.update_light()
var/turf/new_loc = loc
if(istype(old_loc) && opacity)
old_loc.reconsider_lights()
if(istype(new_loc) && opacity)
new_loc.reconsider_lights()
/atom/proc/set_opacity(new_opacity)
var/old_opacity = opacity
opacity = new_opacity
var/turf/T = loc
if(old_opacity != new_opacity && istype(T))
T.reconsider_lights()
/obj/item/equipped()
. = ..()
update_light()
/obj/item/pickup()
. = ..()
update_light()
/obj/item/dropped()
. = ..()
update_light()
+48
View File
@@ -0,0 +1,48 @@
/atom/movable/lighting_overlay
name = ""
mouse_opacity = 0
simulated = 0
anchored = 1
icon = LIGHTING_ICON
layer = LIGHTING_LAYER
invisibility = INVISIBILITY_LIGHTING
blend_mode = BLEND_MULTIPLY
color = "#000000"
var/lum_r
var/lum_g
var/lum_b
#if LIGHTING_RESOLUTION != 1
var/xoffset
var/yoffset
#endif
var/needs_update
/atom/movable/lighting_overlay/New()
. = ..()
verbs.Cut()
/atom/movable/lighting_overlay/proc/update_lumcount(delta_r, delta_g, delta_b)
lum_r += delta_r
lum_g += delta_g
lum_b += delta_b
needs_update = 1
lighting_update_overlays += src
/atom/movable/lighting_overlay/proc/update_overlay()
var/mx = max(lum_r, lum_g, lum_b)
. = 1 // factor
if(mx > 1)
. = 1/mx
#if LIGHTING_TRANSITIONS == 1
animate(src,
color = rgb(lum_r * 255 * ., lum_g * 255 * ., lum_b * 255 * .),
LIGHTING_INTERVAL - 1
)
#else
color = rgb(lum_r * 255 * ., lum_g * 255 * ., lum_b * 255 * .)
#endif
+29
View File
@@ -0,0 +1,29 @@
/datum/controller/process/lighting/setup()
name = "lighting"
schedule_interval = LIGHTING_INTERVAL
create_lighting_overlays()
/datum/controller/process/lighting/doWork()
for(var/datum/light_source/L in lighting_update_lights)
if(L.needs_update)
if(L.destroyed)
L.remove_lum()
else if(L.check() || L.force_update)
L.remove_lum()
L.apply_lum()
L.force_update = 0
L.needs_update = 0
scheck()
lighting_update_lights.Cut()
for(var/atom/movable/lighting_overlay/O in lighting_update_overlays)
if(O.needs_update)
O.update_overlay()
O.needs_update = 0
scheck()
lighting_update_overlays.Cut()
+47
View File
@@ -0,0 +1,47 @@
/var/list/lighting_update_lights = list()
/var/list/lighting_update_overlays = list()
/area/var/lighting_use_dynamic = 1
// duplicates lots of code, but this proc needs to be as fast as possible.
/proc/create_lighting_overlays(zlevel = 0)
var/state = "light[LIGHTING_RESOLUTION]"
var/area/A
if(zlevel == 0) // populate all zlevels
for(var/turf/T in world)
if(T.dynamic_lighting)
A = T.loc
if(A.lighting_use_dynamic)
#if LIGHTING_RESOLUTION == 1
var/atom/movable/lighting_overlay/O = new(T)
O.icon_state = state
#else
for(var/i = 0; i < LIGHTING_RESOLUTION; i++)
for(var/j = 0; j < LIGHTING_RESOLUTION; j++)
var/atom/movable/lighting_overlay/O = new(T)
O.pixel_x = i * (32 / LIGHTING_RESOLUTION)
O.pixel_y = j * (32 / LIGHTING_RESOLUTION)
O.xoffset = (((2*i + 1) / (LIGHTING_RESOLUTION * 2)) - 0.5)
O.yoffset = (((2*j + 1) / (LIGHTING_RESOLUTION * 2)) - 0.5)
O.icon_state = state
#endif
else
for(var/x = 1; x <= world.maxx; x++)
for(var/y = 1; y <= world.maxy; y++)
var/turf/T = locate(x, y, zlevel)
if(T.dynamic_lighting)
A = T.loc
if(A.lighting_use_dynamic)
#if LIGHTING_RESOLUTION == 1
var/atom/movable/lighting_overlay/O = new(T)
O.icon_state = state
#else
for(var/i = 0; i < LIGHTING_RESOLUTION; i++)
for(var/j = 0; j < LIGHTING_RESOLUTION; j++)
var/atom/movable/lighting_overlay/O = new(T)
O.pixel_x = i * (32 / LIGHTING_RESOLUTION)
O.pixel_y = j * (32 / LIGHTING_RESOLUTION)
O.xoffset = (((2*i + 1) / (LIGHTING_RESOLUTION * 2)) - 0.5)
O.yoffset = (((2*j + 1) / (LIGHTING_RESOLUTION * 2)) - 0.5)
O.icon_state = state
#endif
+29
View File
@@ -0,0 +1,29 @@
/turf
var/list/affecting_lights
/turf/proc/reconsider_lights()
for(var/datum/light_source/L in affecting_lights)
L.force_update()
/turf/proc/lighting_clear_overlays()
for(var/atom/movable/lighting_overlay/L in src)
L.loc = null
/turf/proc/lighting_build_overlays()
if(!locate(/atom/movable/lighting_overlay) in src)
var/state = "light[LIGHTING_RESOLUTION]"
var/area/A = loc
if(A.lighting_use_dynamic)
#if LIGHTING_RESOLUTION == 1
var/atom/movable/lighting_overlay/O = new(src)
O.icon_state = state
#else
for(var/i = 0; i < LIGHTING_RESOLUTION; i++)
for(var/j = 0; j < LIGHTING_RESOLUTION; j++)
var/atom/movable/lighting_overlay/O = new(src)
O.pixel_x = i * (32 / LIGHTING_RESOLUTION)
O.pixel_y = j * (32 / LIGHTING_RESOLUTION)
O.xoffset = (((2*i + 1) / (LIGHTING_RESOLUTION * 2)) - 0.5)
O.yoffset = (((2*j + 1) / (LIGHTING_RESOLUTION * 2)) - 0.5)
O.icon_state = state
#endif
+10
View File
@@ -0,0 +1,10 @@
#undef LIGHTING_INTERVAL
#undef LIGHTING_FALLOFF
#undef LIGHTING_LAMBERTIAN
#undef LIGHTING_HEIGHT
#undef LIGHTING_TRANSITIONS
#undef LIGHTING_RESOLUTION
#undef LIGHTING_LAYER
#undef LIGHTING_ICON
+2 -2
View File
@@ -105,7 +105,7 @@
icon_state = "furnace"
density = 1
anchored = 1
luminosity = 3
light_range = 3
var/obj/machinery/mineral/input = null
var/obj/machinery/mineral/output = null
var/obj/machinery/mineral/console = null
@@ -238,4 +238,4 @@
else
continue
console.updateUsrDialog()
console.updateUsrDialog()
+8 -3
View File
@@ -436,9 +436,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
src << "<span class='warning'>Spawning as a mouse is currently disabled.</span>"
return
var/mob/dead/observer/M = usr
if(config.antag_hud_restricted && M.has_enabled_antagHUD == 1)
src << "<span class='warning'>antagHUD restrictions prevent you from spawning in as a mouse.</span>"
if(!MayRespawn(1))
return
var/timedifference = world.time - client.time_died_as_mouse
@@ -677,3 +675,10 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
client.images |= ghost_darkness_images
if (ghostimage)
client.images -= ghostimage //remove ourself
mob/dead/observer/MayRespawn(var/feedback = 0)
if(config.antag_hud_restricted && has_enabled_antagHUD == 1)
if(feedback)
src << "<span class='warning'>antagHUD restrictions prevent you from respawning.</span>"
return 0
return 1
@@ -28,7 +28,7 @@
if(src.can_use())
cameranet.addCamera(src)
else
src.SetLuminosity(0)
src.set_light(0)
cameranet.removeCamera(src)
/obj/machinery/camera/New()
+1 -1
View File
@@ -155,7 +155,7 @@ var/list/slot_equipment_priority = list( \
Target = loc
remove_from_mob(W)
if(!W) return 1 // self destroying objects (tk, grabs)
if(!(W && W.loc)) return 1 // self destroying objects (tk, grabs)
W.forceMove(Target)
update_icons()
+3 -3
View File
@@ -110,14 +110,14 @@
if(stat)
return 0
on = 1
SetLuminosity(light_strength)
set_light(light_strength)
update_icons()
return 1
/mob/living/bot/proc/turn_off()
on = 0
SetLuminosity(0)
set_light(0)
update_icons()
/mob/living/bot/proc/explode()
qdel(src)
qdel(src)
+1 -1
View File
@@ -226,7 +226,7 @@
beacon_freq = freq
if("screw")
screwloose = !screwloose
usr << "<span class='notice>You twiddle the screw.</span>"
usr << "<span class='notice'>You twiddle the screw.</span>"
if("oddbutton")
oddbutton = !oddbutton
usr << "<span class='notice'>You press the weird button.</span>"
@@ -31,4 +31,4 @@
/mob/living/carbon/alien/diona/put_in_hands(var/obj/item/W) // No hands.
W.loc = get_turf(src)
return 1
return 1
@@ -4,10 +4,12 @@
var/light_amount = 0 //how much light there is in the place, affects receiving nutrition and healing
if(isturf(loc)) //else, there's considered to be no light
var/turf/T = loc
var/area/A = T.loc
if(A)
if(A.lighting_use_dynamic) light_amount = min(10,T.lighting_lumcount) - 5 //hardcapped so it's not abused by having a ton of flashlights
else light_amount = 5
var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T
if(L)
light_amount = min(10,L.lum_r + L.lum_g + L.lum_b) - 5 //hardcapped so it's not abused by having a ton of flashlights
else
light_amount = 5
nutrition += light_amount
@@ -26,7 +26,7 @@
/obj/item/device/mmi/digital/posibrain/proc/request_player()
for(var/mob/dead/observer/O in player_list)
if(O.has_enabled_antagHUD == 1 && config.antag_hud_restricted)
if(!O.MayRespawn())
continue
if(jobban_isbanned(O, "AI") && jobban_isbanned(O, "Cyborg"))
continue
@@ -281,7 +281,7 @@ emp_act
forcesay(hit_appends) //forcesay checks stat already
//Melee weapon embedded object code.
if (I && I.damtype == BRUTE && !I.anchored && !I.is_robot_module())
if (I && I.damtype == BRUTE && !I.anchored && !is_robot_module(I))
var/damage = effective_force
if (armor)
damage /= armor+1
@@ -355,7 +355,7 @@ emp_act
//thrown weapon embedded object code.
if(dtype == BRUTE && istype(O,/obj/item))
var/obj/item/I = O
if (!I.is_robot_module())
if (!is_robot_module(I))
var/sharp = is_sharp(I)
var/damage = throw_damage
if (armor)
+13 -10
View File
@@ -877,10 +877,11 @@
var/light_amount = 0 //how much light there is in the place, affects receiving nutrition and healing
if(isturf(loc)) //else, there's considered to be no light
var/turf/T = loc
var/area/A = T.loc
if(A)
if(A.lighting_use_dynamic) light_amount = min(10,T.lighting_lumcount) - 5 //hardcapped so it's not abused by having a ton of flashlights
else light_amount = 5
var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T
if(L)
light_amount = min(10,L.lum_r + L.lum_g + L.lum_b) - 5 //hardcapped so it's not abused by having a ton of flashlights
else
light_amount = 5
nutrition += light_amount
traumatic_shock -= light_amount
@@ -898,10 +899,11 @@
var/light_amount = 0
if(isturf(loc))
var/turf/T = loc
var/area/A = T.loc
if(A)
if(A.lighting_use_dynamic) light_amount = T.lighting_lumcount
else light_amount = 10
var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T
if(L)
light_amount = L.lum_r + L.lum_g + L.lum_b //hardcapped so it's not abused by having a ton of flashlights
else
light_amount = 10
if(light_amount > species.light_dam) //if there's enough light, start dying
take_overall_damage(1,1)
else //heal in the dark
@@ -1418,8 +1420,9 @@
//0.1% chance of playing a scary sound to someone who's in complete darkness
if(isturf(loc) && rand(1,1000) == 1)
var/turf/currentTurf = loc
if(!currentTurf.lighting_lumcount)
var/turf/T = loc
var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T
if(L && L.lum_r + L.lum_g + L.lum_b == 0)
playsound_local(src,pick(scarySounds),50, 1, -1)
proc/handle_stomach()
+7 -7
View File
@@ -139,7 +139,7 @@
var/obj/item/I = O
mass = I.w_class/THROWNOBJ_KNOCKBACK_DIVISOR
var/momentum = speed*mass
if(O.throw_source && momentum >= THROWNOBJ_KNOCKBACK_SPEED)
var/dir = get_dir(O.throw_source, src)
@@ -200,14 +200,14 @@
/mob/living/proc/IgniteMob()
if(fire_stacks > 0 && !on_fire)
on_fire = 1
src.AddLuminosity(3)
set_light(light_range + 3)
update_fire()
/mob/living/proc/ExtinguishMob()
if(on_fire)
on_fire = 0
fire_stacks = 0
src.AddLuminosity(-3)
set_light(max(0, light_range - 3))
update_fire()
/mob/living/proc/update_fire()
@@ -219,18 +219,18 @@
/mob/living/proc/handle_fire()
if(fire_stacks < 0)
fire_stacks = max(0, fire_stacks++) //If we've doused ourselves in water to avoid fire, dry off slowly
if(!on_fire)
return 1
else if(fire_stacks <= 0)
ExtinguishMob() //Fire's been put out.
return 1
var/datum/gas_mixture/G = loc.return_air() // Check if we're standing in an oxygenless environment
if(G.gas["oxygen"] < 1)
ExtinguishMob() //If there's no oxygen in the tile we're on, put out the fire
return 1
var/turf/location = get_turf(src)
location.hotspot_expose(fire_burn_temperature(), 50, 1)
@@ -242,6 +242,6 @@
/mob/living/proc/fire_burn_temperature()
if (fire_stacks <= 0)
return 0
//Scale quadratically so that single digit numbers of fire stacks don't burn ridiculously hot.
return round(FIRESUIT_MAX_HEAT_PROTECTION_TEMPERATURE*(fire_stacks/FIRE_MAX_FIRESUIT_STACKS)**2)
+8 -8
View File
@@ -468,13 +468,13 @@ var/list/ai_verbs_default = list(
/mob/living/silicon/ai/reset_view(atom/A)
if(camera)
camera.SetLuminosity(0)
camera.set_light(0)
if(istype(A,/obj/machinery/camera))
camera = A
..()
if(istype(A,/obj/machinery/camera))
if(camera_light_on) A.SetLuminosity(AI_CAMERA_LUMINOSITY)
else A.SetLuminosity(0)
if(camera_light_on) A.set_light(AI_CAMERA_LUMINOSITY)
else A.set_light(0)
/mob/living/silicon/ai/proc/switchCamera(var/obj/machinery/camera/C)
@@ -612,7 +612,7 @@ var/list/ai_verbs_default = list(
src << "Camera lights [camera_light_on ? "activated" : "deactivated"]."
if(!camera_light_on)
if(camera)
camera.SetLuminosity(0)
camera.set_light(0)
camera = null
else
lightNearbyCamera()
@@ -627,20 +627,20 @@ var/list/ai_verbs_default = list(
if(src.camera)
var/obj/machinery/camera/camera = near_range_camera(src.eyeobj)
if(camera && src.camera != camera)
src.camera.SetLuminosity(0)
src.camera.set_light(0)
if(!camera.light_disabled)
src.camera = camera
src.camera.SetLuminosity(AI_CAMERA_LUMINOSITY)
src.camera.set_light(AI_CAMERA_LUMINOSITY)
else
src.camera = null
else if(isnull(camera))
src.camera.SetLuminosity(0)
src.camera.set_light(0)
src.camera = null
else
var/obj/machinery/camera/camera = near_range_camera(src.eyeobj)
if(camera && !camera.light_disabled)
src.camera = camera
src.camera.SetLuminosity(AI_CAMERA_LUMINOSITY)
src.camera.set_light(AI_CAMERA_LUMINOSITY)
camera_light_on = world.timeofday + 1 * 20 // Update the light every 2 seconds.
+9 -10
View File
@@ -48,7 +48,7 @@
loc = T.loc
if (istype(loc, /area))
//stage = 4
if (!loc.master.power_equip && !istype(src.loc,/obj/item))
if (!loc.power_equip && !istype(src.loc,/obj/item))
//stage = 5
blind = 1
@@ -115,7 +115,7 @@
spawn(20)
src << "Backup battery online. Scanners, camera, and radio interface offline. Beginning fault-detection."
sleep(50)
if (loc.master.power_equip)
if (loc.power_equip)
if (!istype(T, /turf/space))
src << "Alert cancelled. Power has been restored without our assistance."
src:aiRestorePowerRoutine = 0
@@ -135,18 +135,17 @@
var/PRP
for (PRP=1, PRP<=4, PRP++)
for(var/area/A in current_area.master.related)
for (var/obj/machinery/power/apc/APC in A)
if (!(APC.stat & BROKEN))
theAPC = APC
break
for (var/obj/machinery/power/apc/APC in current_area)
if (!(APC.stat & BROKEN))
theAPC = APC
break
if (!theAPC)
switch(PRP)
if (1) src << "Unable to locate APC!"
else src << "Lost connection with the APC!"
src:aiRestorePowerRoutine = 2
return
if (loc.master.power_equip)
if (loc.power_equip)
if (!istype(T, /turf/space))
src << "Alert cancelled. Power has been restored without our assistance."
src:aiRestorePowerRoutine = 0
@@ -181,7 +180,7 @@
/mob/living/silicon/ai/proc/lacks_power()
var/turf/T = get_turf(src)
var/area/A = get_area(src)
return ((!A.master.power_equip) && A.requires_power == 1 || istype(T, /turf/space)) && !istype(src.loc,/obj/item)
return ((!A.power_equip) && A.requires_power == 1 || istype(T, /turf/space)) && !istype(src.loc,/obj/item)
/mob/living/silicon/ai/updatehealth()
if(status_flags & GODMODE)
@@ -195,4 +194,4 @@
/mob/living/silicon/ai/rejuvenate()
..()
add_ai_verbs(src)
add_ai_verbs(src)
@@ -234,7 +234,7 @@ var/datum/paiController/paiController // Global handler for pAI candidates
if(c.ready)
var/found = 0
for(var/mob/dead/observer/o in player_list)
if(o.key == c.key)
if(o.key == c.key && o.MayRespawn())
found = 1
if(found)
available.Add(c)
@@ -347,7 +347,7 @@ var/datum/paiController/paiController // Global handler for pAI candidates
/datum/paiController/proc/requestRecruits(var/mob/user)
inquirer = user
for(var/mob/dead/observer/O in player_list)
if(O.has_enabled_antagHUD == 1 && config.antag_hud_restricted)
if(!O.MayRespawn())
continue
if(jobban_isbanned(O, "pAI"))
continue
@@ -188,8 +188,8 @@
//Standard robots use config for crit, which is somewhat excessive for these guys.
//Drones killed by damage will gib.
/mob/living/silicon/robot/drone/handle_regular_status_updates()
if((health <= -35 || (master_fabricator && src.z != master_fabricator.z)) && src.stat != 2)
var/turf/T = get_turf(src)
if((!T || health <= -35 || (master_fabricator && T.z != master_fabricator.z)) && src.stat != DEAD)
timeofdeath = world.time
death() //Possibly redundant, having trouble making death() cooperate.
gib()
@@ -287,6 +287,7 @@
src.verbs -= silicon_subsystems
/mob/living/silicon/robot/drone/construction
icon_state = "constructiondrone"
law_type = /datum/ai_laws/construction_drone
module_type = /obj/item/weapon/robot_module/drone/construction
can_pull_size = 5
@@ -108,6 +108,9 @@
if(jobban_isbanned(src,"Cyborg"))
usr << "<span class='danger'>You are banned from playing synthetics and cannot spawn as a drone.</span>"
return
if(!MayRespawn(1))
return
var/deathtime = world.time - src.timeofdeath
if(istype(src,/mob/dead/observer))
@@ -145,4 +148,4 @@
var/choice = input(src,"Which fabricator do you wish to use?") as null|anything in all_fabricators
if(choice)
var/obj/machinery/drone_fabricator/chosen_fabricator = all_fabricators[choice]
chosen_fabricator.create_drone(src.client)
chosen_fabricator.create_drone(src.client)
@@ -58,7 +58,7 @@
src.has_power = 0
if(lights_on) // Light is on but there is no power!
lights_on = 0
SetLuminosity(0)
set_light(0)
/mob/living/silicon/robot/proc/handle_regular_status_updates()
@@ -367,9 +367,9 @@
lights_on = !lights_on
usr << "You [lights_on ? "enable" : "disable"] your integrated light."
if(lights_on)
SetLuminosity(integrated_light_power) // 1.5x luminosity of flashlight
set_light(integrated_light_power) // 1.5x luminosity of flashlight
else
SetLuminosity(0)
set_light(0)
/mob/living/silicon/robot/verb/self_diagnosis_verb()
set category = "Robot Commands"
@@ -726,10 +726,3 @@ var/global/list/robot_modules = list(
LR.Charge(R, amount)
..()
return
//checks whether this item is a module of the robot it is located in.
/obj/item/proc/is_robot_module()
if (!istype(src.loc, /mob/living/silicon/robot))
return 0
var/mob/living/silicon/robot/R = src.loc
return (src in R.module.modules)
@@ -240,7 +240,7 @@
////////////////Glow//////////////////
/mob/living/simple_animal/construct/proc/add_glow()
overlays = 0
var/overlay_layer = LIGHTING_LAYER+1
var/overlay_layer = 11
if(layer != MOB_LAYER)
overlay_layer=TURF_LAYER+0.2
@@ -94,7 +94,7 @@
emote_hear = list("clicks")
emote_see = list("clacks")
desc = "Free crabs!"
src.sd_SetLuminosity(0)
src.sd_set_light(0)
inventory_head.loc = src.loc
inventory_head = null
else
@@ -277,9 +277,9 @@
qdel(MED)
for(var/mob/M in viewers(src, null))
if ((M.client && !( M.blinded )))
M.show_message("<span class='notice>[user] applies the [MED] on [src].</span>")
M.show_message("<span class='notice'>[user] applies the [MED] on [src].</span>")
else
user << "<span class='notice>\The [src] is dead, medical items won't bring it back to life.</span>"
user << "<span class='notice'>\The [src] is dead, medical items won't bring it back to life.</span>"
if(meat_type && (stat == DEAD)) //if the animal has a meat, and if it is dead.
if(istype(O, /obj/item/weapon/kitchenknife) || istype(O, /obj/item/weapon/butch))
harvest(user)
@@ -300,7 +300,7 @@
usr << "<span class='danger>This weapon is ineffective, it does no damage.</span>"
for(var/mob/M in viewers(src, null))
if ((M.client && !( M.blinded )))
M.show_message("<span class='notice>[user] gently taps [src] with the [O].</span>")
M.show_message("<span class='notice'>[user] gently taps [src] with \the [O].</span>")
/mob/living/simple_animal/movement_delay()
var/tally = 0 //Incase I need to add stuff other than "speed" later
+6 -6
View File
@@ -24,7 +24,7 @@
assailant = user
affecting = victim
if(affecting.anchored)
if(affecting.anchored || !assailant.Adjacent(victim))
qdel(src)
return
@@ -36,7 +36,6 @@
hud.master = src
/obj/item/weapon/grab/Destroy()
//make sure the grabbed_by list doesn't fill up with nulls
if(affecting)
affecting.grabbed_by -= src
affecting = null
@@ -45,6 +44,7 @@
assailant.client.screen -= hud
assailant = null
qdel(hud)
hud = null
..()
//Used by throw code to hand over the mob, instead of throwing the grab. The grab is then deleted by the throw code.
@@ -68,6 +68,9 @@
/obj/item/weapon/grab/process()
confirm()
if(!assailant)
qdel(src)
return
if(assailant.client)
assailant.client.screen -= hud
@@ -227,8 +230,5 @@
/obj/item/weapon/grab/dropped()
loc = null
qdel(src)
/obj/item/weapon/grab/Destroy()
qdel(hud)
..()
@@ -527,3 +527,6 @@
/mob/new_player/hear_radio(var/message, var/verb="says", var/datum/language/language=null, var/part_a, var/part_b, var/mob/speaker = null, var/hard_to_hear = 0)
return
mob/new_player/MayRespawn()
return 1
+1 -1
View File
@@ -147,7 +147,7 @@
R << "<span class='danger'>Law Notice</span>"
R.laws.show_laws(R)
if(usr != owner)
usr << "<span class='notice>Laws displayed.</span>"
usr << "<span class='notice'>Laws displayed.</span>"
return 1
return 0
+4 -5
View File
@@ -1253,11 +1253,10 @@ obj/machinery/power/apc/proc/autoset(var/val, var/on)
if( cell && cell.charge>=20)
cell.use(20);
spawn(0)
for(var/area/A in area.related)
for(var/obj/machinery/light/L in A)
L.on = 1
L.broken()
sleep(1)
for(var/obj/machinery/light/L in area)
L.on = 1
L.broken()
sleep(1)
/obj/machinery/power/apc/proc/setsubsystem(val)
if(cell && cell.charge > 0)
+4 -4
View File
@@ -50,8 +50,8 @@
for(var/area/A in range(src,effectiverange))
if(A.name == "Space")
continue // No (de)gravitizing space.
if(A.master && !( A.master in localareas) )
localareas += A.master
if(!(A in localareas))
localareas += A
/obj/machinery/computer/gravity_control_computer/proc/findgenerator()
var/obj/machinery/gravity_generator/foundgenerator = null
@@ -125,7 +125,7 @@
for(var/area/A in gravity_generator:localareas)
var/obj/machinery/gravity_generator/G
for(G in machines)
if((A.master in G.localareas) && (G.on))
if((A in G.localareas) && (G.on))
break
if(!G)
A.gravitychange(0,A)
@@ -137,4 +137,4 @@
A.gravitychange(1,A)
src.updateUsrDialog()
return
return
+47 -27
View File
@@ -142,7 +142,9 @@
power_channel = LIGHT //Lights are calc'd via area so they dont need to be in the machine list
var/on = 0 // 1 if on, 0 if off
var/on_gs = 0
var/brightness = 8 // luminosity when on, also used in power calculation
var/brightness_range = 8 // luminosity when on, also used in power calculation
var/brightness_power = 3
var/brightness_color = null
var/status = LIGHT_OK // LIGHT_OK, _EMPTY, _BURNED or _BROKEN
var/flickering = 0
var/light_type = /obj/item/weapon/light/tube // the type of light item
@@ -158,7 +160,9 @@
icon_state = "bulb1"
base_state = "bulb"
fitting = "bulb"
brightness = 4
brightness_range = 4
brightness_power = 2
brightness_color = "#a0a080"
desc = "A small lighting fixture."
light_type = /obj/item/weapon/light/bulb
@@ -167,7 +171,8 @@
name = "spotlight"
fitting = "large tube"
light_type = /obj/item/weapon/light/tube/large
brightness = 12
brightness_range = 12
brightness_power = 4
/obj/machinery/light/built/New()
status = LIGHT_EMPTY
@@ -184,13 +189,20 @@
..()
spawn(2)
var/area/A = get_area(src)
if(A && !A.requires_power)
on = 1
switch(fitting)
if("tube")
brightness = 8
brightness_range = 8
brightness_power = 3
if(prob(2))
broken(1)
if("bulb")
brightness = 4
brightness_range = 4
brightness_power = 2
brightness_color = "#a0a080"
if(prob(5))
broken(1)
spawn(1)
@@ -224,7 +236,7 @@
update_icon()
if(on)
if(luminosity != brightness)
if(light_range != brightness_range || light_power != brightness_power || light_color != brightness_color)
switchcount++
if(rigged)
if(status == LIGHT_OK && trigger)
@@ -238,15 +250,15 @@
status = LIGHT_BURNED
icon_state = "[base_state]-burned"
on = 0
SetLuminosity(0)
set_light(0)
else
use_power = 2
SetLuminosity(brightness)
set_light(brightness_range, brightness_power, brightness_color)
else
use_power = 1
SetLuminosity(0)
set_light(0)
active_power_usage = (luminosity * 10)
active_power_usage = ((light_range + light_power) * 10)
if(on != on_gs)
on_gs = on
@@ -307,8 +319,9 @@
user << "You insert the [L.name]."
switchcount = L.switchcount
rigged = L.rigged
brightness = L.brightness
l_color = L.color
brightness_range = L.brightness_range
brightness_power = L.brightness_power
brightness_color = L.brightness_color
on = has_power()
update()
@@ -384,7 +397,7 @@
// true if area has power and lightswitch is on
/obj/machinery/light/proc/has_power()
var/area/A = src.loc.loc
return A.master.lightswitch && A.master.power_light
return A.lightswitch && A.power_light
/obj/machinery/light/proc/flicker(var/amount = rand(10, 20))
if(flickering) return
@@ -454,8 +467,9 @@
var/obj/item/weapon/light/L = new light_type()
L.status = status
L.rigged = rigged
L.brightness = src.brightness
L.color = l_color
L.brightness_range = brightness_range
L.brightness_power = brightness_power
L.brightness_color = brightness_color
// light item inherits the switchcount, then zero it
L.switchcount = switchcount
@@ -480,8 +494,9 @@
var/obj/item/weapon/light/L = new light_type()
L.status = status
L.rigged = rigged
L.brightness = brightness
L.color = l_color
L.brightness_range = brightness_range
L.brightness_power = brightness_power
L.brightness_color = brightness_color
// light item inherits the switchcount, then zero it
L.switchcount = switchcount
@@ -514,7 +529,6 @@
if(status == LIGHT_OK)
return
status = LIGHT_OK
brightness = initial(brightness)
on = 1
update()
@@ -549,14 +563,13 @@
/obj/machinery/light/process()
if(on)
use_power(luminosity * LIGHTING_POWER_FACTOR, LIGHT)
use_power(light_range * LIGHTING_POWER_FACTOR, LIGHT)
// called when area power state changes
/obj/machinery/light/power_change()
spawn(10)
var/area/A = src.loc.loc
A = A.master
seton(A.lightswitch && A.power_light)
// called when on fire
@@ -590,7 +603,9 @@
var/switchcount = 0 // number of times switched
matter = list("steel" = 60)
var/rigged = 0 // true if rigged to explode
var/brightness = 2 //how much light it gives off
var/brightness_range = 2 //how much light it gives off
var/brightness_power = 1
var/brightness_color = null
/obj/item/weapon/light/tube
name = "light tube"
@@ -599,12 +614,14 @@
base_state = "ltube"
item_state = "c_tube"
matter = list("glass" = 100)
brightness = 8
brightness_range = 8
brightness_power = 3
/obj/item/weapon/light/tube/large
w_class = 2
name = "large light tube"
brightness = 15
brightness_range = 15
brightness_power = 4
/obj/item/weapon/light/bulb
name = "light bulb"
@@ -613,7 +630,9 @@
base_state = "lbulb"
item_state = "contvapour"
matter = list("glass" = 100)
brightness = 5
brightness_range = 5
brightness_power = 2
brightness_color = "#a0a080"
/obj/item/weapon/light/throw_impact(atom/hit_atom)
..()
@@ -626,7 +645,8 @@
base_state = "fbulb"
item_state = "egg4"
matter = list("glass" = 100)
brightness = 5
brightness_range = 5
brightness_power = 2
// update the icon state and description of the light
@@ -647,9 +667,9 @@
..()
switch(name)
if("light tube")
brightness = rand(6,9)
brightness_range = rand(6,9)
if("light bulb")
brightness = rand(4,6)
brightness_range = rand(4,6)
update()
+4 -4
View File
@@ -69,20 +69,20 @@
// return 1
var/area/A = src.loc.loc // make sure it's in an area
if(!A || !isarea(A) || !A.master)
if(!A || !isarea(A))
return 0 // if not, then not powered
if(chan == -1)
chan = power_channel
return A.master.powered(chan) // return power status of the area
return A.powered(chan) // return power status of the area
// increment the power usage stats for an area
/obj/machinery/proc/use_power(var/amount, var/chan = -1) // defaults to power_channel
var/area/A = get_area(src) // make sure it's in an area
if(!A || !isarea(A) || !A.master)
if(!A || !isarea(A))
return
if(chan == -1)
chan = power_channel
A.master.use_power(amount, chan)
A.use_power(amount, chan)
/obj/machinery/proc/power_change() // called whenever the power settings of the containing area change
// by default, check equipment channel & set flag
+3 -4
View File
@@ -150,7 +150,6 @@
return null
/area/proc/get_apc()
for(var/area/RA in src.related)
var/obj/machinery/power/apc/FINDME = locate() in RA
if (FINDME)
return FINDME
var/obj/machinery/power/apc/FINDME = locate() in src
if (FINDME)
return FINDME
@@ -8,6 +8,7 @@
desc = "Computer designed to remotely monitor power levels around the station"
icon = 'icons/obj/computer.dmi'
icon_state = "power"
light_color = "#ffcc33"
//computer stuff
density = 1
+10 -8
View File
@@ -38,17 +38,19 @@
..()
/obj/singularity_act()
ex_act(1)
if(src)
qdel(src)
return 2
if(simulated)
ex_act(1)
if(src)
qdel(src)
return 2
/obj/singularity_pull(S, current_size)
if(anchored)
if(current_size >= STAGE_FIVE)
if(simulated)
if(anchored)
if(current_size >= STAGE_FIVE)
step_towards(src, S)
else
step_towards(src, S)
else
step_towards(src, S)
/obj/effect/beam/singularity_pull()
return
@@ -9,7 +9,7 @@
density = 0
unacidable = 1
use_power = 0
luminosity = 4
light_range = 4
var/obj/machinery/field_generator/FG1 = null
var/obj/machinery/field_generator/FG2 = null
var/hasShocked = 0 //Used to add a delay between shocks. In some cases this used to crash servers by spawning hundreds of sparks every second.
+4 -4
View File
@@ -31,8 +31,8 @@ var/global/list/narsie_list = list()
// Pixel stuff centers Narsie.
pixel_x = -236
pixel_y = -256
luminosity = 1
l_color = "#3e0000"
light_range = 1
light_color = "#3e0000"
current_size = 12
consume_range = 12 // How many tiles out do we eat.
@@ -144,7 +144,7 @@ var/global/list/narsie_list = list()
if(T.icon_state != "cult-narsie")
T.desc = "something that goes beyond your understanding went this way"
T.icon_state = "cult-narsie"
T.luminosity = 1
T.set_light(1)
/obj/singularity/narsie/proc/narsiewall(var/turf/T)
T.desc = "An opening has been made on that wall, but who can say if what you seek truly lies on the other side?"
@@ -152,7 +152,7 @@ var/global/list/narsie_list = list()
T.icon_state = "cult-narsie"
T.opacity = 0
T.density = 0
luminosity = 1
set_light(1)
/obj/singularity/narsie/large/consume(const/atom/A) //Has its own consume proc because it doesn't need energy and I don't want BoHs to explode it. --NEO
//NEW BEHAVIOUR
@@ -8,7 +8,7 @@
anchored = 1
density = 1
layer = 6
luminosity = 6
light_range = 6
unacidable = 1 //Don't comment this out.
var/current_size = 1
@@ -161,7 +161,7 @@
var/hide_item = !has_edge(W) || !can_slice_here
if (hide_item)
if (W.w_class >= src.w_class || W.is_robot_module())
if (W.w_class >= src.w_class || is_robot_module(W))
return
user << "\red You slip [W] inside [src]."
+1
View File
@@ -30,6 +30,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
/obj/machinery/computer/rdconsole
name = "R&D control console"
icon_state = "rdcomp"
light_color = "#a97faa"
circuit = /obj/item/weapon/circuitboard/rdconsole
var/datum/research/files //Stores all the collected research data.
var/obj/item/weapon/disk/tech_disk/t_disk = null //Stores the technology disk.
+2 -1
View File
@@ -196,6 +196,7 @@
/obj/machinery/computer/rdservercontrol
name = "R&D Server Controller"
icon_state = "rdcomp"
light_color = "#a97faa"
circuit = /obj/item/weapon/circuitboard/rdservercontrol
var/screen = 0
var/obj/machinery/r_n_d/server/temp_server
@@ -355,4 +356,4 @@
name = "Core R&D Server"
id_with_upload_string = "1"
id_with_download_string = "1"
server_id = 1
server_id = 1
+1 -1
View File
@@ -228,7 +228,7 @@
anchored = 1
density = 1
unacidable = 1
luminosity = 3
light_range = 3
var/needs_power = 0
var/active = 1
// var/power = 10
@@ -130,8 +130,8 @@
name = "Juggerwall"
icon = 'icons/effects/effects.dmi'
icon_state = "m_shield_cult"
l_color = "#B40000"
luminosity = 2
light_color = "#B40000"
light_range = 2
/obj/effect/forcefield/cult/cultify()
return
+5 -7
View File
@@ -37,7 +37,7 @@
icon_state = "darkmatter"
density = 1
anchored = 0
luminosity = 4
light_range = 4
var/gasefficency = 0.25
@@ -54,7 +54,7 @@
var/emergency_alert = "CRYSTAL DELAMINATION IMMINENT."
var/explosion_point = 1000
l_color = "#8A8A00"
light_color = "#8A8A00"
var/warning_color = "#B8B800"
var/emergency_color = "#D9D900"
@@ -117,10 +117,8 @@
//Changes color and luminosity of the light to these values if they were not already set
/obj/machinery/power/supermatter/proc/shift_light(var/lum, var/clr)
if(l_color != clr)
l_color = clr
if(luminosity != lum)
SetLuminosity(lum)
if(lum != light_range || clr != light_color)
set_light(lum, l_color = clr)
/obj/machinery/power/supermatter/proc/announce_warning()
var/integrity = damage / explosion_point
@@ -174,7 +172,7 @@
if(!istype(L, /turf/space) && (world.timeofday - lastwarning) >= WARNING_DELAY * 10)
announce_warning()
else
shift_light(4,initial(l_color))
shift_light(4,initial(light_color))
if(grav_pulling)
supermatter_pull()
+4 -4
View File
@@ -11,7 +11,7 @@
density = 1
anchored = 1
animate_movement=1
luminosity = 3
light_range = 3
can_buckle = 1
buckle_movable = 1
@@ -181,13 +181,13 @@
if(powered && cell.charge < charge_use)
return 0
on = 1
luminosity = initial(luminosity)
set_light(initial(light_range))
update_icon()
return 1
/obj/vehicle/proc/turn_off()
on = 0
luminosity = 0
set_light(0)
update_icon()
/obj/vehicle/proc/Emag(mob/user as mob)
@@ -367,4 +367,4 @@
if(prob(10))
new /obj/effect/decal/cleanable/blood/oil(src.loc)
spawn(1) healthcheck()
return 1
return 1