Merge pull request #10343 from GunHog/Borgie_Lights

[Review] Cyborg headlamps!
This commit is contained in:
Swag McYolosteinen
2015-07-19 19:26:09 +02:00
12 changed files with 99 additions and 18 deletions
@@ -27,6 +27,7 @@
update_canmove()
if(camera)
camera.status = 0
update_headlamp(1) //So borg lights are disabled when killed.
uneq_all() // particularly to ensure sight modes are cleared
@@ -15,11 +15,6 @@
if(istype(O,/obj/item/borg/sight))
var/obj/item/borg/sight/S = O
sight_mode &= ~S.sight_mode
else if(istype(O, /obj/item/device/flashlight))
var/obj/item/device/flashlight/F = O
if(F.on)
F.on = 0
F.update_brightness(src)
else if(istype(O, /obj/item/weapon/storage/bag/tray/))
var/obj/item/weapon/storage/bag/tray/T = O
T.do_quick_empty()
@@ -25,10 +25,12 @@
if(cell && cell.charge)
if(cell.charge <= 100)
uneq_all()
cell.use(1)
var/amt = Clamp((lamp_intensity - 2) * 2,1,cell.charge) //Always try to use at least one charge per tick, but allow it to completely drain the cell.
cell.use(amt) //Usage table: 1/tick if off/lowest setting, 4 = 4/tick, 6 = 8/tick, 8 = 12/tick, 10 = 16/tick
else
uneq_all()
stat = UNCONSCIOUS
update_headlamp(1)
/mob/living/silicon/robot/handle_regular_status_updates()
@@ -59,6 +61,7 @@
if (paralysis || stunned || weakened) //Stunned etc.
stat = UNCONSCIOUS
update_headlamp()
return 1
+40 -4
View File
@@ -15,6 +15,7 @@
var/obj/screen/inv1 = null
var/obj/screen/inv2 = null
var/obj/screen/inv3 = null
var/obj/screen/lamp_button = null
var/shown_robot_modules = 0 //Used to determine whether they have the module menu shown or not
var/obj/screen/robot_modules_background
@@ -60,6 +61,8 @@
var/tonermax = 40
var/jetpackoverlay = 0
var/braintype = "Cyborg"
var/lamp_max = 10 //Maximum brightness of a borg lamp. Set as a var for easy adjusting.
var/lamp_intensity = 0 //Luminosity of the headlamp. 0 is off. Higher settings than the minimum require power.
/mob/living/silicon/robot/New(loc)
spark_system = new /datum/effect/effect/system/spark_spread()
@@ -221,6 +224,7 @@
transform_animation(animation_length)
notify_ai(2)
update_icons()
update_headlamp()
SetEmagged(emagged) // Update emag status and give/take emag modules.
/mob/living/silicon/robot/proc/transform_animation(animation_length)
@@ -720,12 +724,17 @@
/mob/living/silicon/robot/update_icons()
overlays.Cut()
if(stat == CONSCIOUS)
if(stat != DEAD && !(paralysis || stunned || weakened)) //Not dead, not stunned.
var/state_name = icon_state //For easy conversion and/or different names
switch(icon_state)
if("robot")
overlays += "eyes-standard"
state_name = "standard"
if("mediborg")
overlays += "eyes-mediborg"
if("toiletbot")
overlays += "eyes-toiletbot"
overlays += "eyes-mediborg"
state_name = "mediborg"
if("secborg")
overlays += "eyes-secborg"
if("engiborg")
@@ -738,6 +747,9 @@
overlays += "eyes-syndie_bloodhound"
else
overlays += "eyes"
state_name = "serviceborg"
if(lamp_intensity > 2)
overlays += "eyes-[state_name]-lights"
if(opened)
if(wiresexposed)
@@ -751,8 +763,6 @@
overlays += "minerjetpack"
update_fire()
/mob/living/silicon/robot/proc/installed_modules()
if(!module)
pick_module()
@@ -978,6 +988,32 @@
set category = "Robot Commands"
set_autosay()
/mob/living/silicon/robot/proc/control_headlamp()
if(stat)
src << "<span class='danger'>This function is currently offline.</span>"
return
//Some sort of magical "modulo" thing which somehow increments lamp power by 2, until it hits the max and resets to 0.
lamp_intensity = (lamp_intensity+2) % (lamp_max+2)
src << "[lamp_intensity ? "Headlamp power set to Level [lamp_intensity/2]" : "Headlamp disabled."]"
update_headlamp()
/mob/living/silicon/robot/proc/update_headlamp(var/turn_off = 0)
SetLuminosity(0)
if(lamp_intensity && (turn_off || stat))
src << "<span class='danger'>Your headlamp has been deactivated.</span>"
lamp_intensity = 0
else
AddLuminosity(lamp_intensity)
if(lamp_button)
lamp_button.icon_state = "lamp[lamp_intensity]"
update_icons()
/mob/living/silicon/robot/proc/deconstruct()
var/turf/T = get_turf(src)
if (robot_suit)
@@ -66,7 +66,6 @@
/obj/item/weapon/robot_module/standard/New()
..()
modules += new /obj/item/device/flashlight(src)
modules += new /obj/item/weapon/melee/baton/loaded(src)
modules += new /obj/item/weapon/extinguisher(src)
modules += new /obj/item/weapon/wrench(src)
@@ -81,7 +80,6 @@
/obj/item/weapon/robot_module/medical/New()
..()
modules += new /obj/item/device/flashlight(src)
modules += new /obj/item/device/healthanalyzer(src)
modules += new /obj/item/weapon/reagent_containers/borghypo(src)
modules += new /obj/item/weapon/reagent_containers/glass/beaker/large(src)
@@ -119,7 +117,6 @@
/obj/item/weapon/robot_module/engineering/New()
..()
modules += new /obj/item/device/flashlight(src)
modules += new /obj/item/borg/sight/meson(src)
emag = new /obj/item/borg/stun(src)
modules += new /obj/item/weapon/rcd/borg(src)
@@ -173,7 +170,6 @@
/obj/item/weapon/robot_module/security/New()
..()
modules += new /obj/item/device/flashlight/seclite(src)
modules += new /obj/item/weapon/restraints/handcuffs/cable/zipties/cyborg(src)
modules += new /obj/item/weapon/melee/baton/loaded(src)
modules += new /obj/item/weapon/gun/energy/disabler/cyborg(src)
@@ -187,7 +183,6 @@
/obj/item/weapon/robot_module/janitor/New()
..()
modules += new /obj/item/device/flashlight(src)
modules += new /obj/item/weapon/soap/nanotrasen(src)
modules += new /obj/item/weapon/storage/bag/trash/cyborg(src)
modules += new /obj/item/weapon/mop/cyborg(src)
@@ -205,7 +200,6 @@
/obj/item/weapon/robot_module/butler/New()
..()
modules += new /obj/item/device/flashlight(src)
modules += new /obj/item/weapon/reagent_containers/food/drinks/drinkingglass(src)
modules += new /obj/item/weapon/reagent_containers/food/condiment/enzyme(src)
modules += new /obj/item/weapon/pen(src)
@@ -239,7 +233,6 @@
modules += new /obj/item/weapon/storage/bag/ore/cyborg(src)
modules += new /obj/item/weapon/pickaxe/drill/cyborg(src)
modules += new /obj/item/weapon/shovel(src)
modules += new /obj/item/device/flashlight/lantern(src)
modules += new /obj/item/weapon/storage/bag/sheetsnatcher/borg(src)
modules += new /obj/item/device/t_scanner/adv_mining_scanner(src)
modules += new /obj/item/weapon/gun/energy/kinetic_accelerator(src)
@@ -251,7 +244,6 @@
/obj/item/weapon/robot_module/syndicate/New()
..()
modules += new /obj/item/device/flashlight(src)
modules += new /obj/item/weapon/melee/energy/sword/cyborg(src)
modules += new /obj/item/weapon/gun/energy/printer(src)
modules += new /obj/item/weapon/gun/projectile/revolver/grenadelauncher/cyborg(src)