Files
Bubberstation/code/modules/vehicles/bicycle.dm
SkyratBot 8affb60a42 [MIRROR] Adds a delay while welder repairing vehicles / mechs [MDB IGNORE] (#15409)
* Adds a delay while welder repairing vehicles / mechs (#68786)

About The Pull Request

So right now there is 0 delay between welding repairs for vehicles / mecha. You can literally hop out of your murderboner durand, flip on a welder, and repair it fully from 5% HP to 100% in a split second with an autoclicker macro. This adds a delay.
Why It's Good For The Game

Makes it so that you can't quickly hop out of your mecha/vehicle, instantly combat repair all it's damage, and hop right back into a fight. Instead, this encourages players to find safer areas before hopping out to commit to a repair.
Changelog

cl ShizCalev
balance: Vehicles & Mecha now take 2.5 second to repair with a welder.
qol: Vehicles & mecha will automatically repair over time once clicked.
qol: Vehicles & Mecha now give balloon alerts when repairing.
/cl

Duration is free for debate, was thinking somewhere between 2 & 3 seconds, 2.5 seemed a happy midpoint.

* Adds a delay while welder repairing vehicles / mechs

Co-authored-by: ShizCalev <ShizCalev@users.noreply.github.com>
2022-08-05 10:05:06 -07:00

63 lines
1.9 KiB
Plaintext

/obj/vehicle/ridden/bicycle
name = "bicycle"
desc = "Keep away from electricity."
icon_state = "bicycle"
max_integrity = 150
integrity_failure = 0.5
var/fried = FALSE
///What mobs are currently repairing us.
var/list/mob/living/repairing_mobs
/obj/vehicle/ridden/bicycle/Initialize(mapload)
. = ..()
AddElement(/datum/element/ridable, /datum/component/riding/vehicle/bicycle)
/obj/vehicle/ridden/bicycle/zap_act(power, zap_flags) // :::^^^)))
//This didn't work for 3 years because none ever tested it I hate life
name = "fried bicycle"
desc = "Well spent."
color = rgb(63, 23, 4)
can_buckle = FALSE
fried = TRUE
. = ..()
for(var/m in buckled_mobs)
unbuckle_mob(m,1)
/obj/vehicle/ridden/bicycle/welder_act(mob/living/user, obj/item/W)
if(user.combat_mode)
return
. = TRUE
if(fried)
balloon_alert(user, "it's fried!")
if(LAZYFIND(repairing_mobs, user))
balloon_alert(user, "you're already repairing it!")
return
if(atom_integrity >= max_integrity)
balloon_alert(user, "it's not damaged!")
return
if(!W.tool_start_check(user, amount=1))
return
LAZYADD(repairing_mobs, user)
user.balloon_alert_to_viewers("started welding [src]", "started repairing [src]")
audible_message(span_hear("You hear welding."))
var/did_the_thing
while(atom_integrity < max_integrity)
if(W.use_tool(src, user, 2.5 SECONDS, volume=50, amount=1, extra_checks = CALLBACK(src, .proc/can_still_fix)))
did_the_thing = TRUE
atom_integrity += min(10, (max_integrity - atom_integrity))
audible_message(span_hear("You hear welding."))
else
break
if(did_the_thing)
user.balloon_alert_to_viewers("[(atom_integrity >= max_integrity) ? "fully" : "partially"] repaired [src]")
else
user.balloon_alert_to_viewers("stopped welding [src]", "interrupted the repair!")
LAZYREMOVE(repairing_mobs, user)
///can we still fix the bike lol
/obj/vehicle/ridden/bicycle/proc/can_still_fix()
return !fried