Unifying mob scooping, removing some unneeded boilerplate.

This commit is contained in:
Zuhayr
2015-12-29 14:56:39 +10:30
parent 763a4b88e7
commit 80e4235c68
7 changed files with 18 additions and 62 deletions

View File

@@ -84,6 +84,13 @@ var/list/holder_mob_icon_cache = list()
//Mob procs and vars for scooping up
/mob/living/var/holder_type
/mob/living/MouseDrop(var/atom/over_object)
var/mob/living/carbon/human/H = over_object
if(holder_type && istype(H) && !H.lying && !issmall(H) && Adjacent(H))
get_scooped(H, (usr == src))
return
return ..()
/mob/living/proc/get_scooped(var/mob/living/carbon/grabber, var/self_grab)
if(!holder_type || buckled || pinned.len)

View File

@@ -1,17 +1,13 @@
/mob/living/carbon/alien/diona/MouseDrop(atom/over_object)
var/mob/living/carbon/H = over_object
if(!istype(H) || !Adjacent(H)) return ..()
if(H.a_intent == "help")
if(H.species && H.species.name == "Diona" && do_merge(H))
return
get_scooped(H)
return
else if(H.a_intent == "grab" && hat && !(H.l_hand && H.r_hand))
/mob/living/carbon/alien/diona/MouseDrop(var/atom/over_object)
var/mob/living/carbon/human/H = over_object
if(!istype(H) || !Adjacent(H))
return ..()
if(H.a_intent == "grab" && hat && !(H.l_hand && H.r_hand))
hat.loc = get_turf(src)
H.put_in_hands(hat)
H.visible_message("<span class='danger'>\The [H] removes \the [src]'s [hat].</span>")
hat = null
update_icons()
updateicon()
else
return ..()

View File

@@ -1370,13 +1370,6 @@
return 1
return 0
/mob/living/carbon/human/MouseDrop(var/atom/over_object)
var/mob/living/carbon/human/H = over_object
if(holder_type && istype(H) && !H.lying && !issmall(H) && Adjacent(H))
get_scooped(H, (usr == src))
return
return ..()
/mob/living/carbon/human/verb/pull_punches()
set name = "Pull Punches"
set desc = "Try not to hurt them."

View File

@@ -127,9 +127,6 @@
return 0
..()
/mob/living/silicon/pai/MouseDrop(atom/over_object)
return
/mob/living/silicon/pai/emp_act(severity)
// Silence for 2 minutes
// 20% chance to kill
@@ -421,12 +418,3 @@
grabber.update_inv_l_hand()
grabber.update_inv_r_hand()
return H
/mob/living/silicon/pai/MouseDrop(atom/over_object)
var/mob/living/carbon/H = over_object
if(!istype(H) || !Adjacent(H)) return ..()
if(H.a_intent == "help")
get_scooped(H)
return
else
return ..()

View File

@@ -21,13 +21,11 @@
return
/mob/living/silicon/robot/drone/MouseDrop(atom/over_object)
var/mob/living/carbon/H = over_object
if(!istype(H) || !Adjacent(H)) return ..()
if(H.a_intent == "help")
get_scooped(H)
return
else if(H.a_intent == "grab" && hat && !(H.l_hand && H.r_hand))
/mob/living/silicon/robot/drone/MouseDrop(var/atom/over_object)
var/mob/living/carbon/human/H = over_object
if(!istype(H) || !Adjacent(H))
return ..()
if(H.a_intent == "grab" && hat && !(H.l_hand && H.r_hand))
hat.loc = get_turf(src)
H.put_in_hands(hat)
H.visible_message("<span class='danger'>\The [H] removes \the [src]'s [hat].</span>")

View File

@@ -124,17 +124,6 @@
. = ..()
set_flee_target(AM.thrower? AM.thrower : src.loc)
/mob/living/simple_animal/cat/MouseDrop(atom/over_object)
var/mob/living/carbon/H = over_object
if(!istype(H) || !Adjacent(H)) return ..()
if(H.a_intent == "help")
get_scooped(H)
return
else
return ..()
//Basic friend AI
/mob/living/simple_animal/cat/fluff
var/mob/living/carbon/human/friend

View File

@@ -78,21 +78,6 @@
if(client)
client.time_died_as_mouse = world.time
/mob/living/simple_animal/mouse/MouseDrop(atom/over_object)
var/mob/living/carbon/H = over_object
if(!istype(H) || !Adjacent(H)) return ..()
if(H.a_intent == "help")
get_scooped(H)
return
else
return ..()
/mob/living/simple_animal/mouse/start_pulling(var/atom/movable/AM)//Prevents mouse from pulling things
src << "<span class='warning'>You are too small to pull anything.</span>"
return
/mob/living/simple_animal/mouse/Crossed(AM as mob|obj)
if( ishuman(AM) )
if(!stat)