Skip to content
This repository has been archived by the owner on Sep 12, 2021. It is now read-only.

Commit

Permalink
[READY]Skateboard overhaul (#45657)
Browse files Browse the repository at this point in the history
* skeet skeet

* scoot

* removes debug message

* merge conflict

* oopsie

* polish, new board types

* begone

* actioninja review

* passtable trait

* fixes indent

* dwarfism check

* check for existing flag

* check existing trait

* screwdriver returns FALSE
  • Loading branch information
Mickyan authored and AnturK committed Aug 24, 2019
1 parent 796a29f commit 93c2dc0
Show file tree
Hide file tree
Showing 14 changed files with 192 additions and 29 deletions.
4 changes: 3 additions & 1 deletion code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
#define HAS_TRAIT(target, trait) (target.status_traits ? (target.status_traits[trait] ? TRUE : FALSE) : FALSE)
#define HAS_TRAIT_FROM(target, trait, source) (target.status_traits ? (target.status_traits[trait] ? (source in target.status_traits[trait]) : FALSE) : FALSE)


/*
Remember to update _globalvars/traits.dm if you're adding/removing/renaming traits.
*/
Expand Down Expand Up @@ -147,6 +146,7 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define TRAIT_MEDICAL_HUD "med_hud"
#define TRAIT_SECURITY_HUD "sec_hud"
#define TRAIT_MEDIBOTCOMINGTHROUGH "medbot" //Is a medbot healing you
#define TRAIT_PASSTABLE "passtable"

//non-mob traits
#define TRAIT_PARALYSIS "paralysis" //Used for limb-based paralysis, where replacing the limb will fix it
Expand Down Expand Up @@ -199,6 +199,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define STATUS_EFFECT_TRAIT "status-effect"
#define CLOTHING_TRAIT "clothing"
#define GLASSES_TRAIT "glasses"
#define VEHICLE_TRAIT "vehicle" // inherited from riding vehicles
#define INNATE_TRAIT "innate"

// unique trait sources, still defines
#define CLONING_POD_TRAIT "cloning-pod"
Expand Down
13 changes: 13 additions & 0 deletions code/__HELPERS/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -474,3 +474,16 @@ GLOBAL_LIST_EMPTY(species_list)
chosen = pick(mob_spawn_meancritters)
var/mob/living/simple_animal/C = new chosen(spawn_location)
return C

/proc/passtable_on(target, source)
var/mob/living/L = target
if (!HAS_TRAIT(L, TRAIT_PASSTABLE) && L.pass_flags & PASSTABLE)
ADD_TRAIT(L, TRAIT_PASSTABLE, INNATE_TRAIT)
ADD_TRAIT(L, TRAIT_PASSTABLE, source)
L.pass_flags |= PASSTABLE

/proc/passtable_off(target, source)
var/mob/living/L = target
REMOVE_TRAIT(L, TRAIT_PASSTABLE, source)
if(!HAS_TRAIT(L, TRAIT_PASSTABLE))
L.pass_flags &= ~PASSTABLE
4 changes: 2 additions & 2 deletions code/datums/mutations/body.dm
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@
if(..())
return
owner.transform = owner.transform.Scale(1, 0.8)
owner.pass_flags |= PASSTABLE
passtable_on(owner, GENETIC_MUTATION)
owner.visible_message("<span class='danger'>[owner] suddenly shrinks!</span>", "<span class='notice'>Everything around you seems to grow..</span>")

/datum/mutation/human/dwarfism/on_losing(mob/living/carbon/human/owner)
if(..())
return
owner.transform = owner.transform.Scale(1, 1.25)
owner.pass_flags &= ~PASSTABLE
passtable_off(owner, GENETIC_MUTATION)
owner.visible_message("<span class='danger'>[owner] suddenly grows!</span>", "<span class='notice'>Everything around you seems to shrink..</span>")


Expand Down
29 changes: 27 additions & 2 deletions code/game/objects/items/weaponry.dm
Original file line number Diff line number Diff line change
Expand Up @@ -502,19 +502,44 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301
icon_state = "catwhip"

/obj/item/melee/skateboard
name = "skateboard"
name = "improvised skateboard"
desc = "A skateboard. It can be placed on its wheels and ridden, or used as a strong weapon."
icon_state = "skateboard"
item_state = "skateboard"
force = 12
throwforce = 4
w_class = WEIGHT_CLASS_NORMAL
attack_verb = list("smacked", "whacked", "slammed", "smashed")
///The vehicle counterpart for the board
var/board_item_type = /obj/vehicle/ridden/scooter/skateboard

/obj/item/melee/skateboard/attack_self(mob/user)
new /obj/vehicle/ridden/scooter/skateboard(get_turf(user))
new board_item_type(get_turf(user))
qdel(src)

/obj/item/melee/skateboard/pro
name = "skateboard"
desc = "A RaDSTORMz brand professional skateboard. It looks sturdy and well made."
icon_state = "skateboard2"
item_state = "skateboard2"
board_item_type = /obj/vehicle/ridden/scooter/skateboard/pro
custom_premium_price = 300

/obj/item/melee/skateboard/hoverboard
name = "hoverboard"
desc = "A blast from the past, so retro!"
icon_state = "hoverboard_red"
item_state = "hoverboard_red"
board_item_type = /obj/vehicle/ridden/scooter/skateboard/hoverboard
custom_premium_price = 2015

/obj/item/melee/skateboard/hoverboard/admin
name = "\improper Board Of Directors"
desc = "The engineering complexity of a spaceship concentrated inside of a board. Just as expensive, too."
icon_state = "hoverboard_nt"
item_state = "hoverboard_nt"
board_item_type = /obj/vehicle/ridden/scooter/skateboard/hoverboard/admin

/obj/item/melee/baseball_bat
name = "baseball bat"
desc = "There ain't a skull in the league that can withstand a swatter."
Expand Down
132 changes: 108 additions & 24 deletions code/modules/vehicles/scooter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,23 @@
return ..()

/obj/vehicle/ridden/scooter/skateboard
name = "skateboard"
desc = "An unfinished scooter which can only barely be called a skateboard. It's still rideable, but probably unsafe. Looks like you'll need to add a few rods to make handlebars. Alt-click to adjust speed."
name = "improvised skateboard"
desc = "An unfinished scooter which can only barely be called a skateboard. It's still rideable, but probably unsafe. Looks like you'll need to add a few rods to make handlebars."
icon_state = "skateboard"
density = FALSE
arms_required = 0
fall_off_if_missing_arms = FALSE
var/adjusted_speed = FALSE
var/datum/effect_system/spark_spread/sparks
///Whether the board is currently grinding
var/grinding = FALSE
///Stores the time of the last crash plus a short cooldown, affects availability and outcome of certain actions
var/next_crash
///Stores the default icon state
var/board_icon = "skateboard"
///The handheld item counterpart for the board
var/board_item_type = /obj/item/melee/skateboard
///Stamina drain multiplier
var/instability = 10

/obj/vehicle/ridden/scooter/skateboard/Initialize()
. = ..()
Expand All @@ -59,6 +69,23 @@
D.set_vehicle_dir_layer(NORTH, OBJ_LAYER)
D.set_vehicle_dir_layer(EAST, OBJ_LAYER)
D.set_vehicle_dir_layer(WEST, OBJ_LAYER)
sparks = new
sparks.set_up(1, 0, src)
sparks.attach(src)

/obj/vehicle/ridden/scooter/skateboard/Destroy()
if(sparks)
QDEL_NULL(sparks)
. = ..()

/obj/vehicle/ridden/scooter/skateboard/relaymove()
if (grinding || world.time < next_crash)
return FALSE
return ..()

/obj/vehicle/ridden/scooter/skateboard/generate_actions()
. = ..()
initialize_controller_action_type(/datum/action/vehicle/ridden/scooter/skateboard/ollie, VEHICLE_CONTROL_DRIVE)

/obj/vehicle/ridden/scooter/skateboard/post_buckle_mob(mob/living/M)//allows skateboards to be non-dense but still allows 2 skateboarders to collide with each other
density = TRUE
Expand All @@ -73,17 +100,52 @@
. = ..()
if(A.density && has_buckled_mobs())
var/mob/living/H = buckled_mobs[1]
var/atom/throw_target = get_edge_target_turf(H, pick(GLOB.cardinals))
unbuckle_mob(H)
H.throw_at(throw_target, 4, 3)
H.Paralyze(100)
H.adjustStaminaLoss(40)
var/head_slot = H.get_item_by_slot(SLOT_HEAD)
if(!head_slot || !(istype(head_slot,/obj/item/clothing/head/helmet) || istype(head_slot,/obj/item/clothing/head/hardhat)))
H.adjustOrganLoss(ORGAN_SLOT_BRAIN, 3)
H.updatehealth()
visible_message("<span class='danger'>[src] crashes into [A], sending [H] flying!</span>")
playsound(src, 'sound/effects/bang.ogg', 50, 1)
H.adjustStaminaLoss(instability*6)
playsound(src, 'sound/effects/bang.ogg', 40, TRUE)
if(!iscarbon(H) || H.getStaminaLoss() >= 100 || grinding || world.time < next_crash)
var/atom/throw_target = get_edge_target_turf(H, pick(GLOB.cardinals))
unbuckle_mob(H)
H.throw_at(throw_target, 3, 2)
var/head_slot = H.get_item_by_slot(SLOT_HEAD)
if(!head_slot || !(istype(head_slot,/obj/item/clothing/head/helmet) || istype(head_slot,/obj/item/clothing/head/hardhat)))
H.adjustOrganLoss(ORGAN_SLOT_BRAIN, 5)
H.updatehealth()
visible_message("<span class='danger'>[src] crashes into [A], sending [H] flying!</span>")
H.Paralyze(80)
else
var/backdir = turn(dir, 180)
vehicle_move(backdir)
H.spin(4, 1)
next_crash = world.time + 10

///Moves the vehicle forward and if it lands on a table, repeats
/obj/vehicle/ridden/scooter/skateboard/proc/grind()
vehicle_move(dir)
if(has_buckled_mobs() && locate(/obj/structure/table) in loc.contents)
var/mob/living/L = buckled_mobs[1]
L.adjustStaminaLoss(instability*0.5)
if (L.getStaminaLoss() >= 100)
playsound(src, 'sound/effects/bang.ogg', 20, TRUE)
unbuckle_mob(L)
var/atom/throw_target = get_edge_target_turf(src, pick(GLOB.cardinals))
L.throw_at(throw_target, 2, 2)
visible_message("<span class='danger'>[L] loses [L.p_their()] footing and slams on the ground!</span>")
L.Paralyze(40)
grinding = FALSE
icon_state = board_icon
return
else
playsound(src, 'sound/vehicles/skateboard_roll.ogg', 50, TRUE)
if(prob (25))
var/turf/location = get_turf(loc)
if(location)
location.hotspot_expose(1000,1000)
sparks.start() //the most radical way to start plasma fires
addtimer(CALLBACK(src, .proc/grind), 2)
return
else
grinding = FALSE
icon_state = board_icon

/obj/vehicle/ridden/scooter/skateboard/MouseDrop(atom/over_object)
. = ..()
Expand All @@ -94,20 +156,42 @@
to_chat(M, "<span class='warning'>You can't lift this up when somebody's on it.</span>")
return
if(over_object == M)
var/obj/item/melee/skateboard/board = new /obj/item/melee/skateboard()
var/board = new board_item_type(get_turf(M))
M.put_in_hands(board)
qdel(src)

/obj/vehicle/ridden/scooter/skateboard/AltClick(mob/user)
var/datum/component/riding/R = src.GetComponent(/datum/component/riding)
if (!adjusted_speed)
R.vehicle_move_delay = 0
to_chat(user, "<span class='notice'>You adjust the wheels on [src] to make it go faster.</span>")
adjusted_speed = TRUE
/obj/vehicle/ridden/scooter/skateboard/pro
name = "skateboard"
desc = "A RaDSTORMz brand professional skateboard. Looks a lot more stable than the average board."
icon_state = "skateboard2"
board_icon = "skateboard2"
board_item_type = /obj/item/melee/skateboard/pro
instability = 6

/obj/vehicle/ridden/scooter/skateboard/hoverboard/
name = "hoverboard"
desc = "A blast from the past, so retro!"
board_item_type = /obj/item/melee/skateboard/hoverboard
instability = 3
icon_state = "hoverboard_red"
board_icon = "hoverboard_red"

/obj/vehicle/ridden/scooter/skateboard/hoverboard/screwdriver_act(mob/living/user, obj/item/I)
return FALSE

/obj/vehicle/ridden/scooter/skateboard/hoverboard/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/stack/rods))
return
else
R.vehicle_move_delay = 1
to_chat(user, "<span class='notice'>You adjust the wheels on [src] to make it go slower.</span>")
adjusted_speed = FALSE
return ..()

