Merge branch 'master' into upstream-merge-37299
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
#define ROTATION_ALTCLICK 1
|
||||
#define ROTATION_WRENCH 2
|
||||
#define ROTATION_VERBS 4
|
||||
#define ROTATION_COUNTERCLOCKWISE 8
|
||||
#define ROTATION_CLOCKWISE 16
|
||||
#define ROTATION_FLIP 32
|
||||
#define ROTATION_ALTCLICK (1<<0)
|
||||
#define ROTATION_WRENCH (1<<1)
|
||||
#define ROTATION_VERBS (1<<2)
|
||||
#define ROTATION_COUNTERCLOCKWISE (1<<3)
|
||||
#define ROTATION_CLOCKWISE (1<<4)
|
||||
#define ROTATION_FLIP (1<<5)
|
||||
|
||||
/datum/component/simple_rotation
|
||||
var/datum/callback/can_user_rotate //Checks if user can rotate
|
||||
var/datum/callback/can_be_rotated //Check if object can be rotated at all
|
||||
var/datum/callback/after_rotation //Additional stuff to do after rotation
|
||||
|
||||
|
||||
var/rotation_flags = NONE
|
||||
var/default_rotation_direction = ROTATION_CLOCKWISE
|
||||
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
|
||||
// External storage-related logic:
|
||||
// /mob/proc/ClickOn() in /_onclick/click.dm - clicking items in storages
|
||||
// /mob/living/Move() in /modules/mob/living/living.dm - hiding storage boxes on mob movement
|
||||
|
||||
/datum/component/storage/concrete
|
||||
var/drop_all_on_deconstruct = TRUE
|
||||
var/drop_all_on_destroy = FALSE
|
||||
var/transfer_contents_on_component_transfer = FALSE
|
||||
var/list/datum/component/storage/slaves = list()
|
||||
|
||||
/datum/component/storage/concrete/Initialize()
|
||||
. = ..()
|
||||
RegisterSignal(COMSIG_ATOM_CONTENTS_DEL, .proc/on_contents_del)
|
||||
RegisterSignal(COMSIG_OBJ_DECONSTRUCT, .proc/on_deconstruct)
|
||||
|
||||
/datum/component/storage/concrete/Destroy()
|
||||
var/atom/real_location = real_location()
|
||||
for(var/atom/_A in real_location)
|
||||
_A.mouse_opacity = initial(_A.mouse_opacity)
|
||||
if(drop_all_on_destroy)
|
||||
do_quick_empty()
|
||||
for(var/i in slaves)
|
||||
var/datum/component/storage/slave = i
|
||||
slave.change_master(null)
|
||||
return ..()
|
||||
|
||||
/datum/component/storage/concrete/master()
|
||||
return src
|
||||
|
||||
/datum/component/storage/concrete/real_location()
|
||||
return parent
|
||||
|
||||
/datum/component/storage/concrete/OnTransfer(datum/new_parent)
|
||||
if(!isatom(new_parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
var/list/mob/_is_using
|
||||
if(is_using)
|
||||
_is_using = is_using.Copy()
|
||||
close_all()
|
||||
if(transfer_contents_on_component_transfer)
|
||||
var/atom/old = parent
|
||||
for(var/i in old)
|
||||
var/atom/movable/AM = i
|
||||
AM.forceMove(new_parent)
|
||||
if(_is_using)
|
||||
for(var/i in _is_using)
|
||||
var/mob/M = i
|
||||
show_to(M)
|
||||
|
||||
/datum/component/storage/concrete/_insert_physical_item(obj/item/I, override = FALSE)
|
||||
. = TRUE
|
||||
var/atom/real_location = real_location()
|
||||
if(I.loc != real_location)
|
||||
I.forceMove(real_location)
|
||||
refresh_mob_views()
|
||||
|
||||
/datum/component/storage/concrete/refresh_mob_views()
|
||||
. = ..()
|
||||
for(var/i in slaves)
|
||||
var/datum/component/storage/slave = i
|
||||
slave.refresh_mob_views()
|
||||
|
||||
/datum/component/storage/concrete/emp_act(severity)
|
||||
var/atom/real_location = real_location()
|
||||
for(var/i in real_location)
|
||||
var/atom/A = i
|
||||
A.emp_act(severity)
|
||||
|
||||
/datum/component/storage/concrete/proc/on_slave_link(datum/component/storage/S)
|
||||
if(S == src)
|
||||
return FALSE
|
||||
slaves += S
|
||||
return TRUE
|
||||
|
||||
/datum/component/storage/concrete/proc/on_slave_unlink(datum/component/storage/S)
|
||||
slaves -= S
|
||||
return FALSE
|
||||
|
||||
/datum/component/storage/concrete/proc/on_contents_del(atom/A)
|
||||
var/atom/real_location = parent
|
||||
if(A in real_location)
|
||||
usr = null
|
||||
remove_from_storage(A, null)
|
||||
|
||||
/datum/component/storage/concrete/proc/on_deconstruct(disassembled)
|
||||
if(drop_all_on_deconstruct)
|
||||
do_quick_empty()
|
||||
|
||||
/datum/component/storage/concrete/can_see_contents()
|
||||
. = ..()
|
||||
for(var/i in slaves)
|
||||
var/datum/component/storage/slave = i
|
||||
. |= slave.can_see_contents()
|
||||
|
||||
//Resets screen loc and other vars of something being removed from storage.
|
||||
/datum/component/storage/concrete/_removal_reset(atom/movable/thing)
|
||||
thing.layer = initial(thing.layer)
|
||||
thing.plane = initial(thing.plane)
|
||||
thing.mouse_opacity = initial(thing.mouse_opacity)
|
||||
if(thing.maptext)
|
||||
thing.maptext = ""
|
||||
|
||||
/datum/component/storage/concrete/remove_from_storage(atom/movable/AM, atom/new_location)
|
||||
//Cache this as it should be reusable down the bottom, will not apply if anyone adds a sleep to dropped
|
||||
//or moving objects, things that should never happen
|
||||
var/atom/parent = src.parent
|
||||
var/list/seeing_mobs = can_see_contents()
|
||||
for(var/mob/M in seeing_mobs)
|
||||
M.client.screen -= AM
|
||||
if(ismob(parent.loc) && isitem(AM))
|
||||
var/obj/item/I = AM
|
||||
var/mob/M = parent.loc
|
||||
I.dropped(M)
|
||||
if(new_location)
|
||||
//Reset the items values
|
||||
_removal_reset(AM)
|
||||
AM.forceMove(new_location)
|
||||
//We don't want to call this if the item is being destroyed
|
||||
AM.on_exit_storage(src)
|
||||
else
|
||||
//Being destroyed, just move to nullspace now (so it's not in contents for the icon update)
|
||||
AM.moveToNullspace()
|
||||
refresh_mob_views()
|
||||
if(isobj(parent))
|
||||
var/obj/O = parent
|
||||
O.update_icon()
|
||||
return TRUE
|
||||
|
||||
/datum/component/storage/concrete/proc/slave_can_insert_object(datum/component/storage/slave, obj/item/I, stop_messages = FALSE, mob/M)
|
||||
return TRUE
|
||||
|
||||
/datum/component/storage/concrete/proc/handle_item_insertion_from_slave(datum/component/storage/slave, obj/item/I, prevent_warning = FALSE, M)
|
||||
. = handle_item_insertion(I, prevent_warning, M, slave)
|
||||
if(. && !prevent_warning)
|
||||
slave.mob_item_insertion_feedback(usr, M, I)
|
||||
|
||||
/datum/component/storage/concrete/handle_item_insertion(obj/item/I, prevent_warning = FALSE, mob/M, datum/component/storage/remote) //Remote is null or the slave datum
|
||||
var/datum/component/storage/concrete/master = master()
|
||||
var/atom/parent = src.parent
|
||||
var/moved = FALSE
|
||||
if(!istype(I))
|
||||
return FALSE
|
||||
if(M)
|
||||
if(!M.temporarilyRemoveItemFromInventory(I))
|
||||
return FALSE
|
||||
else
|
||||
moved = TRUE //At this point if the proc fails we need to manually move the object back to the turf/mob/whatever.
|
||||
if(I.pulledby)
|
||||
I.pulledby.stop_pulling()
|
||||
if(silent)
|
||||
prevent_warning = TRUE
|
||||
if(!_insert_physical_item(I))
|
||||
if(moved)
|
||||
if(M)
|
||||
if(!M.put_in_active_hand(I))
|
||||
I.forceMove(parent.drop_location())
|
||||
else
|
||||
I.forceMove(parent.drop_location())
|
||||
return FALSE
|
||||
I.on_enter_storage(master)
|
||||
refresh_mob_views()
|
||||
I.mouse_opacity = MOUSE_OPACITY_OPAQUE //So you can click on the area around the item to equip it, instead of having to pixel hunt
|
||||
if(M)
|
||||
if(M.client && M.active_storage != src)
|
||||
M.client.screen -= I
|
||||
if(M.observers && M.observers.len)
|
||||
for(var/i in M.observers)
|
||||
var/mob/dead/observe = i
|
||||
if(observe.client && observe.active_storage != src)
|
||||
observe.client.screen -= I
|
||||
if(!remote)
|
||||
parent.add_fingerprint(M)
|
||||
if(!prevent_warning)
|
||||
mob_item_insertion_feedback(usr, M, I)
|
||||
update_icon()
|
||||
return TRUE
|
||||
|
||||
/datum/component/storage/concrete/update_icon()
|
||||
if(isobj(parent))
|
||||
var/obj/O = parent
|
||||
O.update_icon()
|
||||
for(var/i in slaves)
|
||||
var/datum/component/storage/slave = i
|
||||
slave.update_icon()
|
||||
@@ -0,0 +1,22 @@
|
||||
/datum/component/storage/concrete/bluespace/bag_of_holding/handle_item_insertion(obj/item/W, prevent_warning = FALSE, mob/living/user)
|
||||
var/atom/A = parent
|
||||
if((istype(W, /obj/item/storage/backpack/holding) || count_by_type(W.GetAllContents(), /obj/item/storage/backpack/holding)))
|
||||
var/turf/loccheck = get_turf(A)
|
||||
if(is_reebe(loccheck.z))
|
||||
user.visible_message("<span class='warning'>An unseen force knocks [user] to the ground!</span>", "<span class='big_brass'>\"I think not!\"</span>")
|
||||
user.Knockdown(60)
|
||||
return
|
||||
var/safety = alert(user, "Doing this will have extremely dire consequences for the station and its crew. Be sure you know what you're doing.", "Put in [A.name]?", "Proceed", "Abort")
|
||||
if(safety == "Abort" || !in_range(A, user) || !A || !W || user.incapacitated())
|
||||
return
|
||||
A.investigate_log("has become a singularity. Caused by [user.key]", INVESTIGATE_SINGULO)
|
||||
to_chat(user, "<span class='danger'>The Bluespace interfaces of the two devices catastrophically malfunction!</span>")
|
||||
qdel(W)
|
||||
var/obj/singularity/singulo = new /obj/singularity (get_turf(A))
|
||||
singulo.energy = 300 //should make it a bit bigger~
|
||||
message_admins("[key_name_admin(user)] detonated a bag of holding")
|
||||
log_game("[key_name(user)] detonated a bag of holding")
|
||||
qdel(A)
|
||||
singulo.process()
|
||||
return
|
||||
. = ..()
|
||||
@@ -0,0 +1,21 @@
|
||||
/datum/component/storage/concrete/bluespace
|
||||
var/dumping_range = 8
|
||||
var/dumping_sound = 'sound/items/pshoom.ogg'
|
||||
var/alt_sound = 'sound/items/pshoom_2.ogg'
|
||||
|
||||
/datum/component/storage/concrete/bluespace/dump_content_at(atom/dest, mob/M)
|
||||
var/atom/A = parent
|
||||
if(A.Adjacent(M))
|
||||
var/atom/dumping_location = dest.get_dumping_location()
|
||||
if(get_dist(M, dumping_location) < dumping_range)
|
||||
if(dumping_location.storage_contents_dump_act(src, M))
|
||||
if(alt_sound && prob(1))
|
||||
playsound(src, alt_sound, 40, 1)
|
||||
else
|
||||
playsound(src, dumping_sound, 40, 1)
|
||||
M.Beam(dumping_location, icon_state="rped_upgrade", time=5)
|
||||
return TRUE
|
||||
to_chat(M, "The [A.name] buzzes.")
|
||||
playsound(src, 'sound/machines/buzz-sigh.ogg', 50, 0)
|
||||
return FALSE
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/datum/component/storage/concrete/implant
|
||||
max_w_class = WEIGHT_CLASS_NORMAL
|
||||
max_combined_w_class = 6
|
||||
max_items = 2
|
||||
drop_all_on_destroy = TRUE
|
||||
drop_all_on_deconstruct = TRUE
|
||||
silent = TRUE
|
||||
|
||||
/datum/component/storage/concrete/implant/Initialize()
|
||||
. = ..()
|
||||
cant_hold = typecacheof(list(/obj/item/disk/nuclear))
|
||||
|
||||
/datum/component/storage/concrete/implant/InheritComponent(datum/component/storage/concrete/implant/I, original)
|
||||
if(!istype(I))
|
||||
return ..()
|
||||
max_combined_w_class += I.max_combined_w_class
|
||||
max_items += I.max_items
|
||||
@@ -0,0 +1,65 @@
|
||||
/datum/component/storage/concrete/pockets
|
||||
max_items = 2
|
||||
max_w_class = WEIGHT_CLASS_SMALL
|
||||
max_combined_w_class = 50
|
||||
rustle_sound = FALSE
|
||||
|
||||
/datum/component/storage/concrete/pockets/handle_item_insertion(obj/item/I, prevent_warning, mob/user)
|
||||
. = ..()
|
||||
if(. && silent && !prevent_warning)
|
||||
if(quickdraw)
|
||||
to_chat(user, "<span class='notice'>You discreetly slip [I] into [parent]. Alt-click [parent] to remove it.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You discreetly slip [I] into [parent].</span>")
|
||||
|
||||
/datum/component/storage/concrete/pockets
|
||||
max_w_class = WEIGHT_CLASS_NORMAL
|
||||
|
||||
/datum/component/storage/concrete/pockets/small
|
||||
max_items = 1
|
||||
attack_hand_interact = FALSE
|
||||
|
||||
/datum/component/storage/concrete/pockets/tiny
|
||||
max_items = 1
|
||||
max_w_class = WEIGHT_CLASS_TINY
|
||||
attack_hand_interact = FALSE
|
||||
|
||||
/datum/component/storage/concrete/pockets/small/detective
|
||||
attack_hand_interact = TRUE // so the detectives would discover pockets in their hats
|
||||
|
||||
/datum/component/storage/concrete/pockets/shoes
|
||||
attack_hand_interact = FALSE
|
||||
quickdraw = TRUE
|
||||
silent = TRUE
|
||||
|
||||
/datum/component/storage/concrete/pockets/shoes/Initialize()
|
||||
. = ..()
|
||||
can_hold = typecacheof(list(
|
||||
/obj/item/kitchen/knife, /obj/item/switchblade, /obj/item/pen,
|
||||
/obj/item/scalpel, /obj/item/reagent_containers/syringe, /obj/item/dnainjector,
|
||||
/obj/item/reagent_containers/hypospray/medipen, /obj/item/reagent_containers/dropper,
|
||||
/obj/item/implanter, /obj/item/screwdriver, /obj/item/weldingtool/mini,
|
||||
/obj/item/device/firing_pin
|
||||
))
|
||||
|
||||
/datum/component/storage/concrete/pockets/shoes/clown/Initialize()
|
||||
. = ..()
|
||||
can_hold = typecacheof(list(
|
||||
/obj/item/kitchen/knife, /obj/item/switchblade, /obj/item/pen,
|
||||
/obj/item/scalpel, /obj/item/reagent_containers/syringe, /obj/item/dnainjector,
|
||||
/obj/item/reagent_containers/hypospray/medipen, /obj/item/reagent_containers/dropper,
|
||||
/obj/item/implanter, /obj/item/screwdriver, /obj/item/weldingtool/mini,
|
||||
/obj/item/device/firing_pin, /obj/item/bikehorn))
|
||||
|
||||
/datum/component/storage/concrete/pockets/pocketprotector
|
||||
max_items = 3
|
||||
max_w_class = WEIGHT_CLASS_TINY
|
||||
|
||||
/datum/component/storage/concrete/pockets/pocketprotector/Initialize()
|
||||
. = ..()
|
||||
can_hold = typecacheof(list( //Same items as a PDA
|
||||
/obj/item/pen,
|
||||
/obj/item/toy/crayon,
|
||||
/obj/item/lipstick,
|
||||
/obj/item/device/flashlight/pen,
|
||||
/obj/item/clothing/mask/cigarette))
|
||||
@@ -0,0 +1,31 @@
|
||||
/datum/component/storage/concrete/rped
|
||||
collection_mode = COLLECT_EVERYTHING
|
||||
allow_quick_gather = TRUE
|
||||
allow_quick_empty = TRUE
|
||||
click_gather = TRUE
|
||||
max_w_class = WEIGHT_CLASS_NORMAL
|
||||
max_combined_w_class = 100
|
||||
max_items = 50
|
||||
display_numerical_stacking = TRUE
|
||||
|
||||
/datum/component/storage/concrete/rped/can_be_inserted(obj/item/I, stop_messages, mob/M)
|
||||
. = ..()
|
||||
if(!I.get_part_rating() && !stop_messages)
|
||||
to_chat(M, "<span class='warning'>[parent] only accepts machine parts!</span>")
|
||||
return FALSE
|
||||
|
||||
/datum/component/storage/concrete/bluespace/rped
|
||||
collection_mode = COLLECT_EVERYTHING
|
||||
allow_quick_gather = TRUE
|
||||
allow_quick_empty = TRUE
|
||||
click_gather = TRUE
|
||||
max_w_class = WEIGHT_CLASS_NORMAL
|
||||
max_combined_w_class = 800
|
||||
max_items = 400
|
||||
display_numerical_stacking = TRUE
|
||||
|
||||
/datum/component/storage/concrete/bluespace/rped/can_be_inserted(obj/item/I, stop_messages, mob/M)
|
||||
. = ..()
|
||||
if(!I.get_part_rating() && !stop_messages)
|
||||
to_chat(M, "<span class='warning'>[parent] only accepts machine parts!</span>")
|
||||
return FALSE
|
||||
@@ -0,0 +1,5 @@
|
||||
/datum/component/storage/concrete/secret_satchel/can_be_inserted(I,msg,user)
|
||||
if(SSpersistence.spawned_objects[I])
|
||||
to_chat(user, "<span class='warning'>[I] is unstable after its journey through space and time, it wouldn't survive another trip.</span>")
|
||||
return FALSE
|
||||
return ..()
|
||||
@@ -0,0 +1,67 @@
|
||||
//Stack-only storage.
|
||||
/datum/component/storage/concrete/stack
|
||||
display_numerical_stacking = TRUE
|
||||
var/max_combined_stack_amount = 300
|
||||
max_w_class = WEIGHT_CLASS_NORMAL
|
||||
max_combined_w_class = WEIGHT_CLASS_NORMAL * 14
|
||||
|
||||
/datum/component/storage/concrete/stack/proc/total_stack_amount()
|
||||
. = 0
|
||||
var/atom/real_location = real_location()
|
||||
for(var/i in real_location)
|
||||
var/obj/item/stack/S = i
|
||||
if(!istype(S))
|
||||
continue
|
||||
. += S.amount
|
||||
|
||||
/datum/component/storage/concrete/stack/proc/remaining_space()
|
||||
return max(0, max_combined_stack_amount - total_stack_amount())
|
||||
|
||||
//emptying procs do not need modification as stacks automatically merge.
|
||||
|
||||
/datum/component/storage/concrete/stack/_insert_physical_item(obj/item/I, override = FALSE)
|
||||
if(!istype(I, /obj/item/stack))
|
||||
if(override)
|
||||
return ..()
|
||||
return FALSE
|
||||
var/atom/real_location = real_location()
|
||||
var/obj/item/stack/S = I
|
||||
var/can_insert = min(S.amount, remaining_space())
|
||||
if(!can_insert)
|
||||
return FALSE
|
||||
for(var/i in real_location) //combine.
|
||||
if(QDELETED(I))
|
||||
return
|
||||
var/obj/item/stack/_S = i
|
||||
if(!istype(_S))
|
||||
continue
|
||||
if(_S.merge_type == S.merge_type)
|
||||
_S.add(can_insert)
|
||||
S.use(can_insert, TRUE)
|
||||
return TRUE
|
||||
return ..(S.change_stack(null, can_insert), override)
|
||||
|
||||
/datum/component/storage/concrete/stack/remove_from_storage(obj/item/I, atom/new_location)
|
||||
var/atom/real_location = real_location()
|
||||
var/obj/item/stack/S = I
|
||||
if(!istype(S))
|
||||
return ..()
|
||||
if(S.amount > S.max_amount)
|
||||
var/overrun = S.amount - S.max_amount
|
||||
S.amount = S.max_amount
|
||||
var/obj/item/stack/temp = new S.type(real_location, overrun)
|
||||
handle_item_insertion(temp)
|
||||
return ..(S, new_location)
|
||||
|
||||
/datum/component/storage/concrete/stack/_process_numerical_display()
|
||||
var/atom/real_location = real_location()
|
||||
. = list()
|
||||
for(var/i in real_location)
|
||||
var/obj/item/stack/I = i
|
||||
if(!istype(I) || QDELETED(I)) //We're specialized stack storage, just ignore non stacks.
|
||||
continue
|
||||
if(!.[I.merge_type])
|
||||
.[I.merge_type] = new /datum/numbered_display(I, I.amount)
|
||||
else
|
||||
var/datum/numbered_display/ND = .[I.merge_type]
|
||||
ND.number += I.amount
|
||||
@@ -60,7 +60,7 @@
|
||||
|
||||
/datum/component/storage/Initialize(datum/component/storage/concrete/master)
|
||||
if(!isatom(parent))
|
||||
. = COMPONENT_INCOMPATIBLE
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
if(master)
|
||||
change_master(master)
|
||||
boxes = new(null, src)
|
||||
@@ -727,4 +727,4 @@
|
||||
if(COLLECT_EVERYTHING)
|
||||
to_chat(user, "[parent] now picks up all items in a tile at once.")
|
||||
if(COLLECT_ONE)
|
||||
to_chat(user, "[parent] now picks up one item at a time.")
|
||||
to_chat(user, "[parent] now picks up one item at a time.")
|
||||
@@ -3,21 +3,21 @@
|
||||
var/amount
|
||||
var/overlay
|
||||
|
||||
var/static/list/blacklist = typecacheof(
|
||||
var/static/list/blacklist = typecacheof(list(
|
||||
/turf/open/lava,
|
||||
/turf/open/space,
|
||||
/turf/open/water,
|
||||
/turf/open/chasm,
|
||||
/turf/open/chasm)
|
||||
)
|
||||
|
||||
var/static/list/immunelist = typecacheof(
|
||||
var/static/list/immunelist = typecacheof(list(
|
||||
/turf/closed/wall/mineral/diamond,
|
||||
/turf/closed/indestructible,
|
||||
/turf/open/indestructible,
|
||||
/turf/open/indestructible)
|
||||
)
|
||||
|
||||
var/static/list/resistlist = typecacheof(
|
||||
/turf/closed/wall/r_wall,
|
||||
/turf/closed/wall/r_wall
|
||||
)
|
||||
|
||||
/datum/component/thermite/Initialize(_amount)
|
||||
|
||||
Reference in New Issue
Block a user