mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-26 13:39:16 +01:00
Ports tgstation/tgstation/pull/15673 (#16495)
* Ports tgstation/tgstation/pull/15673 * Add a small delay to icon updating to cover up SSoverlays * Fix actions on robot modules
This commit is contained in:
@@ -35,10 +35,8 @@
|
||||
var/max_pressure_protection // Set this variable if the item protects its wearer against high pressures below an upper bound. Keep at null to disable protection.
|
||||
var/min_pressure_protection // Set this variable if the item protects its wearer against low pressures above a lower bound. Keep at null to disable protection. 0 represents protection against hard vacuum.
|
||||
|
||||
|
||||
var/datum/action/item_action/action = null
|
||||
var/action_button_name //It is also the text which gets displayed on the action button. If not set it defaults to 'Use [name]'. If it's not set, there'll be no button.
|
||||
var/action_button_is_hands_free = 0 //If 1, bypass the restrained, lying, and stunned checks action buttons normally test for
|
||||
var/list/actions = list() //list of /datum/action's that this item has.
|
||||
var/list/actions_types = list() //list of paths of action datums to give to the item on New().
|
||||
|
||||
//This flag is used to determine when items in someone's inventory cover others. IE helmets making it so you can't see glasses, etc.
|
||||
//It should be used purely for appearance. For gameplay effects caused by items covering body parts, use body_parts_covered.
|
||||
@@ -117,6 +115,8 @@
|
||||
|
||||
/obj/item/New()
|
||||
..()
|
||||
for(var/path in actions_types)
|
||||
new path(src)
|
||||
if(embed_chance < 0)
|
||||
if(sharp)
|
||||
embed_chance = max(5, round(force/w_class))
|
||||
@@ -137,6 +137,8 @@
|
||||
m.update_inv_r_hand()
|
||||
m.update_inv_l_hand()
|
||||
src.loc = null
|
||||
for(var/X in actions)
|
||||
qdel(X)
|
||||
return ..()
|
||||
|
||||
// Check if target is reasonable for us to operate on.
|
||||
@@ -333,6 +335,9 @@
|
||||
if(zoom)
|
||||
zoom() //binoculars, scope, etc
|
||||
appearance_flags &= ~NO_CLIENT_COLOR
|
||||
for(var/X in actions)
|
||||
var/datum/action/A = X
|
||||
A.Remove(user)
|
||||
|
||||
// called just as an item is picked up (loc is not yet changed)
|
||||
/obj/item/proc/pickup(mob/user)
|
||||
@@ -358,6 +363,10 @@
|
||||
// for items that can be placed in multiple slots
|
||||
// note this isn't called during the initial dressing of a player
|
||||
/obj/item/proc/equipped(var/mob/user, var/slot)
|
||||
for(var/X in actions)
|
||||
var/datum/action/A = X
|
||||
if(item_action_slot_check(slot, user)) //some items only give their actions buttons when in a specific slot.
|
||||
A.Grant(user)
|
||||
hud_layerise()
|
||||
user.position_hud_item(src,slot)
|
||||
if(user.client) user.client.screen |= src
|
||||
@@ -371,6 +380,12 @@
|
||||
playsound(src, pickup_sound, 20, preference = /datum/preference/toggle/pickup_sounds)
|
||||
return
|
||||
|
||||
//sometimes we only want to grant the item's action if it's equipped in a specific slot.
|
||||
/obj/item/proc/item_action_slot_check(slot, mob/user)
|
||||
if(slot == SLOT_BACK || slot == LEGS) //these aren't true slots, so avoid granting actions there
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
// As above but for items being equipped to an active module on a robot.
|
||||
/obj/item/proc/equipped_robot(var/mob/user)
|
||||
return
|
||||
@@ -534,11 +549,11 @@ var/list/global/slot_flags_enumeration = list(
|
||||
return
|
||||
|
||||
|
||||
//This proc is executed when someone clicks the on-screen UI button. To make the UI button show, set the 'icon_action_button' to the icon_state of the image of the button in screen1_action.dmi
|
||||
//This proc is executed when someone clicks the on-screen UI button.
|
||||
//The default action is attack_self().
|
||||
//Checks before we get to here are: mob is alive, mob is not restrained, paralyzed, asleep, resting, laying, item is on the mob.
|
||||
/obj/item/proc/ui_action_click()
|
||||
attack_self(usr)
|
||||
/obj/item/proc/ui_action_click(mob/user, actiontype)
|
||||
attack_self(user)
|
||||
|
||||
//RETURN VALUES
|
||||
//handle_shield should return a positive value to indicate that the attack is blocked and should be prevented.
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
w_class = ITEMSIZE_LARGE
|
||||
unacidable = TRUE
|
||||
origin_tech = list(TECH_BIO = 4, TECH_POWER = 2)
|
||||
action_button_name = "Remove/Replace Paddles"
|
||||
actions_types = list(/datum/action/item_action/remove_replace_paddles)
|
||||
|
||||
var/obj/item/shockpaddles/linked/paddles
|
||||
var/obj/item/cell/bcell = null
|
||||
@@ -64,7 +64,7 @@
|
||||
else
|
||||
add_overlay("[initial(icon_state)]-nocell")
|
||||
|
||||
/obj/item/defib_kit/ui_action_click()
|
||||
/obj/item/defib_kit/ui_action_click(mob/user, actiontype)
|
||||
toggle_paddles()
|
||||
|
||||
/obj/item/defib_kit/attack_hand(mob/user)
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
w_class = ITEMSIZE_SMALL
|
||||
slot_flags = SLOT_BELT
|
||||
matter = list(MAT_STEEL = 50,MAT_GLASS = 20)
|
||||
action_button_name = "Toggle Flashlight"
|
||||
actions_types = list(/datum/action/item_action/toggle_flashlight)
|
||||
|
||||
light_system = MOVABLE_LIGHT_DIRECTIONAL
|
||||
light_range = 4 //luminosity when on
|
||||
@@ -102,7 +102,7 @@
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
playsound(src, 'sound/weapons/empty.ogg', 15, 1, -3) // VOREStation Edit
|
||||
update_brightness()
|
||||
user.update_action_buttons()
|
||||
user.update_action_buttons_icon()
|
||||
return 1
|
||||
|
||||
/obj/item/flashlight/emp_act(severity)
|
||||
@@ -355,7 +355,7 @@
|
||||
light_color = LIGHT_COLOR_FLARE
|
||||
icon_state = "flare"
|
||||
item_state = "flare"
|
||||
action_button_name = null //just pull it manually, neckbeard.
|
||||
actions_types = list() //just pull it manually, neckbeard.
|
||||
var/fuel = 0
|
||||
var/on_damage = 7
|
||||
var/produce_heat = 1500
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
w_class = ITEMSIZE_HUGE //It's a giant shield generator!!!
|
||||
unacidable = TRUE
|
||||
origin_tech = list(TECH_MATERIAL = 6, TECH_COMBAT = 8, TECH_POWER = 6, TECH_DATA = 4) //These are limited AND high tech. Breaking one of them down is massive.
|
||||
action_button_name = "Toggle Shield"
|
||||
actions_types = list(/datum/action/item_action/toggle_shield)
|
||||
var/obj/item/gun/energy/gun/generator/active_weapon
|
||||
var/obj/item/cell/device/bcell = null
|
||||
var/upgraded = 0 // If the PSG has been upgraded by some method or not. Only used for the mining belt ATM.
|
||||
@@ -138,7 +138,7 @@
|
||||
bcell.emp_act(severity)
|
||||
..()
|
||||
|
||||
/obj/item/personal_shield_generator/ui_action_click()
|
||||
/obj/item/personal_shield_generator/ui_action_click(mob/user, actiontype)
|
||||
toggle_shield()
|
||||
|
||||
/obj/item/personal_shield_generator/attack_hand(mob/user)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
throwforce = 6
|
||||
preserve_item = 1
|
||||
w_class = ITEMSIZE_LARGE
|
||||
action_button_name = "Remove/Replace Handset"
|
||||
actions_types = list(/datum/action/item_action/remove_replace_handset)
|
||||
|
||||
var/obj/item/radio/bluespacehandset/linked/handset = /obj/item/radio/bluespacehandset/linked
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
. = ..()
|
||||
QDEL_NULL(handset)
|
||||
|
||||
/obj/item/bluespaceradio/ui_action_click()
|
||||
/obj/item/bluespaceradio/ui_action_click(mob/user, actiontype)
|
||||
toggle_handset()
|
||||
|
||||
/obj/item/bluespaceradio/attack_hand(var/mob/user)
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
throwforce = 10.0
|
||||
throw_speed = 1
|
||||
throw_range = 4
|
||||
action_button_name = "Toggle Heatsink"
|
||||
actions_types = list(/datum/action/item_action/toggle_heatsink)
|
||||
|
||||
matter = list(MAT_STEEL = 15000, MAT_GLASS = 3500)
|
||||
origin_tech = list(TECH_MAGNET = 2, TECH_MATERIAL = 2)
|
||||
@@ -28,8 +28,8 @@
|
||||
|
||||
//TODO: make it heat up the surroundings when not in space
|
||||
|
||||
/obj/item/suit_cooling_unit/ui_action_click()
|
||||
toggle(usr)
|
||||
/obj/item/suit_cooling_unit/ui_action_click(mob/user, actiontype)
|
||||
toggle(user)
|
||||
|
||||
/obj/item/suit_cooling_unit/Initialize()
|
||||
. = ..()
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
pickup_sound = 'sound/items/pickup/ring.ogg'
|
||||
throwforce = 0
|
||||
force = 0
|
||||
action_button_name = "Command"
|
||||
actions_types = list(/datum/action/item_action/command)
|
||||
|
||||
var/active = FALSE //Is it set up?
|
||||
var/mob/living/owner //Reference to the owner
|
||||
@@ -48,7 +48,7 @@
|
||||
. += span_deptradio("<a href='?src=\ref[bound_mob];vore_prefs=1'>\[Mechanical Vore Preferences\]</a>")
|
||||
|
||||
//Command! This lets the owner toggle hostile on AI controlled mobs, or send a silent command message to your bound mob, wherever they may be.
|
||||
/obj/item/capture_crystal/ui_action_click()
|
||||
/obj/item/capture_crystal/ui_action_click(mob/user, actiontype)
|
||||
if(!ismob(loc))
|
||||
return
|
||||
var/mob/living/M = src.loc
|
||||
@@ -67,7 +67,7 @@
|
||||
to_chat(M, span_notice("\The [bound_mob] is now [AI.hostile ? "hostile" : "passive"]."))
|
||||
log_admin("[key_name_admin(M)] set [bound_mob] to [AI.hostile].")
|
||||
else if(bound_mob.client)
|
||||
var/transmit_msg = tgui_input_text(usr, "What is your command?", "Command")
|
||||
var/transmit_msg = tgui_input_text(user, "What is your command?", "Command")
|
||||
if(length(transmit_msg) >= MAX_MESSAGE_LEN)
|
||||
to_chat(M, span_danger("Your message was TOO LONG!:[transmit_msg]"))
|
||||
return
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
set_light(0)
|
||||
light_applied = 0
|
||||
update_icon(user)
|
||||
user.update_action_buttons()
|
||||
user.update_action_buttons_icon()
|
||||
playsound(src, 'sound/weapons/empty.ogg', 15, 1, -3)
|
||||
|
||||
/obj/item/shield/riot/explorer/update_icon()
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
var/on = 0.0
|
||||
var/stabilization_on = 0
|
||||
var/volume_rate = 500 //Needed for borg jetpack transfer
|
||||
action_button_name = "Toggle Jetpack"
|
||||
actions_types = list(/datum/action/item_action/toggle_jetpack)
|
||||
|
||||
/obj/item/tank/jetpack/New()
|
||||
..()
|
||||
@@ -55,7 +55,7 @@
|
||||
if (ismob(usr))
|
||||
var/mob/M = usr
|
||||
M.update_inv_back()
|
||||
M.update_action_buttons()
|
||||
M.update_action_buttons_icon()
|
||||
|
||||
to_chat(usr, "You toggle the thrusters [on? "on":"off"].")
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
fuel.remove(num)
|
||||
return 1
|
||||
|
||||
/obj/item/tank/jetpack/ui_action_click()
|
||||
/obj/item/tank/jetpack/ui_action_click(mob/user, actiontype)
|
||||
toggle()
|
||||
|
||||
/obj/item/tank/jetpack/void
|
||||
|
||||
Reference in New Issue
Block a user