Converts Eye Augments to Cybernetic Eyes (#15519)

* Converts Eye Augments to Cybernetic Eyes

* literally not used

* it helps when you properly include all the code

* flashlight eyes

* tweaks

* conflict resolution

* can't have two eyes

* order of operations matters here

* autosurgeon
This commit is contained in:
Fox McCloud
2021-03-03 20:21:30 +00:00
committed by GitHub
parent dcace52184
commit 75935ff876
47 changed files with 339 additions and 382 deletions
+1 -82
View File
@@ -6,77 +6,12 @@
slot = "eye_sight"
parent_organ = "eyes"
w_class = WEIGHT_CLASS_TINY
var/vision_flags = 0
var/see_in_dark = 0
var/see_invisible = 0
var/lighting_alpha
var/eye_colour = "#000000" // Should never be null
var/old_eye_colour = "#000000"
var/flash_protect = 0
var/aug_message = "Your vision is augmented!"
/obj/item/organ/internal/cyberimp/eyes/insert(var/mob/living/carbon/M, var/special = 0)
/obj/item/organ/internal/cyberimp/eyes/insert(mob/living/carbon/M, special = FALSE)
..()
var/mob/living/carbon/human/H = M
if(istype(H) && eye_colour)
H.update_body() //Apply our eye colour to the target.
if(aug_message && !special)
to_chat(owner, "<span class='notice'>[aug_message]</span>")
M.update_sight()
/obj/item/organ/internal/cyberimp/eyes/remove(var/mob/living/carbon/M, var/special = 0)
. = ..()
M.update_sight()
/obj/item/organ/internal/cyberimp/eyes/proc/generate_icon(var/mob/living/carbon/human/HA)
var/mob/living/carbon/human/H = HA
if(!istype(H))
H = owner
var/icon/cybereyes_icon = new /icon('icons/mob/human_face.dmi', H.dna.species.eyes)
cybereyes_icon.Blend(eye_colour, ICON_ADD) // Eye implants override native DNA eye color
return cybereyes_icon
/obj/item/organ/internal/cyberimp/eyes/emp_act(severity)
if(!owner || emp_proof)
return
if(severity > 1)
if(prob(10 * severity))
return
to_chat(owner, "<span class='warning'>Static obfuscates your vision!</span>")
owner.flash_eyes(visual = 1)
/obj/item/organ/internal/cyberimp/eyes/meson
name = "Meson scanner implant"
desc = "These cybernetic eyes will allow you to see the structural layout of the station, and, well, everything else."
eye_colour = "#199900"
implant_color = "#AEFF00"
origin_tech = "materials=4;engineering=4;biotech=4;magnets=4"
vision_flags = SEE_TURFS
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE
aug_message = "Suddenly, you realize how much of a mess the station really is..."
/obj/item/organ/internal/cyberimp/eyes/xray
name = "X-ray implant"
desc = "These cybernetic eye implants will give you X-ray vision. Blinking is futile."
implant_color = "#000000"
origin_tech = "materials=4;programming=4;biotech=7;magnets=4"
vision_flags = SEE_MOBS | SEE_OBJS | SEE_TURFS
see_in_dark = 8
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE
/obj/item/organ/internal/cyberimp/eyes/thermals
name = "Thermals implant"
desc = "These cybernetic eye implants will give you Thermal vision. Vertical slit pupil included."
eye_colour = "#FFCC00"
implant_color = "#FFCC00"
vision_flags = SEE_MOBS
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE
flash_protect = -1
origin_tech = "materials=5;programming=4;biotech=4;magnets=4;syndicate=1"
aug_message = "You see prey everywhere you look..."
// HUD implants
/obj/item/organ/internal/cyberimp/eyes/hud
@@ -104,7 +39,6 @@
/obj/item/organ/internal/cyberimp/eyes/hud/medical
name = "Medical HUD implant"
desc = "These cybernetic eye implants will display a medical HUD over everything you see."
eye_colour = "#0000D0"
implant_color = "#00FFFF"
origin_tech = "materials=4;programming=4;biotech=4"
aug_message = "You suddenly see health bars floating above people's heads..."
@@ -114,7 +48,6 @@
/obj/item/organ/internal/cyberimp/eyes/hud/diagnostic
name = "Diagnostic HUD implant"
desc = "These cybernetic eye implants will display a diagnostic HUD over everything you see."
eye_colour = "#723E02"
implant_color = "#ff9000"
origin_tech = "materials=4;engineering=4;biotech=4"
aug_message = "You see the diagnostic information of the synthetics around you..."
@@ -123,22 +56,8 @@
/obj/item/organ/internal/cyberimp/eyes/hud/security
name = "Security HUD implant"
desc = "These cybernetic eye implants will display a security HUD over everything you see."
eye_colour = "#D00000"
implant_color = "#CC0000"
origin_tech = "materials=4;programming=4;biotech=3;combat=3"
aug_message = "Job indicator icons pop up in your vision. That is not a certified surgeon..."
HUD_type = DATA_HUD_SECURITY_ADVANCED
examine_extensions = list(EXAMINE_HUD_SECURITY_READ, EXAMINE_HUD_SECURITY_WRITE)
// Welding shield implant
/obj/item/organ/internal/cyberimp/eyes/shield
name = "welding shield implant"
desc = "These reactive micro-shields will protect you from welders and flashes without obscuring your vision."
slot = "eye_shield"
origin_tech = "materials=4;biotech=3;engineering=4;plasmatech=3"
implant_color = "#101010"
flash_protect = 2
// Welding with thermals will still hurt your eyes a bit.
/obj/item/organ/internal/cyberimp/eyes/shield/emp_act(severity)
return
@@ -9,9 +9,9 @@
/obj/item/organ/internal/cyberimp/New(var/mob/M = null)
. = ..()
if(implant_overlay)
var/image/overlay = new /image(icon, implant_overlay)
var/mutable_appearance/overlay = mutable_appearance(icon, implant_overlay)
overlay.color = implant_color
overlays |= overlay
add_overlay(overlay)
/obj/item/organ/internal/cyberimp/emp_act()
return // These shouldn't be hurt by EMPs in the standard way
@@ -405,26 +405,18 @@
//BOX O' IMPLANTS
/obj/item/storage/box/cyber_implants
name = "boxed cybernetic implant"
name = "boxed cybernetic implants"
desc = "A sleek, sturdy box."
icon_state = "cyber_implants"
/obj/item/storage/box/cyber_implants/New(loc, implant)
..()
new /obj/item/autoimplanter(src)
if(ispath(implant))
new implant(src)
/obj/item/storage/box/cyber_implants/bundle
name = "boxed cybernetic implants"
var/list/boxed = list(/obj/item/organ/internal/cyberimp/eyes/xray,/obj/item/organ/internal/cyberimp/eyes/thermals,
/obj/item/organ/internal/cyberimp/brain/anti_stun, /obj/item/organ/internal/cyberimp/chest/reviver/hardened)
var/list/boxed = list(
/obj/item/autosurgeon/organ/syndicate/thermal_eyes,
/obj/item/autosurgeon/organ/syndicate/xray_eyes,
/obj/item/autosurgeon/organ/syndicate/anti_stun,
/obj/item/autosurgeon/organ/syndicate/reviver)
var/amount = 5
/obj/item/storage/box/cyber_implants/bundle/New()
..()
/obj/item/storage/box/cyber_implants/populate_contents()
var/implant
while(amount > 0)
while(length(contents) <= amount)
implant = pick(boxed)
new implant(src)
amount--
@@ -1,37 +0,0 @@
/obj/item/autoimplanter
name = "autoimplanter"
desc = "A device that automatically injects a cyber-implant into the user without the hassle of extensive surgery. It has a slot to insert implants and a screwdriver slot for removing accidentally added implants."
icon = 'icons/obj/device.dmi'
icon_state = "autoimplanter"
item_state = "walkietalkie"//left as this so as to intentionally not have inhands
w_class = WEIGHT_CLASS_SMALL
usesound = 'sound/weapons/circsawhit.ogg'
var/obj/item/organ/internal/cyberimp/storedorgan
/obj/item/autoimplanter/attack_self(mob/user)//when the object it used...
if(!storedorgan)
to_chat(user, "<span class='notice'>[src] currently has no implant stored.</span>")
return
storedorgan.insert(user)//insert stored organ into the user
user.visible_message("<span class='notice'>[user] presses a button on [src], and you hear a short mechanical noise.</span>", "<span class='notice'>You feel a sharp sting as [src] plunges into your body.</span>")
playsound(get_turf(user), usesound, 50, 1)
storedorgan = null
/obj/item/autoimplanter/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/organ/internal/cyberimp))
if(storedorgan)
to_chat(user, "<span class='notice'>[src] already has an implant stored.</span>")
return
if(!user.drop_item())
return
I.forceMove(src)
storedorgan = I
to_chat(user, "<span class='notice'>You insert the [I] into [src].</span>")
else if(istype(I, /obj/item/screwdriver))
if(!storedorgan)
to_chat(user, "<span class='notice'>There's no implant in [src] for you to remove.</span>")
else
storedorgan.forceMove(get_turf(user))
storedorgan = null
to_chat(user, "<span class='notice'>You remove the [storedorgan] from [src].</span>")
playsound(get_turf(user), I.usesound, 50, 1)
+103
View File
@@ -0,0 +1,103 @@
#define INFINITE -1
/obj/item/autosurgeon
name = "autosurgeon"
desc = "A device that automatically inserts an implant or organ into the user without the hassle of extensive surgery. It has a screwdriver slot for removing accidentally added items."
icon = 'icons/obj/device.dmi'
icon_state = "autoimplanter"
item_state = ""
w_class = WEIGHT_CLASS_SMALL
var/uses = INFINITE
/obj/item/autosurgeon/attack_self_tk(mob/user)
return //stops TK fuckery
/obj/item/autosurgeon/organ
name = "implant autosurgeon"
desc = "A device that automatically inserts an implant or organ into the user without the hassle of extensive surgery. It has a slot to insert implants or organs and a screwdriver slot for removing accidentally added items."
var/organ_type = /obj/item/organ/internal
var/starting_organ
var/obj/item/organ/internal/storedorgan
/obj/item/autosurgeon/organ/syndicate
name = "suspicious implant autosurgeon"
icon_state = "syndicate_autoimplanter"
/obj/item/autosurgeon/organ/Initialize(mapload)
. = ..()
if(starting_organ)
insert_organ(new starting_organ(src))
/obj/item/autosurgeon/organ/proc/insert_organ(obj/item/I)
storedorgan = I
I.forceMove(src)
name = "[initial(name)] ([storedorgan.name])"
/obj/item/autosurgeon/organ/attack_self(mob/user) //when the object it used...
if(!uses)
to_chat(user, "<span class='alert'>[src] has already been used. The tools are dull and won't reactivate.</span>")
return
else if(!storedorgan)
to_chat(user, "<span class='alert'>[src] currently has no implant stored.</span>")
return
storedorgan.insert(user) //insert stored organ into the user
user.visible_message("<span class='notice'>[user] presses a button on [src], and you hear a short mechanical noise.</span>", "<span class='notice'>You feel a sharp sting as [src] plunges into your body.</span>")
playsound(get_turf(user), 'sound/weapons/circsawhit.ogg', 50, TRUE)
storedorgan = null
name = initial(name)
if(uses != INFINITE)
uses--
if(!uses)
desc = "[initial(desc)] Looks like it's been used up."
/obj/item/autosurgeon/organ/attackby(obj/item/I, mob/user, params)
if(istype(I, organ_type))
if(storedorgan)
to_chat(user, "<span class='alert'>[src] already has an implant stored.</span>")
return
else if(!uses)
to_chat(user, "<span class='alert'>[src] has already been used up.</span>")
return
if(!user.drop_item())
return
I.forceMove(src)
storedorgan = I
to_chat(user, "<span class='notice'>You insert [I] into [src].</span>")
else
return ..()
/obj/item/autosurgeon/organ/screwdriver_act(mob/living/user, obj/item/I)
if(..())
return TRUE
if(!storedorgan)
to_chat(user, "<span class='warning'>There's no implant in [src] for you to remove!</span>")
else
storedorgan.forceMove(user.drop_location())
to_chat(user, "<span class='notice'>You remove [storedorgan] from [src].</span>")
I.play_tool_sound(src)
storedorgan = null
if(uses != INFINITE)
uses--
if(!uses)
desc = "[initial(desc)] Looks like it's been used up."
return TRUE
/obj/item/autosurgeon/organ/syndicate/laser_arm
desc = "A single use autosurgeon that contains a combat arms-up laser augment. A screwdriver can be used to remove it, but implants can't be placed back in."
uses = 1
starting_organ = /obj/item/organ/internal/cyberimp/arm/gun/laser
/obj/item/autosurgeon/organ/syndicate/thermal_eyes
starting_organ = /obj/item/organ/internal/eyes/cybernetic/thermals
/obj/item/autosurgeon/organ/syndicate/xray_eyes
starting_organ = /obj/item/organ/internal/eyes/cybernetic/xray
/obj/item/autosurgeon/organ/syndicate/anti_stun
starting_organ = /obj/item/organ/internal/cyberimp/brain/anti_stun/hardened
/obj/item/autosurgeon/organ/syndicate/reviver
starting_organ = /obj/item/organ/internal/cyberimp/chest/reviver/hardened
#undef INFINITE
+114 -5
View File
@@ -5,17 +5,19 @@
organ_tag = "eyes"
parent_organ = "head"
slot = "eyes"
var/eye_colour = "#000000" // Should never be null
var/eye_color = "#000000" // Should never be null
var/list/colourmatrix = null
var/list/colourblind_matrix = MATRIX_GREYSCALE //Special colourblindness parameters. By default, it's black-and-white.
var/list/replace_colours = GREYSCALE_COLOR_REPLACE
var/dependent_disabilities = list() //Gets set by eye-dependent disabilities such as colourblindness so the eyes can transfer the disability during transplantation.
var/weld_proof = null //If set, the eyes will not take damage during welding. eg. IPC optical sensors do not take damage when they weld things while all other eyes will.
var/weld_proof = FALSE //If set, the eyes will not take damage during welding. eg. IPC optical sensors do not take damage when they weld things while all other eyes will.
var/vision_flags = 0
var/see_in_dark = 2
var/tint = 0
var/flash_protect = FLASH_PROTECTION_NONE
var/see_invisible = SEE_INVISIBLE_LIVING
var/lighting_alpha = LIGHTING_PLANE_ALPHA_VISIBLE
var/lighting_alpha
/obj/item/organ/internal/eyes/proc/update_colour()
dna.write_eyes_attributes(src)
@@ -25,7 +27,7 @@
if(!istype(H))
H = owner
var/icon/eyes_icon = new /icon('icons/mob/human_face.dmi', H.dna.species.eyes)
eyes_icon.Blend(eye_colour, ICON_ADD)
eyes_icon.Blend(eye_color, ICON_ADD)
return eyes_icon
@@ -41,9 +43,12 @@
/obj/item/organ/internal/eyes/insert(mob/living/carbon/human/M, special = 0)
..()
if(istype(M) && eye_colour)
if(istype(M) && eye_color)
M.update_body() //Apply our eye colour to the target.
M.update_tint()
M.update_sight()
if(!HAS_TRAIT(M, TRAIT_COLORBLIND) && (TRAIT_COLORBLIND in dependent_disabilities)) //If the eyes are colourblind and we're not, carry over the gene.
dependent_disabilities -= TRAIT_COLORBLIND
M.dna.SetSEState(GLOB.colourblindblock, TRUE)
@@ -58,6 +63,8 @@
M.dna.SetSEState(GLOB.colourblindblock, FALSE)
singlemutcheck(M, GLOB.colourblindblock, MUTCHK_FORCED)
. = ..()
M.update_tint()
M.update_sight()
/obj/item/organ/internal/eyes/surgeryize()
if(!owner)
@@ -67,6 +74,32 @@
owner.SetEyeBlurry(0)
owner.SetEyeBlind(0)
/obj/item/organ/internal/eyes/night_vision
name = "shadow eyes"
desc = "A spooky set of eyes that can see in the dark."
see_in_dark = 8
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE
actions_types = list(/datum/action/item_action/organ_action/use)
/obj/item/organ/internal/eyes/night_vision/ui_action_click()
vision_flags = initial(vision_flags)
switch(lighting_alpha)
if(LIGHTING_PLANE_ALPHA_VISIBLE)
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE
if(LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE)
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE
if(LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE)
lighting_alpha = LIGHTING_PLANE_ALPHA_INVISIBLE
else
lighting_alpha = LIGHTING_PLANE_ALPHA_VISIBLE
vision_flags &= ~SEE_BLACKNESS
owner.update_sight()
/obj/item/organ/internal/eyes/night_vision/nightmare
name = "burning red eyes"
desc = "Even without their shadowy owner, looking at these eyes gives you a sense of dread."
icon_state = "burning_eyes"
/obj/item/organ/internal/eyes/robotize(make_tough)
colourmatrix = null
..() //Make sure the organ's got the robotic status indicators before updating the client colour.
@@ -79,3 +112,79 @@
desc = "An electronic device designed to mimic the functions of a pair of human eyes. It has no benefits over organic eyes, but is easy to produce."
origin_tech = "biotech=4"
status = ORGAN_ROBOT
/obj/item/organ/internal/eyes/cybernetic/emp_act(severity)
if(!owner || emp_proof)
return
if(prob(10 * severity))
return
to_chat(owner, "<span class='warning'>Static obfuscates your vision!</span>")
owner.flash_eyes(visual = TRUE)
..()
/obj/item/organ/internal/eyes/cybernetic/meson
name = "meson eyes"
desc = "These cybernetic eyes will allow you to see the structural layout of the station, and, well, everything else."
eye_color = "#199900"
vision_flags = SEE_TURFS
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE
origin_tech = "materials=4;engineering=4;biotech=4;magnets=4"
/obj/item/organ/internal/eyes/cybernetic/xray
name = "\improper X-ray eyes"
desc = "These cybernetic eyes will give you X-ray vision. Blinking is futile."
see_in_dark = 8
vision_flags = SEE_MOBS | SEE_OBJS | SEE_TURFS
origin_tech = "materials=4;programming=4;biotech=7;magnets=4"
/obj/item/organ/internal/eyes/cybernetic/thermals
name = "thermal eyes"
desc = "These cybernetic eye implants will give you thermal vision. Vertical slit pupil included."
eye_color = "#FFCC00"
vision_flags = SEE_MOBS
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE
flash_protect = FLASH_PROTECTION_SENSITIVE
see_in_dark = 8
origin_tech = "materials=5;programming=4;biotech=4;magnets=4;syndicate=1"
/obj/item/organ/internal/eyes/cybernetic/flashlight
name = "flashlight eyes"
desc = "It's two flashlights rigged together with some wire. Why would you put these in someone's head?"
eye_color ="#FEE5A3"
icon = 'icons/obj/lighting.dmi'
icon_state = "flashlight_eyes"
flash_protect = FLASH_PROTECTION_WELDER
tint = INFINITY
var/obj/item/flashlight/eyelight/eye
/obj/item/organ/internal/eyes/cybernetic/flashlight/emp_act(severity)
return
/obj/item/organ/internal/eyes/cybernetic/flashlight/insert(mob/living/carbon/M, special = FALSE)
..()
if(!eye)
eye = new /obj/item/flashlight/eyelight()
eye.on = TRUE
eye.forceMove(M)
eye.update_brightness(M)
M.become_blind("flashlight_eyes")
/obj/item/organ/internal/eyes/cybernetic/flashlight/remove(mob/living/carbon/M, special = FALSE)
if(eye)
eye.on = FALSE
eye.update_brightness(M)
eye.forceMove(src)
M.cure_blind("flashlight_eyes")
. = ..()
// Welding shield implant
/obj/item/organ/internal/eyes/cybernetic/shield
name = "shielded robotic eyes"
desc = "These reactive micro-shields will protect you from welders and flashes without obscuring your vision."
flash_protect = FLASH_PROTECTION_WELDER
eye_color = "#101010"
origin_tech = "materials=4;biotech=3;engineering=4;plasmatech=3"
/obj/item/organ/internal/eyes/cybernetic/shield/emp_act(severity)
return
@@ -118,7 +118,7 @@
icon_state = "camera"
status = ORGAN_ROBOT
// dead_icon = "camera_broken"
weld_proof = 1
weld_proof = TRUE
/obj/item/organ/internal/eyes/optical_sensor/remove(var/mob/living/user,special = 0)
if(!special)
@@ -1,3 +0,0 @@
/obj/item/organ/internal/eyes/shadow
name = "dark orbs"
see_in_dark = 8