diff --git a/code/_onclick/hud/_defines.dm b/code/_onclick/hud/_defines.dm index fc822a38542..3a5f4032a2f 100644 --- a/code/_onclick/hud/_defines.dm +++ b/code/_onclick/hud/_defines.dm @@ -39,10 +39,11 @@ #define ui_alien_head "4:12,1:5" //aliens #define ui_alien_oclothing "5:14,1:5" //aliens -#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_inv1 "7,1:5" //borgs +#define ui_inv2 "8,1:5" //borgs +#define ui_inv3 "9,1:5" //borgs +#define ui_borg_store "10,1:5" //borgs +#define ui_borg_inventory "6,1:5"//borgs #define ui_monkey_mask "5:14,1:5" //monkey #define ui_monkey_back "6:14,1:5" //monkey diff --git a/code/_onclick/hud/robot.dm b/code/_onclick/hud/robot.dm index 62cf2247c3a..c696308d2d9 100644 --- a/code/_onclick/hud/robot.dm +++ b/code/_onclick/hud/robot.dm @@ -1,3 +1,6 @@ +var/obj/screen/robot_inventory + + /datum/hud/proc/robot_hud() src.adding = list() @@ -5,7 +8,6 @@ var/obj/screen/using - //Radio using = new /obj/screen() using.name = "radio" @@ -98,6 +100,13 @@ mymob.throw_icon.name = "store" mymob.throw_icon.screen_loc = ui_borg_store +//Inventory + robot_inventory = new /obj/screen() + robot_inventory.name = "inventory" + robot_inventory.icon = 'icons/mob/screen1_robot.dmi' + robot_inventory.icon_state = "inventory" + robot_inventory.screen_loc = ui_borg_inventory + //Temp mymob.bodytemp = new /obj/screen() mymob.bodytemp.icon_state = "temp0" @@ -164,7 +173,81 @@ mymob.client.screen = null - mymob.client.screen += list( mymob.throw_icon, mymob.zone_sel, mymob.oxygen, mymob.fire, mymob.hands, mymob.healths, mymob:cells, mymob.pullin, mymob.blind, mymob.flash, mymob.gun_setting_icon) //, mymob.rest, mymob.sleep, mymob.mach ) + mymob.client.screen += list( mymob.throw_icon, mymob.zone_sel, mymob.oxygen, mymob.fire, mymob.hands, mymob.healths, mymob:cells, mymob.pullin, mymob.blind, mymob.flash, mymob.gun_setting_icon, robot_inventory) //, mymob.rest, mymob.sleep, mymob.mach ) 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 += robot_inventory //"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 + + //Unfortunately adding the emag module to the list of modules has to be here. This is because a borg can + //be emagged before they actually select a module. - or some situation can cause them to get a new module + // - or some situation might cause them to get de-emagged or something. + if(r.emagged) + if(!(r.module.emag in r.module.modules)) + r.module.modules.Add(r.module.emag) + else + if(r.module.emag in r.module.modules) + r.module.modules.Remove(r.module.emag) + + 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 -= robot_inventory //"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 diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index 8a10310b3d4..fdc4d992c5a 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -368,10 +368,21 @@ 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 + R.pick_module() + + if("inventory") + 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() + else + R << "You haven't selected a module yet." if("radio") if(issilicon(usr)) @@ -381,8 +392,13 @@ usr:installed_modules() if("store") - if(issilicon(usr)) - usr:uneq_active() + if(isrobot(usr)) + var/mob/living/silicon/robot/R = usr + if(R.module) + R.uneq_active() + R.hud_used.update_robot_modules_display() + else + R << "You haven't selected a module yet." if("module1") if(istype(usr, /mob/living/silicon/robot)) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 149890aa7e6..d8188544519 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -150,6 +150,16 @@ user.put_in_active_hand(src) return + +/obj/item/attack_ai(mob/user as mob) + if (istype(src.loc, /obj/item/weapon/robot_module)) + //If the item is part of a cyborg module, equip it + if(!isrobot(user)) + return + var/mob/living/silicon/robot/R = user + R.activate_module(src) + R.hud_used.update_robot_modules_display() + // Due to storage type consolidation this should get used more now. // I have cleaned it up a little, but it could probably use more. -Sayu /obj/item/attackby(obj/item/weapon/W as obj, mob/user as mob) diff --git a/code/modules/mob/living/silicon/robot/inventory.dm b/code/modules/mob/living/silicon/robot/inventory.dm index 1e7d4f770b8..9e73beac33a 100644 --- a/code/modules/mob/living/silicon/robot/inventory.dm +++ b/code/modules/mob/living/silicon/robot/inventory.dm @@ -6,6 +6,7 @@ return module_active /*-------TODOOOOOOOOOO--------*/ + /mob/living/silicon/robot/proc/uneq_active() if(isnull(module_active)) return @@ -16,6 +17,7 @@ client.screen -= module_state_1 contents -= module_state_1 module_active = null + module_state_1:loc = module //So it can be used again later module_state_1 = null inv1.icon_state = "inv1" else if(module_state_2 == module_active) @@ -25,6 +27,7 @@ client.screen -= module_state_2 contents -= module_state_2 module_active = null + module_state_2:loc = module module_state_2 = null inv2.icon_state = "inv2" else if(module_state_3 == module_active) @@ -34,6 +37,7 @@ client.screen -= module_state_3 contents -= module_state_3 module_active = null + module_state_3:loc = module module_state_3 = null inv3.icon_state = "inv3" updateicon() @@ -197,3 +201,33 @@ if(slot_num > 3) slot_num = 1 //Wrap around. return + +/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!" diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index ac9710220d9..495e96171f2 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -30,6 +30,9 @@ var/list/robot_verbs_default = list( var/obj/screen/inv2 = null var/obj/screen/inv3 = null + var/shown_robot_modules = 0 //Used to determine whether they have the module menu shown or not + var/obj/screen/robot_modules_background + //3 Modules can be activated at any one time. var/obj/item/weapon/robot_module/module = null var/module_active = null @@ -84,6 +87,9 @@ var/list/robot_verbs_default = list( wires = new(src) + robot_modules_background = new() + robot_modules_background.icon_state = "block" + robot_modules_background.layer = 19 //Objects that appear on screen are on layer 20, UI should be just below it. ident = rand(1, 999) updatename("Default") updateicon() diff --git a/icons/mob/screen1_robot.dmi b/icons/mob/screen1_robot.dmi index 1796092eae0..63f627ced46 100644 Binary files a/icons/mob/screen1_robot.dmi and b/icons/mob/screen1_robot.dmi differ