Merge pull request #8846 from Ghommie/Ghommie-cit122

Rubber toolboxes.
This commit is contained in:
kevinz000
2019-07-12 07:35:25 -07:00
committed by GitHub
9 changed files with 111 additions and 14 deletions
+8 -6
View File
@@ -1239,19 +1239,21 @@ GLOBAL_REAL_VAR(list/stack_trace_storage)
pixel_x = initialpixelx
pixel_y = initialpixely
/atom/proc/do_jiggle(targetangle = 45)
/atom/proc/do_jiggle(targetangle = 45, timer = 20)
var/matrix/OM = matrix(transform)
var/matrix/M = matrix(transform)
var/halftime = timer * 0.5
M.Turn(pick(-targetangle, targetangle))
animate(src, transform = M, time = 10, easing = ELASTIC_EASING)
animate(src, transform = OM, time = 10, easing = ELASTIC_EASING)
animate(src, transform = M, time = halftime, easing = ELASTIC_EASING)
animate(src, transform = OM, time = halftime, easing = ELASTIC_EASING)
/atom/proc/do_squish(squishx = 1.2, squishy = 0.6)
/atom/proc/do_squish(squishx = 1.2, squishy = 0.6, timer = 20)
var/matrix/OM = matrix(transform)
var/matrix/M = matrix(transform)
var/halftime = timer * 0.5
M.Scale(squishx, squishy)
animate(src, transform = M, time = 10, easing = BOUNCE_EASING)
animate(src, transform = OM, time = 10, easing = BOUNCE_EASING)
animate(src, transform = M, time = halftime, easing = BOUNCE_EASING)
animate(src, transform = OM, time = halftime, easing = BOUNCE_EASING)
/proc/weightclass2text(var/w_class)
switch(w_class)
+40
View File
@@ -0,0 +1,40 @@
/datum/component/bouncy
dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS
var/bouncy_mod = 1
var/list/bounce_signals = list(COMSIG_MOVABLE_IMPACT, COMSIG_ITEM_HIT_REACT, COMSIG_ITEM_ATTACK)
/datum/component/bouncy/Initialize(_bouncy_mod, list/_bounce_signals)
if(!ismovableatom(parent))
return COMPONENT_INCOMPATIBLE
if(_bouncy_mod)
bouncy_mod = _bouncy_mod
if(_bounce_signals)
bounce_signals = _bounce_signals
/datum/component/bouncy/InheritComponent(datum/component/bouncy/B, original, _bouncy_mod, list/_bounce_signals)
if(_bouncy_mod)
bouncy_mod = max(bouncy_mod, _bouncy_mod)
if(_bounce_signals)
var/list/diff_bounces = difflist(bounce_signals, _bounce_signals, TRUE)
for(var/bounce in diff_bounces)
bounce_signals += bounce
RegisterSignal(parent, bounce, .proc/bounce_up)
/datum/component/bouncy/RegisterWithParent()
RegisterSignal(parent, bounce_signals, .proc/bounce_up)
/datum/component/bouncy/UnregisterFromParent()
UnregisterSignal(parent, bounce_signals)
/datum/component/bouncy/proc/bounce_up(datum/source)
var/atom/movable/A = parent
switch(rand(1, 3))
if(1)
A.do_jiggle(45 + rand(-10, 10) * bouncy_mod, 14)
if(2)
var/min_b = 0.6/bouncy_mod
var/max_b = 1.2 * bouncy_mod
A.do_squish(rand(min_b, max_b), rand(min_b, max_b), 14)
if(3)
var/pixelshift = 8 * bouncy_mod
A.Shake(pixelshift, pixelshift, duration = 15)
+1 -1
View File
@@ -8,7 +8,7 @@
name = "artistic toolbox"
desc = "A toolbox painted bright green. Looking at it makes you feel uneasy."
icon_state = "his_grace"
item_state = "artistic_toolbox"
item_state = "toolbox_green"
lefthand_file = 'icons/mob/inhands/equipment/toolbox_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/toolbox_righthand.dmi'
icon = 'icons/obj/items_and_weapons.dmi'
+60 -6
View File
@@ -1,3 +1,5 @@
GLOBAL_LIST_EMPTY(rubber_toolbox_icons)
/obj/item/storage/toolbox
name = "toolbox"
desc = "Danger. Very robust."
@@ -16,21 +18,25 @@
hitsound = 'sound/weapons/smash.ogg'
var/latches = "single_latch"
var/has_latches = TRUE
var/can_rubberify = TRUE
/obj/item/storage/toolbox/Initialize()
/obj/item/storage/toolbox/Initialize(mapload)
. = ..()
if(has_latches)
if(prob(10))
latches = "double_latch"
if(prob(1))
latches = "triple_latch"
if(mapload && can_rubberify && prob(5))
rubberify()
update_icon()
/obj/item/storage/toolbox/update_icon()
..()
cut_overlays()
if(has_latches)
add_overlay(latches)
var/icon/I = icon('icons/obj/storage.dmi', latches)
add_overlay(I)
/obj/item/storage/toolbox/suicide_act(mob/user)
@@ -39,8 +45,6 @@
/obj/item/storage/toolbox/emergency
name = "emergency toolbox"
icon_state = "red"
item_state = "toolbox_red"
/obj/item/storage/toolbox/emergency/PopulateContents()
new /obj/item/crowbar/red(src)
@@ -59,6 +63,7 @@
name = "rusty red toolbox"
icon_state = "toolbox_red_old"
has_latches = FALSE
can_rubberify = FALSE
/obj/item/storage/toolbox/mechanical
name = "mechanical toolbox"
@@ -77,6 +82,7 @@
name = "rusty blue toolbox"
icon_state = "toolbox_blue_old"
has_latches = FALSE
can_rubberify = FALSE
/obj/item/storage/toolbox/mechanical/old/heirloom
name = "old, robust toolbox" //this will be named "X family toolbox"
@@ -151,6 +157,7 @@
resistance_flags = FIRE_PROOF | ACID_PROOF
w_class = WEIGHT_CLASS_HUGE
attack_verb = list("robusted", "crushed", "smashed")
can_rubberify = FALSE
var/fabricator_type = /obj/item/clockwork/replica_fabricator/scarab
/obj/item/storage/toolbox/brass/ComponentInitialize()
@@ -191,6 +198,7 @@
item_state = "toolbox_blue"
w_class = WEIGHT_CLASS_HUGE //heyo no bohing this!
force = 18 //spear damage
can_rubberify = FALSE
/obj/item/storage/toolbox/plastitanium/afterattack(atom/A, mob/user, proximity)
. = ..()
@@ -204,7 +212,7 @@
name = "artistic toolbox"
desc = "A toolbox painted bright green. Why anyone would store art supplies in a toolbox is beyond you, but it has plenty of extra space."
icon_state = "green"
item_state = "artistic_toolbox"
item_state = "toolbox_green"
w_class = WEIGHT_CLASS_GIGANTIC //Holds more than a regular toolbox!
/obj/item/storage/toolbox/artistic/ComponentInitialize()
@@ -253,9 +261,55 @@
/obj/item/storage/toolbox/gold_fake // used in crafting
name = "golden toolbox"
desc = "A gold plated toolbox, fancy and harmless do to the gold plating being on cardboard!"
desc = "A gold plated toolbox, fancy and harmless due to the gold plating being on cardboard!"
icon_state = "gold"
item_state = "gold"
has_latches = FALSE
force = 0
throwforce = 0
can_rubberify = FALSE
/obj/item/storage/toolbox/proc/rubberify()
name = "rubber [name]"
desc = replacetext(desc, "Danger", "Bouncy")
desc = replacetext(desc, "robust", "safe")
desc = replacetext(desc, "heavier", "bouncier")
DISABLE_BITFIELD(flags_1, CONDUCT_1)
materials = null
damtype = STAMINA
force += 3 //to compensate the higher stamina K.O. threshold compared to actual health.
throwforce += 3
attack_verb += "bounced"
hitsound = 'sound/effects/clownstep1.ogg'
if(!GLOB.rubber_toolbox_icons[icon_state])
generate_rubber_toolbox_icon()
icon = GLOB.rubber_toolbox_icons[icon_state]
AddComponent(/datum/component/bouncy)
. = ..()
/obj/item/storage/toolbox/proc/generate_rubber_toolbox_icon()
var/icon/new_icon = icon(icon, icon_state)
var/icon/smooth = icon('icons/obj/storage.dmi', "rubber_toolbox_blend")
new_icon.Blend(smooth, ICON_MULTIPLY)
new_icon = fcopy_rsc(new_icon)
GLOB.rubber_toolbox_icons[icon_state] = new_icon
/obj/item/storage/toolbox/rubber
name = "rubber toolbox"
desc = "Bouncy. Very safe."
flags_1 = null
materials = null
damtype = STAMINA
force = 17
throwforce = 17
attack_verb = list("robusted", "bounced")
can_rubberify = FALSE //we are already the future.
/obj/item/storage/toolbox/rubber/Initialize()
icon_state = pick("blue", "red", "yellow", "green")
item_state = "toolbox_[icon_state]"
if(!GLOB.rubber_toolbox_icons[icon_state])
generate_rubber_toolbox_icon()
icon = GLOB.rubber_toolbox_icons[icon_state]
. = ..()
AddComponent(/datum/component/bouncy)
+1 -1
View File
@@ -294,7 +294,7 @@
name = "windup toolbox"
desc = "A replica toolbox that rumbles when you turn the key."
icon_state = "his_grace"
item_state = "artistic_toolbox"
item_state = "toolbox_green"
lefthand_file = 'icons/mob/inhands/equipment/toolbox_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/toolbox_righthand.dmi'
var/active = FALSE
Binary file not shown.

Before

Width:  |  Height:  |  Size: 739 B

After

Width:  |  Height:  |  Size: 732 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 740 B

After

Width:  |  Height:  |  Size: 733 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 64 KiB

+1
View File
@@ -336,6 +336,7 @@
#include "code\datums\components\_component.dm"
#include "code\datums\components\anti_magic.dm"
#include "code\datums\components\armor_plate.dm"
#include "code\datums\components\bouncy.dm"
#include "code\datums\components\butchering.dm"
#include "code\datums\components\caltrop.dm"
#include "code\datums\components\chasm.dm"