mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2026-08-21 19:57:07 +01:00
36 lines
1.6 KiB
Plaintext
36 lines
1.6 KiB
Plaintext
/obj/item/proc/apply_tug_mob_to_mob(mob/living/carbon/tug_pet, mob/living/carbon/tug_master, distance = 2)
|
|
apply_tug_position(tug_pet, tug_pet.x, tug_pet.y, tug_master.x, tug_master.y, distance)
|
|
|
|
/obj/item/proc/apply_tug_mob_to_object(mob/living/carbon/tug_pet, obj/tug_master, distance = 2)
|
|
apply_tug_position(tug_pet, tug_pet.x, tug_pet.y, tug_master.x, tug_master.y, distance)
|
|
|
|
/obj/item/proc/apply_tug_object_to_mob(obj/tug_pet, mob/living/carbon/tug_master, distance = 2)
|
|
apply_tug_position(tug_pet, tug_pet.x, tug_pet.y, tug_master.x, tug_master.y, distance)
|
|
|
|
// TODO: improve this for bigger distances, where it's easy to hide behind something and break the tugging
|
|
/obj/item/proc/apply_tug_position(tug_pet, tug_pet_x, tug_pet_y, tug_master_x, tug_master_y, distance = 2)
|
|
if(tug_pet_x > tug_master_x + distance)
|
|
step(tug_pet, WEST, 1) //"1" is the speed of movement. We want the tug to be faster than their slow current walk speed.
|
|
if(tug_pet_y > tug_master_y)//Check the other axis, and tug them into alignment so they are behind the master
|
|
step(tug_pet, SOUTH, 1)
|
|
if(tug_pet_y < tug_master_y)
|
|
step(tug_pet, NORTH, 1)
|
|
if(tug_pet_x < tug_master_x - distance)
|
|
step(tug_pet, EAST, 1)
|
|
if(tug_pet_y > tug_master_y)
|
|
step(tug_pet, SOUTH, 1)
|
|
if(tug_pet_y < tug_master_y)
|
|
step(tug_pet, NORTH, 1)
|
|
if(tug_pet_y > tug_master_y + distance)
|
|
step(tug_pet, SOUTH, 1)
|
|
if(tug_pet_x > tug_master_x)
|
|
step(tug_pet, WEST, 1)
|
|
if(tug_pet_x < tug_master_x)
|
|
step(tug_pet, EAST, 1)
|
|
if(tug_pet_y < tug_master_y - distance)
|
|
step(tug_pet, NORTH, 1)
|
|
if(tug_pet_x > tug_master_x)
|
|
step(tug_pet, WEST, 1)
|
|
if(tug_pet_x < tug_master_x)
|
|
step(tug_pet, EAST, 1)
|