Refresh problems and hotkeys

Ooohkay, so I added a bit more to this while fixing the issue with the
backpack module select screen not refreshing when you stored items.

I did a pass over the hotkeys! Hurray!

All right. Lets do this:

Key X
Previously, this hotkey wouldn't start cycling if your first inventory
slot wasn't filled. So if you had slots 2 and 3 full, but 1 empty,
clicking X would do nothing. Now it works how you'd expect. It cycles if
you have something selected, and if you have nothing selected, it
selects the first item.

Key C
This deselects everything, leaving you able to interact with computers
and distant AI objects. Previously, to do this you had to click on an
empty area of your selected module. It was very awkward.

Key V
This stores your currently selected item.

Key Q
Previously this would just tell you that you weren't allowed to drop
items as a robot. Now it toggles your inventory open or closed.

Key 1,2,3
Previously hitting 1 would activate Help intent, and 4 would activate
Harm intent. Robots have only two intent types, making the toggle key F
more useful. These now select the respective modules.

I also revised how clicking on items in the backpack works. Now,
clicking on an item in the module storage, with a tool selected, will
hot-swap the item into your current module.

Taken together, these changes reduce an enormous amount of unnecessary
clicking.
This commit is contained in:
jack-fractal
2015-05-23 00:18:57 -04:00
parent 4a450545ef
commit 92226dff35
7 changed files with 163 additions and 27 deletions
+6
View File
@@ -282,6 +282,12 @@
if(src.throw_icon)
src.throw_icon.icon_state = "act_throw_on"
/mob/living/carbon/key_pressed_q()
if(!get_active_hand())
usr << "\red You have nothing to drop in your hand."
return
return drop_item()
/mob/proc/throw_item(atom/target)
return
@@ -37,14 +37,21 @@
else if(module_state_3 == O)
module_state_3 = null
inv3.icon_state = "inv3"
hud_used.update_robot_modules_display() // update the display
return 1
/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
var/selected=get_selected_module() // this makes you swap your selected module if you've got one selected
if (selected)
uneq_active()
if(!module_state_1)
module_state_1 = O
O.layer = 20
@@ -68,6 +75,8 @@
sight_mode |= module_state_3:sight_mode
else
src << "You need to disable a module first!"
if (selected) // replaces your selection if you're swapping
select_module(selected)
/mob/living/silicon/robot/proc/uneq_active()
uneq_module(module_active)
@@ -174,6 +183,11 @@
return
return
/mob/living/silicon/robot/proc/deselect_current_module() //deselect current module
deselect_module(get_selected_module())
//toggle_module(module) - Toggles the selection of the module slot specified by "module".
/mob/living/silicon/robot/proc/toggle_module(var/module) //Module is 1-3
if(module < 1 || module > 3) return
@@ -187,23 +201,51 @@
deselect_module(get_selected_module()) //If we can't do select anything, at least deselect the current module.
return
/mob/living/silicon/robot/proc/first_active_module()
for (var/slot=0,slot<=3,slot++)
if (module_active(slot))
return slot
return 0
/mob/living/silicon/robot/proc/next_slot(var/slot)
if (slot >= 3)
return 1
return slot+1
//cycle_modules() - Cycles through the list of selected modules.
/mob/living/silicon/robot/proc/cycle_modules()
var/slot_start = get_selected_module()
if(slot_start) deselect_module(slot_start) //Only deselect if we have a selected slot.
var/slot_num
if(slot_start == 0)
slot_num = 1
slot_start = 2
if(slot_start)
deselect_module(slot_start) //Only deselect if we have a selected slot.
if(!slot_start) // we did not find a module
select_module(first_active_module()) // try to select the first active module
else
slot_num = slot_start + 1
while(slot_start != slot_num) //If we wrap around without finding any free slots, just give up.
if(module_active(slot_num))
select_module(slot_num)
return
slot_num++
if(slot_num > 3) slot_num = 1 //Wrap around.
var/slot_num = next_slot(slot_start)
while(slot_start != slot_num) //If we wrap around without finding any free slots, just give up.
if(module_active(slot_num))
select_module(slot_num)
return
slot_num=next_slot(slot_num)
return
/mob/living/silicon/robot/key_pressed_v()
uneq_active()
/mob/living/silicon/robot/key_pressed_c()
deselect_current_module()
/mob/living/silicon/robot/key_pressed_q()
hud_used.toggle_show_robot_modules()
/mob/living/silicon/robot/key_pressed_1()
return select_module(1)
/mob/living/silicon/robot/key_pressed_2()
return select_module(2)
/mob/living/silicon/robot/key_pressed_3()
return select_module(3)
/mob/living/silicon/robot/key_pressed_4()
return
+59
View File
@@ -394,6 +394,65 @@ var/list/intents = list("help","disarm","grab","hurt")
if(2) return "grab"
else return "hurt"
/mob/proc/key_pressed_c()
return
/mob/proc/key_pressed_q()
return
/mob/proc/key_pressed_v()
return
/client/verb/key_pressed_c()
set hidden = 1
set name = "key-pressed-c"
if (mob)
mob:key_pressed_c()
/client/verb/key_pressed_q()
set hidden = 1
set name = "key-pressed-q"
if (mob)
mob:key_pressed_q()
/client/verb/key_pressed_v()
set hidden = 1
set name = "key-pressed-v"
if (mob)
mob:key_pressed_v()
/mob/proc/key_pressed_1()
return a_intent_change("help")
/mob/proc/key_pressed_2()
return a_intent_change("disarm")
/mob/proc/key_pressed_3()
return a_intent_change("grab")
/mob/proc/key_pressed_4()
return a_intent_change("hurt")
/client/verb/key_pressed_1()
set hidden = 1
set name = "key-pressed-1"
if (mob)
mob:key_pressed_1()
/client/verb/key_pressed_2()
set hidden = 1
set name = "key-pressed-2"
if (mob)
mob:key_pressed_2()
/client/verb/key_pressed_3()
set hidden = 1
set name = "key-pressed-3"
if (mob)
mob:key_pressed_3()
/client/verb/key_pressed_4()
set hidden = 1
set name = "key-pressed-4"
if (mob)
mob:key_pressed_4()
//change a mob's act-intent. Input the intent as a string such as "help" or use "right"/"left
/mob/verb/a_intent_change(input as text)
set name = "a-intent"