Merge pull request #10032 from variableundefined/SqueakComponent

Add in squeak component & refactor bikehorn, mouse to use it.
This commit is contained in:
Fox McCloud
2018-11-20 18:38:42 -05:00
committed by GitHub
20 changed files with 151 additions and 67 deletions
+5
View File
@@ -310,6 +310,7 @@ var/global/image/fire_overlay = image("icon" = 'icons/goonstation/effects/fire.d
return ..()
/obj/item/proc/hit_reaction(mob/living/carbon/human/owner, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
SEND_SIGNAL(src, COMSIG_ITEM_HIT_REACT, args)
if(prob(final_block_chance))
owner.visible_message("<span class='danger'>[owner] blocks [attack_text] with [src]!</span>")
return 1
@@ -324,6 +325,7 @@ var/global/image/fire_overlay = image("icon" = 'icons/goonstation/effects/fire.d
A.Remove(user)
if(flags & DROPDEL)
qdel(src)
SEND_SIGNAL(src, COMSIG_ITEM_DROPPED,user)
// called just as an item is picked up (loc is not yet changed)
/obj/item/proc/pickup(mob/user)
@@ -351,6 +353,7 @@ var/global/image/fire_overlay = image("icon" = 'icons/goonstation/effects/fire.d
// 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)
SEND_SIGNAL(src, COMSIG_ITEM_EQUIPPED, user, 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.
@@ -498,6 +501,7 @@ var/global/image/fire_overlay = image("icon" = 'icons/goonstation/effects/fire.d
/obj/item/throw_impact(atom/A)
if(A && !QDELETED(A))
SEND_SIGNAL(src, COMSIG_MOVABLE_IMPACT, A)
var/itempush = 1
if(w_class < WEIGHT_CLASS_BULKY)
itempush = 0 // too light to push anything
@@ -548,6 +552,7 @@ var/global/image/fire_overlay = image("icon" = 'icons/goonstation/effects/fire.d
return I == src
/obj/item/Crossed(atom/movable/AM)
. = ..()
if(prob(trip_chance) && ishuman(AM))
var/mob/living/carbon/human/H = AM
on_trip(H)
+12 -27
View File
@@ -18,35 +18,21 @@
hitsound = null
throwforce = 3
w_class = WEIGHT_CLASS_TINY
var/list/honk_sounds = list('sound/items/bikehorn.ogg' = 1)
throw_speed = 3
throw_range = 15
attack_verb = list("HONKED")
var/spam_flag = 0
var/honk_sound = 'sound/items/bikehorn.ogg'
var/cooldowntime = 20
/obj/item/bikehorn/attack(mob/living/carbon/M, mob/living/carbon/user)
if(!spam_flag)
playsound(loc, honk_sound, 50, 1, -1) //plays instead of tap.ogg!
return ..()
/obj/item/bikehorn/attack_self(mob/user)
if(!spam_flag)
spam_flag = 1
playsound(src.loc, honk_sound, 50, 1)
src.add_fingerprint(user)
spawn(cooldowntime)
spam_flag = 0
return
/obj/item/bikehorn/Initialize()
. = ..()
AddComponent(/datum/component/squeak, honk_sounds, 50)
/obj/item/bikehorn/airhorn
name = "air horn"
desc = "Damn son, where'd you find this?"
icon_state = "air_horn"
honk_sound = 'sound/items/AirHorn2.ogg'
cooldowntime = 50
origin_tech = "materials=4;engineering=4"
honk_sounds = list('sound/items/airhorn2.ogg' = 1)
/obj/item/bikehorn/golden
name = "golden bike horn"
@@ -63,11 +49,10 @@
..()
/obj/item/bikehorn/golden/proc/flip_mobs(mob/living/carbon/M, mob/user)
if(!spam_flag)
var/turf/T = get_turf(src)
for(M in ohearers(7, T))
if(istype(M, /mob/living/carbon/human))
var/mob/living/carbon/human/H = M
if(!H.can_hear())
continue
M.emote("flip")
var/turf/T = get_turf(src)
for(M in ohearers(7, T))
if(istype(M, /mob/living/carbon/human))
var/mob/living/carbon/human/H = M
if(!H.can_hear())
continue
M.emote("flip")
+1 -3
View File
@@ -507,10 +507,8 @@
icon = 'icons/obj/watercloset.dmi'
icon_state = "rubberducky"
item_state = "rubberducky"
honk_sounds = list('sound/items/squeaktoy.ogg' = 1)
attack_verb = list("quacked", "squeaked")
honk_sound = 'sound/items/squeaktoy.ogg' //credit to DANMITCH3LL of freesound for this
/obj/structure/sink
name = "sink"