Merge branch 'master' into upstream-merge-37597

This commit is contained in:
LetterJay
2018-05-22 07:21:53 -05:00
committed by GitHub
661 changed files with 12019 additions and 10559 deletions
+78
View File
@@ -0,0 +1,78 @@
/datum/component/armor_plate
var/amount = 0
var/maxamount = 3
var/upgrade_item = /obj/item/stack/sheet/animalhide/goliath_hide
var/datum/armor/added_armor = list("melee" = 10)
var/upgrade_name
/datum/component/armor_plate/Initialize(_maxamount,obj/item/_upgrade_item,datum/armor/_added_armor)
if(!isobj(parent))
return COMPONENT_INCOMPATIBLE
RegisterSignal(COMSIG_PARENT_EXAMINE, .proc/examine)
RegisterSignal(COMSIG_PARENT_ATTACKBY, .proc/applyplate)
RegisterSignal(COMSIG_PARENT_PREQDELETED, .proc/dropplates)
if(_maxamount)
maxamount = _maxamount
if(_upgrade_item)
upgrade_item = _upgrade_item
if(_added_armor)
if(islist(_added_armor))
added_armor = getArmor(arglist(_added_armor))
else if (istype(_added_armor, /datum/armor))
added_armor = _added_armor
else
stack_trace("Invalid type [_added_armor.type] passed as _armor_item argument to armorplate component")
else
added_armor = getArmor(arglist(added_armor))
var/obj/item/typecast = upgrade_item
upgrade_name = initial(typecast.name)
/datum/component/armor_plate/proc/examine(mob/user)
//upgrade_item could also be typecast here instead
if(ismecha(parent))
if(amount)
if(amount < maxamount)
to_chat(user, "<span class='notice'>Its armor is enhanced with [amount] [upgrade_name].</span>")
else
to_chat(user, "<span class='notice'>It's wearing a fearsome carapace entirely composed of [upgrade_name] - its pilot must be an experienced monster hunter.</span>")
else
to_chat(user, "<span class='notice'>It has attachment points for strapping monster hide on for added protection.</span>")
else
if(amount)
to_chat(user, "<span class='notice'>It has been strengthened with [amount]/[maxamount] [upgrade_name].</span>")
else
to_chat(user, "<span class='notice'>It can be strengthened with up to [maxamount] [upgrade_name].</span>")
/datum/component/armor_plate/proc/applyplate(obj/item/I, mob/user, params)
if(!istype(I,upgrade_item))
return
if(amount >= maxamount)
to_chat(user, "<span class='warning'>You can't improve [parent] any further!</span>")
return
if(istype(I,/obj/item/stack))
I.use(1)
else
if(length(I.contents))
to_chat(user, "<span class='warning'>[I] cannot be used for armoring while there's something inside!</span>")
return
qdel(I)
var/obj/O = parent
amount++
O.armor = O.armor.attachArmor(added_armor)
if(ismecha(O))
var/obj/mecha/R = O
R.update_icon()
to_chat(user, "<span class='info'>You strengthen [R], improving its resistance against melee, bullet and laser damage.</span>")
else
to_chat(user, "<span class='info'>You strengthen [O], improving its resistance against melee attacks.</span>")
/datum/component/armor_plate/proc/dropplates(force)
if(ismecha(parent)) //items didn't drop the plates before and it causes erroneous behavior for the time being with collapsible helmets
for(var/i in 1 to amount)
new upgrade_item(get_turf(parent))
+11 -6
View File
@@ -15,16 +15,18 @@
var/sheet_type
var/list/materials
var/show_on_examine
var/disable_attackby
var/list/allowed_typecache
var/last_inserted_id
var/precise_insertion = FALSE
var/datum/callback/precondition
var/datum/callback/after_insert
/datum/component/material_container/Initialize(list/mat_list, max_amt = 0, _show_on_examine = FALSE, list/allowed_types, datum/callback/_precondition, datum/callback/_after_insert)
/datum/component/material_container/Initialize(list/mat_list, max_amt = 0, _show_on_examine = FALSE, list/allowed_types, datum/callback/_precondition, datum/callback/_after_insert, _disable_attackby)
materials = list()
max_amount = max(0, max_amt)
show_on_examine = _show_on_examine
disable_attackby = _disable_attackby
if(allowed_types)
allowed_typecache = typecacheof(allowed_types)
precondition = _precondition
@@ -43,14 +45,17 @@
materials[id] = new mat_path()
/datum/component/material_container/proc/OnExamine(mob/user)
for(var/I in materials)
var/datum/material/M = materials[I]
var/amt = amount(M.id)
if(amt)
to_chat(user, "<span class='notice'>It has [amt] units of [lowertext(M.name)] stored.</span>")
if(show_on_examine)
for(var/I in materials)
var/datum/material/M = materials[I]
var/amt = amount(M.id)
if(amt)
to_chat(user, "<span class='notice'>It has [amt] units of [lowertext(M.name)] stored.</span>")
/datum/component/material_container/proc/OnAttackBy(obj/item/I, mob/living/user)
var/list/tc = allowed_typecache
if(disable_attackby)
return
if(user.a_intent != INTENT_HELP)
return
if((I.flags_1 & HOLOGRAM_1) || (I.item_flags & NO_MAT_REDEMPTION) || (tc && !is_type_in_typecache(I, tc)))
+6 -1
View File
@@ -1,9 +1,14 @@
/datum/component/redirect
dupe_mode = COMPONENT_DUPE_ALLOWED
/datum/component/redirect/Initialize(list/signals, datum/callback/_callback)
/datum/component/redirect/Initialize(list/signals, datum/callback/_callback, flags=NONE)
//It's not our job to verify the right signals are registered here, just do it.
if(!LAZYLEN(signals) || !istype(_callback))
warning("signals are [list2params(signals)], callback is [_callback]]")
return COMPONENT_INCOMPATIBLE
if(flags & REDIRECT_TRANSFER_WITH_TURF && isturf(parent))
RegisterSignal(COMSIG_TURF_CHANGE, .proc/turf_change)
RegisterSignal(signals, _callback)
/datum/component/redirect/proc/turf_change(path, new_baseturfs, flags, list/transfers)
transfers += src
+1 -7
View File
@@ -28,13 +28,7 @@
CRASH("Unable to find a blobstart landmark")
var/atom/movable/AM = parent
if(ismob(AM.loc))
var/mob/M = AM.loc
M.transferItemToLoc(AM, targetturf, TRUE) //nodrops disks when?
else if(AM.loc.SendSignal(COMSIG_CONTAINS_STORAGE))
AM.loc.SendSignal(COMSIG_TRY_STORAGE_TAKE, src, targetturf, TRUE)
else
AM.forceMove(targetturf)
AM.forceMove(targetturf)
// move the disc, so ghosts remain orbiting it even if it's "destroyed"
return targetturf
@@ -73,6 +73,8 @@
slave.refresh_mob_views()
/datum/component/storage/concrete/emp_act(severity)
if(emp_shielded)
return
var/atom/real_location = real_location()
for(var/i in real_location)
var/atom/A = i
+24 -16
View File
@@ -87,7 +87,8 @@
RegisterSignal(COMSIG_ATOM_ATTACK_PAW, .proc/on_attack_hand)
RegisterSignal(COMSIG_ATOM_EMP_ACT, .proc/emp_act)
RegisterSignal(COMSIG_ATOM_ATTACK_GHOST, .proc/show_to_ghost)
RegisterSignal(COMSIG_ATOM_EXITED, .proc/_removal_reset)
RegisterSignal(COMSIG_ATOM_ENTERED, .proc/refresh_mob_views)
RegisterSignal(COMSIG_ATOM_EXITED, .proc/_remove_and_refresh)
RegisterSignal(COMSIG_ITEM_PRE_ATTACK, .proc/preattack_intercept)
RegisterSignal(COMSIG_ITEM_ATTACK_SELF, .proc/attack_self)
@@ -232,13 +233,15 @@
stoplag(1)
qdel(progress)
/datum/component/storage/proc/mass_remove_from_storage(atom/target, list/things, datum/progressbar/progress)
/datum/component/storage/proc/mass_remove_from_storage(atom/target, list/things, datum/progressbar/progress, trigger_on_found = TRUE)
var/atom/real_location = real_location()
for(var/obj/item/I in things)
things -= I
if(I.loc != real_location)
continue
remove_from_storage(I, target)
if(trigger_on_found && I.on_found())
return FALSE
if(TICK_CHECK)
progress.update(progress.goal - length(things))
return TRUE
@@ -367,10 +370,10 @@
. = TRUE //returns TRUE if any mobs actually got a close(M) call
/datum/component/storage/proc/emp_act(severity)
var/atom/A = parent
if(!isliving(A.loc) && !emp_shielded)
var/datum/component/storage/concrete/master = master()
master.emp_act(severity)
if(emp_shielded)
return
var/datum/component/storage/concrete/master = master()
master.emp_act(severity)
//This proc draws out the inventory and places the items on it. tx and ty are the upper left tile and mx, my are the bottm right.
//The numbers are calculated from the bottom-left The bottom-left slot being 1,1.
@@ -400,6 +403,10 @@
return FALSE
return master._removal_reset(thing)
/datum/component/storage/proc/_remove_and_refresh(atom/movable/thing)
_removal_reset(thing)
refresh_mob_views()
//Call this proc to handle the removal of an item from the storage item. The item will be moved to the new_location target, if that is null it's being deleted
/datum/component/storage/proc/remove_from_storage(atom/movable/AM, atom/new_location)
if(!istype(AM))
@@ -453,23 +460,24 @@
return FALSE
handle_item_insertion(I, FALSE, M)
/datum/component/storage/proc/return_inv()
. = list()
. += contents()
for(var/i in contents())
var/atom/a = i
GET_COMPONENT_FROM(STR, /datum/component/storage, a)
if(STR)
. += STR.return_inv()
/datum/component/storage/proc/return_inv(recursive)
var/list/ret = list()
ret |= contents()
if(recursive)
for(var/i in ret.Copy())
var/atom/A = i
A.SendSignal(COMSIG_TRY_STORAGE_RETURN_INVENTORY, ret, TRUE)
return ret
/datum/component/storage/proc/contents() //ONLY USE IF YOU NEED TO COPY CONTENTS OF REAL LOCATION, COPYING IS NOT AS FAST AS DIRECT ACCESS!
var/atom/real_location = real_location()
return real_location.contents.Copy()
/datum/component/storage/proc/signal_return_inv(list/interface)
//Abuses the fact that lists are just references, or something like that.
/datum/component/storage/proc/signal_return_inv(list/interface, recursive = TRUE)
if(!islist(interface))
return FALSE
interface |= return_inv()
interface |= return_inv(recursive)
return TRUE
/datum/component/storage/proc/mousedrop_onto(atom/over_object, mob/M)