Files
Bubberstation/code/game/objects/structures/guncase.dm
Qustinnus 707fc287b4 Replaces intents with combat mode (#56601)
About The Pull Request

This PR removes intents and replaces them with a combat mode. An explanation of what this means can be found below
Major changes:

    Disarm and Grab intents have been removed.
    Harm/Help is now combat mode, toggled by F or 4 by default
    The context/verb/popup menu now only works when you do shift+right-click
    Right click is now disarm, both in and out of combat mode.
    Grabbing is now on ctrl-click.
    If you're in combat mode, and are currently grabbing/pulling someone, and ctrl-click somewhere else, it will not release the grab (To prevent misclicks)

Minor interaction changes:

Right click to dissasemble tables, racks, filing cabinets (When holding the right tool to do so)
Left click to stunbaton, right click to harmbaton
Right click to tip cows
Right click to malpractice surgery
Right click to hold people at gunpoint (if youre holding a gun)
Why It's Good For The Game

Intents heavily cripple both the code and the UI design of interactions. While I understand that a lot of people will dislike this PR as they are used to intents, they are one of our weakest links in terms of explaining to players how to do specific things, and require a lot more keypresses to do compared to this.

As an example, martial arts can now be done without having to juggle 1 2 3 and 4 to switch intents quickly.

As some of you who saw the first combat mode PR, the context menu used to be disabled in combat mode. In this version it is instead on shift-right click ensuring that you can always use it in the same way.

In this version, combat mode also no longer prevents you from attacking with items when you would so before, as this was something that was commonly complained about.

The full intention of this shift in control scheme is that right click will become "secondary interaction" for items, which prevents some of the awkward juggling we have now with item modes etcetera.
Changelog

cl Qustinnus
add: Intents have been replaced with a combat mode. For more info find the PR here: #56601
/cl
2021-02-04 16:37:32 +13:00

140 lines
3.5 KiB
Plaintext

//GUNCASES//
/obj/structure/guncase
name = "gun locker"
desc = "A locker that holds guns."
icon = 'icons/obj/closet.dmi'
icon_state = "shotguncase"
anchored = FALSE
density = TRUE
opacity = FALSE
var/case_type = ""
var/gun_category = /obj/item/gun
var/open = TRUE
var/capacity = 4
/obj/structure/guncase/Initialize(mapload)
. = ..()
if(mapload)
for(var/obj/item/I in loc.contents)
if(istype(I, gun_category))
I.forceMove(src)
if(contents.len >= capacity)
break
update_icon()
/obj/structure/guncase/update_overlays()
. = ..()
if(case_type && LAZYLEN(contents))
var/mutable_appearance/gun_overlay = mutable_appearance(icon, case_type)
for(var/i in 1 to contents.len)
gun_overlay.pixel_x = 3 * (i - 1)
. += new /mutable_appearance(gun_overlay)
if(open)
. += "[icon_state]_open"
else
. += "[icon_state]_door"
/obj/structure/guncase/attackby(obj/item/I, mob/living/user, params)
if(iscyborg(user) || isalien(user))
return
if(istype(I, gun_category) && open)
if(LAZYLEN(contents) < capacity)
if(!user.transferItemToLoc(I, src))
return
to_chat(user, "<span class='notice'>You place [I] in [src].</span>")
update_icon()
else
to_chat(user, "<span class='warning'>[src] is full.</span>")
return
else if(!user.combat_mode)
open = !open
update_icon()
else
return ..()
/obj/structure/guncase/attack_hand(mob/user)
. = ..()
if(.)
return
if(iscyborg(user) || isalien(user))
return
if(contents.len && open)
show_menu(user)
else
open = !open
update_icon()
/**
* show_menu: Shows a radial menu to a user consisting of an available weaponry for taking
*
* Arguments:
* * user The mob to which we are showing the radial menu
*/
/obj/structure/guncase/proc/show_menu(mob/user)
if(!LAZYLEN(contents))
return
var/list/display_names = list()
var/list/items = list()
for(var/i in 1 to length(contents))
var/obj/item/thing = contents[i]
display_names["[thing.name] ([i])"] = REF(thing)
var/image/item_image = image(icon = thing.icon, icon_state = thing.icon_state)
if(length(thing.overlays))
item_image.copy_overlays(thing)
items += list("[thing.name] ([i])" = item_image)
var/pick = show_radial_menu(user, src, items, custom_check = CALLBACK(src, .proc/check_menu, user), radius = 36, require_near = TRUE)
if(!pick)
return
var/weapon_reference = display_names[pick]
var/obj/item/weapon = locate(weapon_reference) in contents
if(!istype(weapon))
return
if(!user.put_in_hands(weapon))
weapon.forceMove(get_turf(src))
update_icon()
/**
* check_menu: Checks if we are allowed to interact with a radial menu
*
* Arguments:
* * user The mob interacting with a menu
*/
/obj/structure/guncase/proc/check_menu(mob/living/carbon/human/user)
if(!open)
return FALSE
if(!istype(user))
return FALSE
if(user.incapacitated())
return FALSE
return TRUE
/obj/structure/guncase/handle_atom_del(atom/A)
update_icon()
/obj/structure/guncase/contents_explosion(severity, target)
for(var/thing in contents)
switch(severity)
if(EXPLODE_DEVASTATE)
SSexplosions.high_mov_atom += thing
if(EXPLODE_HEAVY)
SSexplosions.med_mov_atom += thing
if(EXPLODE_LIGHT)
SSexplosions.low_mov_atom += thing
/obj/structure/guncase/shotgun
name = "shotgun locker"
desc = "A locker that holds shotguns."
case_type = "shotgun"
gun_category = /obj/item/gun/ballistic/shotgun
/obj/structure/guncase/ecase
name = "energy gun locker"
desc = "A locker that holds energy guns."
icon_state = "ecase"
case_type = "egun"
gun_category = /obj/item/gun/energy/e_gun