From fdde027d855f1a9eba0b4fae31403a37c8e9c0bd Mon Sep 17 00:00:00 2001 From: Verkister Date: Wed, 27 Jun 2018 18:44:20 +0300 Subject: [PATCH] Adds dogborg riding. -Adds the borg half of the riding PR for your convenience. -See the taur riding PR for the mechanical details this system is based on. -The dogborg variant is applied via the module selection and removed with reset module. --- .../silicon/robot/robot_modules/station_vr.dm | 7 ++ .../mob/living/silicon/robot/robot_vr.dm | 112 +++++++++++++++++- 2 files changed, 118 insertions(+), 1 deletion(-) diff --git a/code/modules/mob/living/silicon/robot/robot_modules/station_vr.dm b/code/modules/mob/living/silicon/robot/robot_modules/station_vr.dm index 9d5da2f9bc..6e60b2726b 100644 --- a/code/modules/mob/living/silicon/robot/robot_modules/station_vr.dm +++ b/code/modules/mob/living/silicon/robot/robot_modules/station_vr.dm @@ -170,6 +170,7 @@ R.dogborg = TRUE R.wideborg = TRUE R.verbs |= /mob/living/silicon/robot/proc/ex_reserve_refill + R.verbs |= /mob/living/silicon/robot/proc/robot_mount R.verbs |= /mob/living/proc/shred_limb ..() @@ -240,6 +241,7 @@ R.dogborg = TRUE R.wideborg = TRUE R.verbs |= /mob/living/silicon/robot/proc/ex_reserve_refill + R.verbs |= /mob/living/silicon/robot/proc/robot_mount R.verbs |= /mob/living/proc/shred_limb ..() @@ -286,6 +288,7 @@ R.dogborg = TRUE R.wideborg = TRUE R.verbs |= /mob/living/silicon/robot/proc/ex_reserve_refill + R.verbs |= /mob/living/silicon/robot/proc/robot_mount R.verbs |= /mob/living/proc/shred_limb ..() @@ -366,6 +369,7 @@ R.dogborg = TRUE R.wideborg = TRUE R.verbs |= /mob/living/silicon/robot/proc/ex_reserve_refill + R.verbs |= /mob/living/silicon/robot/proc/robot_mount R.verbs |= /mob/living/proc/shred_limb ..() @@ -412,6 +416,7 @@ R.dogborg = TRUE R.wideborg = TRUE R.verbs |= /mob/living/silicon/robot/proc/ex_reserve_refill + R.verbs |= /mob/living/silicon/robot/proc/robot_mount R.verbs |= /mob/living/proc/shred_limb ..() @@ -536,6 +541,7 @@ R.dogborg = TRUE R.wideborg = TRUE R.verbs |= /mob/living/silicon/robot/proc/ex_reserve_refill + R.verbs |= /mob/living/silicon/robot/proc/robot_mount R.verbs |= /mob/living/proc/shred_limb ..() @@ -549,5 +555,6 @@ R.default_pixel_x = initial(pixel_x) R.scrubbing = FALSE R.verbs -= /mob/living/silicon/robot/proc/ex_reserve_refill + R.verbs -= /mob/living/silicon/robot/proc/robot_mount R.verbs -= /mob/living/proc/shred_limb ..() \ No newline at end of file diff --git a/code/modules/mob/living/silicon/robot/robot_vr.dm b/code/modules/mob/living/silicon/robot/robot_vr.dm index 14b58b726a..332fabb19f 100644 --- a/code/modules/mob/living/silicon/robot/robot_vr.dm +++ b/code/modules/mob/living/silicon/robot/robot_vr.dm @@ -123,4 +123,114 @@ E.reagents.add_reagent("water", amount) to_chat(src, "You refill the extinguisher using your water reserves.") else - to_chat(src, "Insufficient water reserves.") \ No newline at end of file + to_chat(src, "Insufficient water reserves.") + +//RIDING +/datum/riding/dogborg + keytype = /obj/item/weapon/material/twohanded/fluff/riding_crop // Crack! + nonhuman_key_exemption = FALSE // If true, nonhumans who can't hold keys don't need them, like borgs and simplemobs. + key_name = "a riding crop" // What the 'keys' for the thing being rided on would be called. + only_one_driver = TRUE // If true, only the person in 'front' (first on list of riding mobs) can drive. + +/datum/riding/dogborg/handle_vehicle_layer() + if(ridden.has_buckled_mobs()) + if(ridden.dir != NORTH) + ridden.layer = ABOVE_MOB_LAYER + else + ridden.layer = initial(ridden.layer) + else + ridden.layer = initial(ridden.layer) + +/datum/riding/dogborg/ride_check(mob/living/M) + var/mob/living/L = ridden + if(L.stat) + force_dismount(M) + return FALSE + return TRUE + +/datum/riding/dogborg/force_dismount(mob/M) + . =..() + ridden.visible_message("[M] stops riding [ridden]!") + +//Hoooo boy. +/datum/riding/dogborg/get_offsets(pass_index) // list(dir = x, y, layer) + var/mob/living/L = ridden + var/scale = L.size_multiplier + + var/list/values = list( + "[NORTH]" = list(0, 8*scale, ABOVE_MOB_LAYER), + "[SOUTH]" = list(0, 8*scale, BELOW_MOB_LAYER), + "[EAST]" = list(-5*scale, 8*scale, ABOVE_MOB_LAYER), + "[WEST]" = list(5*scale, 8*scale, ABOVE_MOB_LAYER)) + + return values + +//Human overrides for taur riding +/mob/living/silicon/robot + max_buckled_mobs = 1 //Yeehaw + can_buckle = TRUE + buckle_movable = TRUE + buckle_lying = FALSE + +/mob/living/silicon/robot/New() + ..() + riding_datum = new /datum/riding/dogborg(src) + +/mob/living/silicon/robot/buckle_mob(mob/living/M, forced = FALSE, check_loc = TRUE) + if(forced) + return ..() // Skip our checks + if(!dogborg) + return FALSE + if(lying) + return FALSE + if(!ishuman(M)) + return FALSE + if(M in buckled_mobs) + return FALSE + if(M.size_multiplier > size_multiplier * 1.2) + to_chat(src,"This isn't a pony show! You need to be bigger for them to ride.") + return FALSE + + var/mob/living/carbon/human/H = M + + if(isTaurTail(H.tail_style)) + to_chat(src,"Too many legs. TOO MANY LEGS!!") + return FALSE + if(M.loc != src.loc) + if(M.Adjacent(src)) + M.forceMove(get_turf(src)) + + . = ..() + if(.) + buckled_mobs[M] = "riding" + +/mob/living/silicon/robot/MouseDrop_T(mob/living/M, mob/living/user) //Prevention for forced relocation caused by can_buckle. Base proc has no other use. + return + +/mob/living/silicon/robot/attack_hand(mob/user as mob) + if(LAZYLEN(buckled_mobs)) + //We're getting off! + if(user in buckled_mobs) + riding_datum.force_dismount(user) + //We're kicking everyone off! + if(user == src) + for(var/rider in buckled_mobs) + riding_datum.force_dismount(rider) + else + . = ..() + +/mob/living/silicon/robot/proc/robot_mount(var/mob/living/M in living_mobs(1)) + set name = "Robot Mount/Dismount" + set category = "Abilities" + set desc = "Let people ride on you." + + if(LAZYLEN(buckled_mobs)) + for(var/rider in buckled_mobs) + riding_datum.force_dismount(rider) + return + if (stat != CONSCIOUS) + return + if(!can_buckle || !istype(M) || !M.Adjacent(src) || M.buckled) + return + if(buckle_mob(M)) + visible_message("[M] starts riding [name]!") \ No newline at end of file