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
+15 -2
View File
@@ -150,9 +150,11 @@
//Hook for running code when a dir change occurs
/atom/proc/setDir(newdir)
SEND_SIGNAL(src, COMSIG_ATOM_DIR_CHANGE, dir, newdir)
dir = newdir
/atom/proc/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE)
SEND_SIGNAL(src, COMSIG_ATOM_HULK_ATTACK, user)
if(does_attack_animation)
user.changeNext_move(CLICK_CD_MELEE)
add_attack_logs(user, src, "Punched with hulk powers")
@@ -305,8 +307,8 @@
/atom/proc/ex_act()
return
/atom/proc/blob_act()
return
/atom/proc/blob_act(obj/structure/blob/B)
SEND_SIGNAL(src, COMSIG_ATOM_BLOB_ACT, B)
/atom/proc/fire_act()
return
@@ -734,3 +736,14 @@ var/list/blood_splatter_icons = list()
if(!L)
return null
return L.AllowDrop() ? L : get_turf(L)
/atom/Entered(atom/movable/AM, atom/oldLoc)
SEND_SIGNAL(src, COMSIG_ATOM_ENTERED, AM, oldLoc)
/atom/Exit(atom/movable/AM, atom/newLoc)
. = ..()
if(SEND_SIGNAL(src, COMSIG_ATOM_EXIT, AM, newLoc) & COMPONENT_ATOM_BLOCK_EXIT)
return FALSE
/atom/Exited(atom/movable/AM, atom/newLoc)
SEND_SIGNAL(src, COMSIG_ATOM_EXITED, AM, newLoc)
+3 -1
View File
@@ -126,10 +126,11 @@
// Previously known as HasEntered()
// This is automatically called when something enters your square
/atom/movable/Crossed(atom/movable/AM)
return
SEND_SIGNAL(src, COMSIG_MOVABLE_CROSSED, AM)
/atom/movable/Bump(atom/A, yes) //the "yes" arg is to differentiate our Bump proc from byond's, without it every Bump() call would become a double Bump().
if(A && yes)
SEND_SIGNAL(src, COMSIG_MOVABLE_BUMP, A)
if(throwing)
throwing.hit_atom(A)
. = 1
@@ -213,6 +214,7 @@
//called when src is thrown into hit_atom
/atom/movable/proc/throw_impact(atom/hit_atom, throwingdatum)
set waitfor = 0
SEND_SIGNAL(src, COMSIG_MOVABLE_IMPACT, hit_atom, throwingdatum)
if(!QDELETED(hit_atom))
return hit_atom.hitby(src)
+3 -3
View File
@@ -19,7 +19,7 @@
src.update_icon()
..(loc)
for(var/atom/A in loc)
A.blob_act()
A.blob_act(src)
return
@@ -126,7 +126,7 @@
qdel(B)
for(var/atom/A in T)//Hit everything in the turf
A.blob_act()
A.blob_act(src)
return 1
/obj/structure/blob/ex_act(severity)
@@ -141,7 +141,7 @@
/obj/structure/blob/Crossed(var/mob/living/L)
..()
L.blob_act()
L.blob_act(src)
/obj/structure/blob/tesla_act(power)
..()
+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"
+1
View File
@@ -136,6 +136,7 @@
/turf/Entered(atom/movable/M, atom/OL, ignoreRest = 0)
..()
if(ismob(M))
var/mob/O = M
if(!O.lastarea)