diff --git a/code/_onclick/hud/_defines.dm b/code/_onclick/hud/_defines.dm
index 299daf895c0..0a0be927d39 100644
--- a/code/_onclick/hud/_defines.dm
+++ b/code/_onclick/hud/_defines.dm
@@ -42,7 +42,8 @@
#define ui_inv1 "6:16,1:5" //borgs
#define ui_inv2 "7:16,1:5" //borgs
#define ui_inv3 "8:16,1:5" //borgs
-#define ui_borg_store "9:16,1:5" //borgs
+#define ui_borg_module "CENTER+1:16,SOUTH:5" //borgs
+#define ui_borg_store "CENTER+2:16,SOUTH:5" //borgs
#define ui_monkey_uniform "3:14,1:5"//monkey
#define ui_monkey_hat "4:14,1:5" //monkey
@@ -59,7 +60,7 @@
#define ui_acti_alt "14:28,1:5" //alternative intent switcher for when the interface is hidden (F12)
#define ui_borg_pull "12:24,2:7"
-#define ui_borg_module "13:26,2:7"
+//#define ui_borg_module "13:26,2:7"
#define ui_borg_panel "14:28,2:7"
//Gun buttons
diff --git a/code/_onclick/hud/robot.dm b/code/_onclick/hud/robot.dm
index 62cf2247c3a..143ffac4b39 100644
--- a/code/_onclick/hud/robot.dm
+++ b/code/_onclick/hud/robot.dm
@@ -168,3 +168,64 @@
mymob.client.screen += src.adding + src.other
return
+
+/datum/hud/proc/toggle_show_robot_modules()
+ if(!isrobot(mymob)) return
+
+ var/mob/living/silicon/robot/r = mymob
+
+ r.shown_robot_modules = !r.shown_robot_modules
+ update_robot_modules_display()
+
+/datum/hud/proc/update_robot_modules_display()
+ if(!isrobot(mymob)) return
+
+ var/mob/living/silicon/robot/r = mymob
+
+ if(r.shown_robot_modules)
+ //Modules display is shown
+ r.client.screen += r.throw_icon //"store" icon
+
+ if(!r.module)
+ usr << "No module selected"
+ return
+
+ if(!r.module.modules)
+ usr << "Selected module has no modules to select"
+ return
+
+ if(!r.robot_modules_background)
+ return
+
+ var/display_rows = round((r.module.modules.len) / 8) +1 //+1 because round() returns floor of number
+ r.robot_modules_background.screen_loc = "CENTER-4:16,SOUTH+1:7 to CENTER+3:16,SOUTH+[display_rows]:7"
+ r.client.screen += r.robot_modules_background
+
+ var/x = -4 //Start at CENTER-4,SOUTH+1
+ var/y = 1
+
+ for(var/atom/movable/A in r.module.modules)
+ if( (A != r.module_state_1) && (A != r.module_state_2) && (A != r.module_state_3) )
+ //Module is not currently active
+ r.client.screen += A
+ if(x < 0)
+ A.screen_loc = "CENTER[x]:16,SOUTH+[y]:7"
+ else
+ A.screen_loc = "CENTER+[x]:16,SOUTH+[y]:7"
+ A.layer = 20
+
+ x++
+ if(x == 4)
+ x = -4
+ y++
+
+ else
+ //Modules display is hidden
+ r.client.screen -= r.throw_icon //"store" icon
+
+ for(var/atom/A in r.module.modules)
+ if( (A != r.module_state_1) && (A != r.module_state_2) && (A != r.module_state_3) )
+ //Module is not currently active
+ r.client.screen -= A
+ r.shown_robot_modules = 0
+ r.client.screen -= r.robot_modules_background
\ No newline at end of file
diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm
index 9142c73c65d..967b0ab51dd 100644
--- a/code/_onclick/hud/screen_objects.dm
+++ b/code/_onclick/hud/screen_objects.dm
@@ -385,10 +385,12 @@
usr.drop_item_v()
if("module")
- if(issilicon(usr))
- if(usr:module)
+ if(isrobot(usr))
+ var/mob/living/silicon/robot/R = usr
+ if(R.module)
+ R.hud_used.toggle_show_robot_modules()
return 1
- usr:pick_module()
+ R:pick_module()
if("radio")
if(issilicon(usr))
@@ -398,8 +400,10 @@
usr:installed_modules()
if("store")
- if(issilicon(usr))
- usr:uneq_active()
+ if(isrobot(usr))
+ var/mob/living/silicon/robot/R = usr
+ R.uneq_active()
+ R.hud_used.update_robot_modules_display()
if(INV_SLOT_TOOL)
if(istype(usr, /mob/living/silicon/robot/mommi))
diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm
index 8291fa1c8b1..d7ec6e7d149 100644
--- a/code/game/objects/items.dm
+++ b/code/game/objects/items.dm
@@ -138,6 +138,11 @@
if(src == user:tool_state || src == user:sight_state)
return 0
attack_hand(user)
+ if(istype(src.loc, /obj/item/weapon/robot_module))
+ if(!isrobot(user)) return
+ var/mob/living/silicon/robot/R = user
+ R.activate_module(src)
+ R.hud_used.update_robot_modules_display()
/obj/item/attack_hand(mob/user as mob)
if (!user) return
@@ -150,6 +155,7 @@
return
if (istype(src.loc, /obj/item/weapon/storage))
+ //If the item is in a storage item, take it out.
var/obj/item/weapon/storage/S = src.loc
S.remove_from_storage(src)
diff --git a/code/modules/mob/living/silicon/mommi/inventory.dm b/code/modules/mob/living/silicon/mommi/inventory.dm
index a43f51141f2..f2873bbc416 100644
--- a/code/modules/mob/living/silicon/mommi/inventory.dm
+++ b/code/modules/mob/living/silicon/mommi/inventory.dm
@@ -23,9 +23,9 @@
return 0
// Make sure we're not picking up something that's in our factory-supplied toolbox.
//if(is_type_in_list(W,src.module.modules))
- if(is_in_modules(W))
- src << "\red Picking up something that's built-in to you seems a bit silly."
- return 0
+ //if(is_in_modules(W))
+ //src << "\red Picking up something that's built-in to you seems a bit silly."
+ //return 0
if(tool_state)
//var/obj/item/found = locate(tool_state) in src.module.modules
var/obj/item/TS = tool_state
@@ -96,8 +96,9 @@
if(tool_state)
//var/obj/item/found = locate(tool_state) in src.module.modules
if(is_in_modules(tool_state))
- src << "\red This item cannot be dropped."
- return 0
+ if((tool_state in contents) && (tool_state in src.module.modules))
+ src << "This item cannot be dropped."
+ return 0
if(client)
client.screen -= tool_state
contents -= tool_state
@@ -127,6 +128,11 @@
var/obj/item/TS
if(isnull(module_active))
return
+ if((module_active in src.contents) && !(module_active in src.module.modules))
+ TS = tool_state
+ drop_item()
+ if(TS && TS.loc)
+ TS.loc = get_turf(src)
if(sight_state == module_active)
TS = sight_state
if(istype(sight_state,/obj/item/borg/sight))
diff --git a/code/modules/mob/living/silicon/robot/inventory.dm b/code/modules/mob/living/silicon/robot/inventory.dm
index b77a086870a..f8471acefac 100644
--- a/code/modules/mob/living/silicon/robot/inventory.dm
+++ b/code/modules/mob/living/silicon/robot/inventory.dm
@@ -16,7 +16,8 @@
client.screen -= module
contents -= module
- module.loc = src.module
+ if(module)
+ module.loc = src.module
return 1
/mob/living/silicon/robot/proc/uneq_active()
@@ -38,6 +39,36 @@
module_active = null
updateicon()
+
+/mob/living/silicon/robot/proc/activate_module(var/obj/item/O)
+ if(!(locate(O) in src.module.modules) && O != src.module.emag)
+ return
+ if(activated(O))
+ src << "Already activated"
+ return
+ if(!module_state_1)
+ module_state_1 = O
+ O.layer = 20
+ O.screen_loc = inv1.screen_loc
+ contents += O
+ if(istype(module_state_1,/obj/item/borg/sight))
+ sight_mode |= module_state_1:sight_mode
+ else if(!module_state_2)
+ module_state_2 = O
+ O.layer = 20
+ O.screen_loc = inv2.screen_loc
+ contents += O
+ if(istype(module_state_2,/obj/item/borg/sight))
+ sight_mode |= module_state_2:sight_mode
+ else if(!module_state_3)
+ module_state_3 = O
+ O.layer = 20
+ O.screen_loc = inv3.screen_loc
+ contents += O
+ if(istype(module_state_3,/obj/item/borg/sight))
+ sight_mode |= module_state_3:sight_mode
+ else
+ src << "You need to disable a module first!"
/mob/living/silicon/robot/proc/uneq_all()
module_active = null
diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm
index 18b7bd2356b..2bb740b6adb 100644
--- a/code/modules/mob/living/silicon/robot/robot.dm
+++ b/code/modules/mob/living/silicon/robot/robot.dm
@@ -19,6 +19,9 @@
var/obj/screen/inv1 = null
var/obj/screen/inv2 = null
var/obj/screen/inv3 = null
+
+ var/shown_robot_modules = 0
+ var/obj/screen/robot_modules_background
//3 Modules can be activated at any one time.
var/obj/item/weapon/robot_module/module = null
@@ -81,6 +84,10 @@
wires = new /datum/wires/robot/mommi(src)
else
wires = new(src)
+
+ robot_modules_background = new()
+ robot_modules_background.icon_state = "block"
+ robot_modules_background.layer = 19
ident = rand(1, 999)
updatename("Default")
@@ -1237,31 +1244,7 @@
if(isMoMMI(src))
return
var/obj/item/O = locate(href_list["act"])
- if(!(locate(O) in src.module.modules) && O != src.module.emag)
- return
- if(activated(O))
- src << "Already activated"
- return
- if(!module_state_1)
- module_state_1 = O
- O.layer = 20
- contents += O
- if(istype(module_state_1,/obj/item/borg/sight))
- sight_mode |= module_state_1:sight_mode
- else if(!module_state_2)
- module_state_2 = O
- O.layer = 20
- contents += O
- if(istype(module_state_2,/obj/item/borg/sight))
- sight_mode |= module_state_2:sight_mode
- else if(!module_state_3)
- module_state_3 = O
- O.layer = 20
- contents += O
- if(istype(module_state_3,/obj/item/borg/sight))
- sight_mode |= module_state_3:sight_mode
- else
- src << "You need to disable a module first!"
+ activate_module(O)
installed_modules()
if (href_list["deact"])