mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-29 08:08:49 +01:00
Moves material item insertion to right click for material containers (#90188)
## About The Pull Request Inserting material (i.e. made from a material, but not a material sheet/stack) items into material containers/remotes (ore silos, autolathes, protolathes, etc) now uses right click instead of left click. You still insert sheets using left click. ## Why It's Good For The Game Its super easy to end up having your guns (which are made out of iron) or armor (also made out of armor) or disks (also made out of iron) eaten by an autolathe as you try to click a table next to it. This should resolve players' frustrations while keeping material item insertion an option via right clicking. ## Changelog 🆑 qol: Moved material item insertion to right click for material containers /🆑 --------- Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
@@ -81,6 +81,7 @@
|
||||
if(!(mat_container_flags & MATCONTAINER_NO_INSERT))
|
||||
//to insert stuff into the container
|
||||
RegisterSignal(atom_target, COMSIG_ATOM_ITEM_INTERACTION, PROC_REF(on_item_insert))
|
||||
RegisterSignal(atom_target, COMSIG_ATOM_ITEM_INTERACTION_SECONDARY, PROC_REF(on_secondary_insert))
|
||||
|
||||
//screen tips for inserting items
|
||||
atom_target.flags_1 |= HAS_CONTEXTUAL_SCREENTIPS_1
|
||||
@@ -98,6 +99,7 @@
|
||||
|
||||
if(!(mat_container_flags & MATCONTAINER_NO_INSERT))
|
||||
signals += COMSIG_ATOM_ITEM_INTERACTION
|
||||
signals += COMSIG_ATOM_ITEM_INTERACTION_SECONDARY
|
||||
signals += COMSIG_ATOM_REQUESTING_CONTEXT_FROM_ITEM
|
||||
if(mat_container_flags & MATCONTAINER_EXAMINE)
|
||||
signals += COMSIG_ATOM_EXAMINE
|
||||
@@ -130,8 +132,9 @@
|
||||
|
||||
if(old_flags & MATCONTAINER_NO_INSERT && !(mat_container_flags & MATCONTAINER_NO_INSERT))
|
||||
RegisterSignal(parent, COMSIG_ATOM_ITEM_INTERACTION, PROC_REF(on_item_insert))
|
||||
RegisterSignal(parent, COMSIG_ATOM_ITEM_INTERACTION_SECONDARY, PROC_REF(on_secondary_insert))
|
||||
else if(!(old_flags & MATCONTAINER_NO_INSERT) && mat_container_flags & MATCONTAINER_NO_INSERT)
|
||||
UnregisterSignal(parent, COMSIG_ATOM_ITEM_INTERACTION)
|
||||
UnregisterSignal(parent, list(COMSIG_ATOM_ITEM_INTERACTION, COMSIG_ATOM_ITEM_INTERACTION_SECONDARY))
|
||||
|
||||
/**
|
||||
* 3 Types of Procs
|
||||
@@ -485,21 +488,28 @@
|
||||
if(!QDELETED(deleting)) //deleting parents also delete their children so we check
|
||||
qdel(deleting)
|
||||
|
||||
/// Proc that allows players to fill the parent with mats
|
||||
/datum/component/material_container/proc/on_item_insert(datum/source, mob/living/user, obj/item/weapon, list/modifiers)
|
||||
/datum/component/material_container/proc/on_item_insert(datum/source, mob/living/user, obj/item/weapon)
|
||||
SIGNAL_HANDLER
|
||||
// Don't insert material items with left click
|
||||
if (isstack(weapon))
|
||||
return attempt_insert(user, weapon)
|
||||
|
||||
/datum/component/material_container/proc/on_secondary_insert(datum/source, mob/living/user, obj/item/weapon)
|
||||
SIGNAL_HANDLER
|
||||
return attempt_insert(user, weapon)
|
||||
|
||||
/// Proc that allows players to fill the parent with mats
|
||||
/datum/component/material_container/proc/attempt_insert(mob/living/user, obj/item/weapon)
|
||||
//Allows you to attack the machine with iron sheets for e.g.
|
||||
if(!(mat_container_flags & MATCONTAINER_ANY_INTENT) && user.combat_mode)
|
||||
return
|
||||
|
||||
if(ismachinery(source))
|
||||
var/obj/machinery/machine = source
|
||||
if(ismachinery(parent))
|
||||
var/obj/machinery/machine = parent
|
||||
if(machine.machine_stat || machine.panel_open)
|
||||
return
|
||||
|
||||
user_insert(weapon, user)
|
||||
|
||||
return ITEM_INTERACT_SUCCESS
|
||||
//===============================================================================================
|
||||
|
||||
@@ -777,7 +787,9 @@
|
||||
continue
|
||||
return NONE
|
||||
|
||||
context[SCREENTIP_CONTEXT_LMB] = "Insert"
|
||||
if (isstack(held_item))
|
||||
context[SCREENTIP_CONTEXT_LMB] = "Insert stack"
|
||||
context[SCREENTIP_CONTEXT_RMB] = "Insert"
|
||||
|
||||
return CONTEXTUAL_SCREENTIP_SET
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ handles linking back and forth.
|
||||
mat_container = silo.materials
|
||||
if(!(mat_container_flags & MATCONTAINER_NO_INSERT))
|
||||
RegisterSignal(parent, COMSIG_ATOM_ITEM_INTERACTION, PROC_REF(on_item_insert))
|
||||
RegisterSignal(parent, COMSIG_ATOM_ITEM_INTERACTION_SECONDARY, PROC_REF(on_secondary_insert))
|
||||
|
||||
if (!mat_container && allow_standalone)
|
||||
_MakeLocal()
|
||||
@@ -124,7 +125,7 @@ handles linking back and forth.
|
||||
if (QDELETED(old_silo) || silo != old_silo)
|
||||
return
|
||||
|
||||
UnregisterSignal(parent, COMSIG_ATOM_ITEM_INTERACTION)
|
||||
UnregisterSignal(parent, list(COMSIG_ATOM_ITEM_INTERACTION, COMSIG_ATOM_ITEM_INTERACTION_SECONDARY))
|
||||
silo.ore_connected_machines -= src
|
||||
silo = null
|
||||
mat_container = null
|
||||
@@ -164,22 +165,28 @@ handles linking back and forth.
|
||||
mat_container = new_container
|
||||
if(!(mat_container_flags & MATCONTAINER_NO_INSERT))
|
||||
RegisterSignal(parent, COMSIG_ATOM_ITEM_INTERACTION, PROC_REF(on_item_insert))
|
||||
RegisterSignal(parent, COMSIG_ATOM_ITEM_INTERACTION_SECONDARY, PROC_REF(on_secondary_insert))
|
||||
to_chat(user, span_notice("You connect [parent] to [silo] from the multitool's buffer."))
|
||||
return ITEM_INTERACT_SUCCESS
|
||||
|
||||
///Insert mats into silo
|
||||
/datum/component/remote_materials/proc/on_item_insert(datum/source, mob/living/user, obj/item/target)
|
||||
SIGNAL_HANDLER
|
||||
// Only insert stacks with left click
|
||||
if(isstack(target))
|
||||
return attempt_insert(user, target)
|
||||
|
||||
//Allows you to attack the machine with iron sheets for e.g.
|
||||
/datum/component/remote_materials/proc/on_secondary_insert(datum/source, mob/living/user, obj/item/target)
|
||||
SIGNAL_HANDLER
|
||||
return attempt_insert(user, target)
|
||||
|
||||
/// Insert mats into silo
|
||||
/datum/component/remote_materials/proc/attempt_insert(mob/living/user, obj/item/target)
|
||||
if(!(mat_container_flags & MATCONTAINER_ANY_INTENT) && user.combat_mode)
|
||||
return
|
||||
|
||||
if(silo)
|
||||
mat_container.user_insert(target, user, parent)
|
||||
|
||||
return ITEM_INTERACT_SUCCESS
|
||||
|
||||
return ITEM_INTERACT_SUCCESS
|
||||
|
||||
/**
|
||||
* Checks if the param silo is in the same level as this components parent i.e. connected machine, rcd, etc
|
||||
|
||||
Reference in New Issue
Block a user