/obj/vehicle/ridden/scooter/skateboard/hoverboard/admin
name = "\improper Board Of Directors"
desc = "The engineering complexity of a spaceship concentrated inside of a board. Just as expensive, too."
board_item_type = /obj/item/melee/skateboard/hoverboard/admin
instability = 0
icon_state = "hoverboard_nt"
board_icon = "hoverboard_nt"

//CONSTRUCTION
/obj/item/scooter_frame
Expand Down
37 changes: 37 additions & 0 deletions code/modules/vehicles/vehicle_actions.dm
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,40 @@
owner.say("Thank you for the fun ride, [clown.name]!")
last_thank_time = world.time
C.ThanksCounter()

/datum/action/vehicle/ridden/scooter/skateboard/ollie
name = "Ollie"
desc = "Get some air! Land on a table to do a gnarly grind."
button_icon_state = "skateboard_ollie"
///Cooldown to next jump
var/next_ollie

/datum/action/vehicle/ridden/scooter/skateboard/ollie/Trigger()
if(world.time > next_ollie)
var/obj/vehicle/ridden/scooter/skateboard/V = vehicle_target
if (V.grinding)
return
var/mob/living/L = owner
var/turf/landing_turf = get_step(V.loc, V.dir)
L.adjustStaminaLoss(V.instability*2)
if (L.getStaminaLoss() >= 100)
playsound(src, 'sound/effects/bang.ogg', 20, TRUE)
V.unbuckle_mob(L)
L.throw_at(landing_turf, 2, 2)
L.Paralyze(40)
V.visible_message("<span class='danger'>[L] misses the landing and falls on [L.p_their()] face!</span>")
else
L.spin(4, 1)
animate(L, pixel_y = -6, time = 4)
animate(V, pixel_y = -6, time = 3)
playsound(V, 'sound/vehicles/skateboard_ollie.ogg', 50, TRUE)
passtable_on(L, VEHICLE_TRAIT)
V.pass_flags |= PASSTABLE
L.Move(landing_turf, vehicle_target.dir)
passtable_off(L, VEHICLE_TRAIT)
V.pass_flags &= ~PASSTABLE
if(locate(/obj/structure/table) in V.loc.contents)
V.grinding = TRUE
V.icon_state = "[V.board_icon]-grind"
addtimer(CALLBACK(V, /obj/vehicle/ridden/scooter/skateboard/.proc/grind), 2)
next_ollie = world.time + 5
2 changes: 2 additions & 0 deletions code/modules/vending/games.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
/obj/item/hourglass = 2,
/obj/item/camera = 3)
contraband = list(/obj/item/dice/fudge = 9)
premium = list(/obj/item/melee/skateboard/pro = 3,
/obj/item/melee/skateboard/hoverboard = 1)
refill_canister = /obj/item/vending_refill/games
default_price = 10
extra_price = 25
Expand Down
Binary file modified icons/mob/actions/actions_vehicle.dmi
Binary file not shown.
Binary file modified icons/mob/inhands/items_lefthand.dmi
Binary file not shown.
Binary file modified icons/mob/inhands/items_righthand.dmi
Binary file not shown.
Binary file modified icons/obj/items_and_weapons.dmi
Binary file not shown.
Binary file modified icons/obj/vehicles.dmi
Binary file not shown.
Binary file added sound/vehicles/skateboard_ollie.ogg
Binary file not shown.
Binary file added sound/vehicles/skateboard_roll.ogg
Binary file not shown.

0 comments on commit 93c2dc0

Please sign in to comment.