mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-19 11:58:39 +01:00
df014f9bc0
Refactored mousedrag procs, added signals, some safeguards, did some cleanups around, renamed them to make a little more sense. Mostly put in line with TG's code. Fast clicking and releasing with a drag, depending on the grace period and how fast it is done, can be counted as clicks, to aid in combat scenarios where you spamclick.
88 lines
2.2 KiB
Plaintext
88 lines
2.2 KiB
Plaintext
/obj/vehicle/unicycle
|
|
name = "unicycle"
|
|
desc = "An one wheeled vehicle."
|
|
icon_state = "unicycle"
|
|
|
|
mob_offset_y = 4
|
|
health = 50
|
|
maxhealth = 50
|
|
|
|
fire_dam_coeff = 0.8
|
|
brute_dam_coeff = 0.8
|
|
|
|
charge_use = 0
|
|
|
|
light_range = 0
|
|
|
|
powered = 1
|
|
on = 1
|
|
|
|
/obj/vehicle/unicycle/Initialize()
|
|
. = ..()
|
|
AddOverlays(image('icons/obj/vehicles.dmi', "unicycle_overlay", MOB_LAYER + 1))
|
|
cell = new /obj/item/cell/high(src)
|
|
|
|
/obj/vehicle/unicycle/load(var/atom/movable/C)
|
|
var/mob/living/M = C
|
|
if(!istype(C)) return 0
|
|
if(M.buckled_to || M.restrained() || !Adjacent(M) || !M.Adjacent(src))
|
|
return 0
|
|
return ..(M)
|
|
|
|
/obj/vehicle/unicycle/mouse_drop_receive(atom/dropped, mob/user, params)
|
|
if(!load(dropped))
|
|
to_chat(user, SPAN_WARNING("You were unable to load \the [dropped] onto \the [src]."))
|
|
return
|
|
|
|
/obj/vehicle/unicycle/attack_hand(var/mob/user as mob)
|
|
if(user == load)
|
|
unload(load)
|
|
to_chat(user, "You climb on \the [src]")
|
|
else if(user != load && load)
|
|
user.visible_message ("[user] starts to remove [load] from \the [src]!")
|
|
if(do_after(user, 8 SECONDS, src))
|
|
unload(load)
|
|
to_chat(user, "You remove [load] from \the [src]")
|
|
to_chat(load, "You were removed from \the [src] by [user]")
|
|
|
|
/obj/vehicle/unicycle/relaymove(mob/living/user, direction)
|
|
. = ..()
|
|
|
|
if(user != load || !on || user.incapacitated())
|
|
return
|
|
return Move(get_step(src, direction))
|
|
|
|
/obj/vehicle/unicycle/Move()
|
|
if(world.time > l_move_time + move_delay)
|
|
var/old_loc = get_turf(src)
|
|
|
|
var/init_anc = anchored
|
|
anchored = 0
|
|
if(!..())
|
|
anchored = init_anc
|
|
return 0
|
|
|
|
set_dir(get_dir(old_loc, loc))
|
|
anchored = init_anc
|
|
|
|
//Dummy loads do not have to be moved as they are just an overlay
|
|
//See load_object() proc in cargo_trains.dm for an example
|
|
if(load && !istype(load, /datum/vehicle_dummy_load))
|
|
load.forceMove(loc)
|
|
load.set_dir(dir)
|
|
|
|
if(prob(20))
|
|
if(buckled)
|
|
if(ishuman(buckled))
|
|
var/mob/living/carbon/human/H = buckled
|
|
if(H.mind && (H.mind.assigned_role != "Adhomian Circus Clown"))
|
|
H.visible_message(SPAN_DANGER("\The [H] falls off from \the [src]!"))
|
|
unload(H)
|
|
H.throw_at(get_edge_target_turf(loc, loc.dir), 5, 1)
|
|
H.apply_effect(2, WEAKEN)
|
|
|
|
|
|
return 1
|
|
else
|
|
return 0
|