Merge pull request #6243 from Mithrandalf/mouse

I improved mice
This commit is contained in:
Spades
2019-12-06 10:51:36 -05:00
committed by GitHub
3 changed files with 42 additions and 5 deletions
+2
View File
@@ -134,6 +134,8 @@ var/list/holder_mob_icon_cache = list()
/mob/living/MouseDrop(var/atom/over_object)
var/mob/living/carbon/human/H = over_object
if(holder_type && issmall(src) && istype(H) && !H.lying && Adjacent(H) && (src.a_intent == I_HELP && H.a_intent == I_HELP)) //VOREStation Edit
if(istype(src, /mob/living/simple_mob/animal/passive/mouse)) //vorestation edit
return ..() //vorestation edit
if(!issmall(H) || !istype(src, /mob/living/carbon/human))
get_scooped(H, (usr == src))
return
@@ -9,9 +9,14 @@
desc = "A small rodent, often seen hiding in maintenance areas and making a nuisance of itself. And stealing cheese, or annoying the chef. SQUEAK! <3"
/mob/living/simple_mob/animal/passive/mouse/attack_hand(mob/living/hander)
if(hander.a_intent == I_HELP) //if lime intent
get_scooped(hander) //get scooped
size_multiplier = 0.25
movement_cooldown = 1 //roughly half the speed of a person
universal_understand = 1
/mob/living/simple_mob/animal/passive/mouse/attack_hand(mob/living/L)
if(L.a_intent == I_HELP) //if lime intent
if(!src.attempt_to_scoop(L)) //the superior way to handle scooping, checks size
..() //mouse too big to grab? pet the large mouse instead
else
..()
@@ -20,3 +25,33 @@
if((I_HELP) && U.canClick()) //a little snowflakey, but makes it use the same cooldown as interacting with non-inventory objects
U.setClickCooldown(U.get_attack_speed()) //if there's a cleaner way in baycode, I'll change this
U.visible_message("<span class='notice'>[U] [M.response_help] \the [M].</span>")
/mob/living/simple_mob/animal/passive/mouse/MouseDrop(var/obj/O) //this proc would be very easy to apply to all mobs with holders
if(!(usr == src || O))
return ..()
if(istype(O, /mob/living) && O.Adjacent(src)) //controls scooping by mobs
var/mob/living/L = O
if(!src.attempt_to_scoop(L, (src == usr)))
return //this way it doesnt default to the generic animal pickup which isnt size restricted
if(istype(O, /obj/item/weapon/storage) && O.Adjacent(src)) //controls diving into storage
var/obj/item/weapon/storage/S = O
var/obj/item/weapon/holder/H = new holder_type(get_turf(src)) //this works weird, but it creates an empty holder, to see if that holder can fit
if(S.can_be_inserted(H) && (src.size_multiplier <= 0.75))
H.held_mob = src
src.forceMove(H)
visible_message("<span class='notice'>\the [src] squeezes into \the [S].</span>")
H.forceMove(S)
H.sync(src)
return 1
else
qdel(H) //this deletes the empty holder if it doesnt work
to_chat(usr,"<span class='notice'>You can't fit inside \the [S]!</span>")
return 0
else
..()
/mob/living/simple_mob/animal/passive/mouse/resize(var/new_size, var/animate = TRUE)
size_multiplier = max(size_multiplier + 0.75, 1) //keeps sprite sizes consistent, keeps multiplier values low
..()
size_multiplier = max(size_multiplier - 0.75, 0.25) //the limits here ensure no negative values or infinite shrinkage
+2 -2
View File
@@ -125,7 +125,7 @@ var/const/RESIZE_A_SMALLTINY = (RESIZE_SMALL + RESIZE_TINY) / 2
* Attempt to scoop up this mob up into H's hands, if the size difference is large enough.
* @return false if normal code should continue, 1 to prevent normal code.
*/
/mob/living/proc/attempt_to_scoop(var/mob/living/M)
/mob/living/proc/attempt_to_scoop(var/mob/living/M, var/mob/living/G) //second one is for the Grabber, only exists for animals to self-grab
var/size_diff = M.get_effective_size() - get_effective_size()
if(!holder_default && holder_type)
holder_default = holder_type
@@ -140,7 +140,7 @@ var/const/RESIZE_A_SMALLTINY = (RESIZE_SMALL + RESIZE_TINY) / 2
return 0
if(size_diff >= 0.50)
holder_type = /obj/item/weapon/holder/micro
var/obj/item/weapon/holder/m_holder = get_scooped(M)
var/obj/item/weapon/holder/m_holder = get_scooped(M, G)
holder_type = holder_default
if (m_holder)
return 1