Merge pull request #3159 from Citadel-Station-13/upstream-merge-30525

[MIRROR] Adds H.E.C.K. suits, spraycan_paintable component, and reworks item's attackby()
This commit is contained in:
LetterJay
2017-10-06 02:12:06 -04:00
committed by GitHub
11 changed files with 137 additions and 47 deletions
+2 -4
View File
@@ -4,9 +4,7 @@
/obj/effect
icon = 'icons/effects/effects.dmi'
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF
/obj/effect/attackby(obj/item/I, mob/living/user, params)
return
can_be_hit = FALSE
/obj/effect/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir)
return
@@ -57,4 +55,4 @@
return
/obj/effect/abstract/singularity_act()
return
return
+6
View File
@@ -26,6 +26,8 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
max_integrity = 200
can_be_hit = FALSE
var/hitsound = null
var/usesound = null
var/throwhitsound = null
@@ -322,6 +324,7 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
// Due to storage type consolidation this should get used more now.
// I have cleaned it up a little, but it could probably use more. -Sayu
// The lack of ..() is intentional, do not add one
// added one, fuck the police
/obj/item/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/storage))
var/obj/item/storage/S = W
@@ -346,9 +349,12 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
qdel(progress)
to_chat(user, "<span class='notice'>You put everything you could [S.preposition] [S].</span>")
return
else if(S.can_be_inserted(src))
S.handle_item_insertion(src)
return
return ..()
/obj/item/proc/handle_mass_pickup(obj/item/storage/S, list/things, atom/thing_loc, list/rejections, datum/progressbar/progress)
for(var/obj/item/I in things)
+17 -15
View File
@@ -107,20 +107,19 @@
var/amount = weight * units_per_weight
reagents.add_reagent(reagent, amount)
/obj/item/toy/crayon/proc/use_charges(amount)
/obj/item/toy/crayon/proc/use_charges(mob/user, amount = 1, requires_full = TRUE)
// Returns number of charges actually used
switch(paint_mode)
if(PAINT_LARGE_HORIZONTAL)
amount *= 3
if(charges == -1)
. = amount
refill()
else
. = min(charges_left, amount)
charges_left -= .
if(check_empty(user, amount, requires_full))
return 0
else
. = min(charges_left, amount)
charges_left -= .
/obj/item/toy/crayon/proc/check_empty(mob/user)
/obj/item/toy/crayon/proc/check_empty(mob/user, amount = 1, requires_full = TRUE)
// When eating a crayon, check_empty() can be called twice producing
// two messages unless we check for being deleted first
if(QDELETED(src))
@@ -131,10 +130,13 @@
if(charges == -1)
. = FALSE
else if(!charges_left)
to_chat(user, "<span class='warning'>There is no more of \the [src.name] left!</span>")
to_chat(user, "<span class='warning'>There is no more of [src] left!</span>")
if(self_contained)
qdel(src)
. = TRUE
else if(charges_left < amount && requires_full)
to_chat(user, "<span class='warning'>There is not enough of [src] left!</span>")
. = TRUE
/obj/item/toy/crayon/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.hands_state)
// tgui is a plague upon this codebase
@@ -298,7 +300,7 @@
var/takes_time = !instant
var/wait_time = 50
if(PAINT_LARGE_HORIZONTAL)
if(paint_mode == PAINT_LARGE_HORIZONTAL)
wait_time *= 3
if(takes_time)
@@ -343,7 +345,7 @@
var/cost = 1
if(paint_mode == PAINT_LARGE_HORIZONTAL)
cost = 5
. = use_charges(cost)
. = use_charges(user, cost)
var/fraction = min(1, . / reagents.maximum_volume)
if(affected_turfs.len)
fraction /= affected_turfs.len
@@ -355,7 +357,7 @@
/obj/item/toy/crayon/attack(mob/M, mob/user)
if(edible && (M == user))
to_chat(user, "You take a bite of the [src.name]. Delicious!")
var/eaten = use_charges(5)
var/eaten = use_charges(user, 5, FALSE)
if(check_empty(user)) //Prevents divsion by zero
return
var/fraction = min(eaten / reagents.total_volume, 1)
@@ -527,7 +529,7 @@
H.lip_style = "spray_face"
H.lip_color = paint_color
H.update_body()
var/used = use_charges(10)
var/used = use_charges(user, 10, FALSE)
var/fraction = min(1, used / reagents.maximum_volume)
reagents.reaction(user, VAPOR, fraction * volume_multiplier)
reagents.trans_to(user, used, volume_multiplier)
@@ -583,7 +585,7 @@
H.update_body()
// Caution, spray cans contain inflammable substances
. = use_charges(10)
. = use_charges(user, 10, FALSE)
var/fraction = min(1, . / reagents.maximum_volume)
reagents.reaction(C, VAPOR, fraction * volume_multiplier)
@@ -596,7 +598,7 @@
target.set_opacity(255)
else
target.set_opacity(initial(target.opacity))
. = use_charges(2)
. = use_charges(user, 2)
var/fraction = min(1, . / reagents.maximum_volume)
reagents.reaction(target, TOUCH, fraction * volume_multiplier)
reagents.trans_to(target, ., volume_multiplier)
+1
View File
@@ -13,6 +13,7 @@
var/integrity_failure = 0 //0 if we have no special broken behavior
var/resistance_flags = 0 // INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | ON_FIRE | UNACIDABLE | ACID_PROOF
var/can_be_hit = TRUE //can this be bludgeoned by items?
var/acid_level = 0 //how much acid is on that obj