Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions code/modules/clothing/spacesuits/rig/modules/vision.dm
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,16 @@
. = ..()
if(holder)
holder.visor = src
holder.verbs |= /obj/item/rig/proc/toggle_vision
if(length(vision_modes) > 1) // don't add it if we have no modes to switch between
holder.verbs |= /obj/item/rig/proc/switch_vision_mode

/obj/item/rig_module/vision/removed()
if(holder)
holder.visor = null
holder.verbs -= /obj/item/rig/proc/toggle_vision
// let's always remove it, just in case.
holder.verbs -= /obj/item/rig/proc/switch_vision_mode
. = ..()

/obj/item/rig_module/vision/engage()
Expand Down
129 changes: 47 additions & 82 deletions code/modules/clothing/spacesuits/rig/rig_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,14 @@
if(wearer && wearer.get_equipped_item(slot_back_str) == src)
ui_interact(usr)

/obj/item/rig/verb/toggle_vision()
/obj/item/rig/proc/toggle_vision()

set name = "Toggle Visor"
set desc = "Turns your rig visor off or on."
set category = "Hardsuit"
set src = usr.contents

if(!istype(wearer) || wearer.get_equipped_item(slot_back_str) != src)
to_chat(usr, "<span class='warning'>The hardsuit is not being worn.</span>")
return

if(!check_power_cost(usr))
return

if(canremove)
to_chat(usr, "<span class='warning'>The suit is not active.</span>")
if(!check_usable(usr))
return

if(!check_suit_access(usr))
Expand Down Expand Up @@ -106,16 +98,12 @@
set category = "Hardsuit"
set src = usr.contents

if(!istype(wearer) || wearer.get_equipped_item(slot_back_str) != src)
to_chat(usr, "<span class='warning'>The hardsuit is not being worn.</span>")
if(!check_usable(usr))
return

if(!check_suit_access(usr))
return

if(!check_power_cost(usr))
return

deploy(wearer)

/obj/item/rig/verb/toggle_seals_verb()
Expand All @@ -134,21 +122,14 @@

toggle_seals(wearer)

/obj/item/rig/verb/switch_vision_mode()
/obj/item/rig/proc/switch_vision_mode()

set name = "Switch Vision Mode"
set desc = "Switches between available vision modes."
set category = "Hardsuit"
set src = usr.contents

if(malfunction_check(usr))
return

if(!check_power_cost(usr, 0, 0, 0, 0))
return

if(canremove)
to_chat(usr, "<span class='warning'>The suit is not active.</span>")
if(!check_usable(usr))
return

if(!visor)
Expand All @@ -171,15 +152,7 @@
set category = "Hardsuit"
set src = usr.contents

if(malfunction_check(usr))
return

if(canremove)
to_chat(usr, "<span class='warning'>The suit is not active.</span>")
return

if(!istype(wearer) || wearer.get_equipped_item(slot_back_str) != src)
to_chat(usr, "<span class='warning'>The hardsuit is not being worn.</span>")
if(!check_usable(usr))
return

if(!speech)
Expand All @@ -188,31 +161,51 @@

speech.engage()

/obj/item/rig/proc/check_usable(mob/user)
if(malfunction_check(user))
return FALSE

if(!check_power_cost(user))
return FALSE

if(canremove)
to_chat(user, SPAN_WARNING("The suit is not active."))
return FALSE

if(!istype(wearer) || wearer.get_equipped_item(slot_back_str) != src)
to_chat(user, SPAN_WARNING("The hardsuit is not being worn."))
return FALSE
return TRUE

/obj/item/rig/proc/get_selectable_modules(mob/user)
. = list()
for(var/obj/item/rig_module/module in installed_modules)
if(module.selectable)
. |= module

/obj/item/rig/proc/get_toggleable_modules(mob/user)
. = list()
for(var/obj/item/rig_module/module in installed_modules)
if(module.toggleable)
. |= module

/obj/item/rig/proc/get_usable_modules(mob/user)
. = list()
for(var/obj/item/rig_module/module in installed_modules)
if(module.usable)
. |= module

/obj/item/rig/verb/select_module()

set name = "Select Module"
set desc = "Selects a module as your primary system."
set category = "Hardsuit"
set src = usr.contents

if(malfunction_check(usr))
return

if(!check_power_cost(usr, 0, 0, 0, 0))
return

if(canremove)
to_chat(usr, "<span class='warning'>The suit is not active.</span>")
return

if(!istype(wearer) || wearer.get_equipped_item(slot_back_str) != src)
to_chat(usr, "<span class='warning'>The hardsuit is not being worn.</span>")
if(!check_usable(usr))
return

var/list/selectable = list()
for(var/obj/item/rig_module/module in installed_modules)
if(module.selectable)
selectable |= module
var/list/selectable = get_selectable_modules()

var/obj/item/rig_module/module = input("Which module do you wish to select?") as null|anything in selectable

Expand All @@ -232,26 +225,12 @@
set category = "Hardsuit"
set src = usr.contents

if(malfunction_check(usr))
if(!check_usable(usr))
return

if(!check_power_cost(usr, 0, 0, 0, 0))
return
var/list/toggleable = get_toggleable_modules()

if(canremove)
to_chat(usr, "<span class='warning'>The suit is not active.</span>")
return

if(!istype(wearer) || wearer.get_equipped_item(slot_back_str) != src)
to_chat(usr, "<span class='warning'>The hardsuit is not being worn.</span>")
return

var/list/selectable = list()
for(var/obj/item/rig_module/module in installed_modules)
if(module.toggleable)
selectable |= module

var/obj/item/rig_module/module = input("Which module do you wish to toggle?") as null|anything in selectable
var/obj/item/rig_module/module = input("Which module do you wish to toggle?") as null|anything in toggleable

if(!istype(module))
return
Expand All @@ -270,24 +249,10 @@
set category = "Hardsuit"
set src = usr.contents

if(malfunction_check(usr))
return

if(canremove)
to_chat(usr, "<span class='warning'>The suit is not active.</span>")
if(!check_usable(usr))
return

if(!istype(wearer) || wearer.get_equipped_item(slot_back_str) != src)
to_chat(usr, "<span class='warning'>The hardsuit is not being worn.</span>")
return

if(!check_power_cost(usr, 0, 0, 0, 0))
return

var/list/selectable = list()
for(var/obj/item/rig_module/module in installed_modules)
if(module.usable)
selectable |= module
var/list/selectable = get_usable_modules()

var/obj/item/rig_module/module = input("Which module do you wish to engage?") as null|anything in selectable

Expand Down
Loading