Skip to content

Commit

Permalink
Merge pull request Civ13#2875 from Bierkraan/working-branch
Browse files Browse the repository at this point in the history
Fix vehicle speed bug, updated CV90
  • Loading branch information
Bierkraan authored May 26, 2024
2 parents 49d4d93 + 93d4611 commit bd2090d
Show file tree
Hide file tree
Showing 24 changed files with 221 additions and 122 deletions.
5 changes: 4 additions & 1 deletion code/game/mob/keyboard.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

if (ishuman(src) && !src.stat)
var/mob/living/human/H = src
H.look_into_distance(src)
if (H.using_drone)
using_drone.toggle_state()
else
H.look_into_distance(src)
return
return FALSE

Expand Down
4 changes: 0 additions & 4 deletions code/game/objects/controls.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
icon = 'icons/obj/structures.dmi'
icon_state = "blast_control"
anchored = TRUE
cooldown = 3
distance = 5
density = FALSE
not_movable = TRUE
Expand Down Expand Up @@ -325,7 +324,6 @@
icon = 'icons/obj/structures.dmi'
icon_state = "gate_control"
anchored = TRUE
cooldown = 0
distance = 6
density = TRUE
not_movable = TRUE
Expand Down Expand Up @@ -419,7 +417,6 @@
layer = MOB_LAYER + 0.01
climbable = TRUE
open = FALSE
cooldown = 0
bound_width = 32
bound_height = 64 // Only left facing version present because the rest of those variables, a solution would be to separate the open states from the closed states by making two separate .dmi files, where one's icon sizes are 64x32px, while the other one is 32x64px (not tested though)

Expand Down Expand Up @@ -541,7 +538,6 @@
icon = 'icons/obj/structures.dmi'
icon_state = "lift_panel2"
anchored = TRUE
cooldown = 5
distance = 5
density = FALSE
not_movable = TRUE
Expand Down
11 changes: 6 additions & 5 deletions code/game/objects/effects/explosion_particles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,13 @@
if (istype(loca, /turf/)) location = loca
else location = get_turf(loca)

/datum/effect/system/explosion/proc/start()
/datum/effect/system/explosion/proc/start(var/create_smoke)
new/obj/effect/explosion( location )
var/datum/effect/system/expl_particles/P = new/datum/effect/system/expl_particles()
P.set_up(10,location)
P.start()
spawn(5)
var/datum/effect/effect/system/smoke_spread/S = new/datum/effect/effect/system/smoke_spread()
S.set_up(5,0,location,null)
S.start()
if(create_smoke)
spawn(5)
var/datum/effect/effect/system/smoke_spread/S = new/datum/effect/effect/system/smoke_spread()
S.set_up(5,0,location,null)
S.start()
3 changes: 2 additions & 1 deletion code/game/objects/explosion.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

/proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impact_range, flash_range, adminlog = TRUE, z_transfer = UP|DOWN, is_rec = config.use_recursive_explosions, sound = "explosion")
/proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impact_range, flash_range, adminlog = TRUE, z_transfer = UP|DOWN, is_rec = config.use_recursive_explosions, sound = "explosion", create_smoke = TRUE)
/*
// TODO: splits explosions bigger than 5x5 into sub-explosions
var/num_explosions = devastation_range/5
Expand All @@ -23,6 +23,7 @@
data.rec_pow = max(0,devastation_range) * 2 + max(0,heavy_impact_range) + max(0,light_impact_range)
if (sound)
data.sound = sound
data.create_smoke = create_smoke
// queue work
processes.callproc.queue(processes.explosion, TYPE_PROC_REF(/process/explosion, queue), list(data), 1)

Expand Down
107 changes: 84 additions & 23 deletions code/game/objects/items/devices/drone.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
/obj/item/drone_controller/proc/start_move_drone(var/direction)
moving_dir = direction
if(!connected_drone) return

if(connected_drone.broken)
if(controller)
if(!connected_drone.can_move) return
if(connected_drone.broken && controller)
if(!connected_drone.can_fly)
to_chat(controller, SPAN_DANGER("\The [connected_drone]\'s tracks are broken, repair it with a welding tool."))
return
if(!is_moving)
Expand All @@ -61,6 +61,7 @@
/obj/item/drone_controller/proc/move_drone()
if(!is_moving) return
if(!connected_drone) return
if(!connected_drone.can_move) return
if(connected_drone.broken) return
if(executing_move) return
executing_move = TRUE
Expand All @@ -71,23 +72,38 @@
executing_move = FALSE
move_drone()

/obj/item/drone_controller/proc/toggle_state()
if(connected_drone && connected_drone.can_fly && !connected_drone.broken)
to_chat(controller, SPAN_NOTICE("You [connected_drone.flying ? "decent \the [src] to the ground." : "fly \the [src] into the air."]"))
connected_drone.toggle_state()

/obj/structure/drone
name = "drone"
desc = "A movable drone."
icon = 'icons/obj/vehicles/vehicleparts.dmi'
icon_state = "goliath"
var/obj/item/drone_controller/connected_controller = null
var/movement_delay = 5
var/movement_sound = 'sound/machines/rc_car.ogg'
var/has_special = FALSE

var/health = 100
var/broken = FALSE
var/can_move = TRUE
var/can_fly = FALSE
var/flying = FALSE

var/obj/item/weapon/grenade/payload = null
var/has_special = FALSE

var/movement_sound = 'sound/machines/rc_car.ogg'

var/starting_snd = null
var/running_snd = null
var/ending_snd = null

var/starting_snd_len = 26
var/running_snd_len = 11

heavy_armor_penetration = 0
var/devastation_range = 2
var/heavy_impact_range = 3
var/light_impact_range = 5
var/flash_range = 6

/obj/structure/drone/attackby(obj/item/I as obj, mob/user)
if(istype(I, /obj/item/drone_controller))
Expand All @@ -109,6 +125,27 @@
else
..()

/obj/structure/drone/proc/toggle_state()
if(can_fly)
can_move = FALSE
if(!flying)
animate(src, pixel_y = 16, time = starting_snd_len, easing = CUBIC_EASING | EASE_IN)
playsound(loc, starting_snd, 50, FALSE, 2)
spawn(starting_snd_len)
can_move = TRUE
flying = TRUE
icon_state = "[initial(icon_state)]_flying"
running_sound()
else

playsound(loc, ending_snd, 50, FALSE, 2)
spawn(5)
animate(src, pixel_y = 0, time = 5, easing = BOUNCE_EASING | EASE_OUT)
spawn(5)
can_move = TRUE
flying = FALSE
icon_state = initial(icon_state)

/obj/structure/drone/proc/try_destroy()
if (health <= 0)
health = 0
Expand Down Expand Up @@ -148,9 +185,30 @@
..()

/obj/structure/drone/proc/do_special()
return

/obj/structure/drone/Move()
..()
playsound(loc, movement_sound, 100, TRUE)

/obj/structure/drone/proc/running_sound()
if (flying)
playsound(loc, pick(running_snd), 50, FALSE, 2)
spawn(running_snd_len)
running_sound()
return

/obj/structure/drone/goliath
name = "Goliath SdKfz. 302"
desc = "The SdKfz. 302, also known as the Goliath, is a remote-controlled tracked mine carrying either 60 or 100 kg of high explosives. It is used for destroying tanks, disrupting dense infantry formations, and the demolition of buildings or bridges."
movement_delay = 4.5
has_special = TRUE
heavy_armor_penetration = 40

/obj/structure/drone/goliath/do_special()
var/turf/T = get_turf(src)
qdel(src)
explosion(T, devastation_range, heavy_impact_range, light_impact_range, flash_range)
explosion(T, 2, 3, 5, 6)
for(var/obj/structure/vehicleparts/frame/F in range(1,src))
for (var/mob/M in F.axis.transporting)
shake_camera(M, 3, 3)
Expand Down Expand Up @@ -211,17 +269,20 @@
F.update_icon()
return

/obj/structure/drone/Move()
..()
playsound(loc, movement_sound, 100, TRUE)
/obj/structure/drone/flying
name = "drone"
desc = "A flying drone."
icon_state = "drone"
health = 50
movement_delay = 2
movement_sound = null
can_fly = TRUE

/obj/structure/drone/goliath
name = "Goliath SdKfz. 302"
desc = "The SdKfz. 302, also known as the Goliath, is a remote-controlled tracked mine carrying either 60 or 100 kg of high explosives. It is used for destroying tanks, disrupting dense infantry formations, and the demolition of buildings or bridges."
movement_delay = 4.5
has_special = TRUE
heavy_armor_penetration = 40
devastation_range = 2
heavy_impact_range = 3
light_impact_range = 5
flash_range = 6
movement_sound = null

starting_snd = 'sound/machines/drone_startup.ogg'
running_snd = list('sound/machines/drone_active1.ogg', 'sound/machines/drone_active2.ogg', 'sound/machines/drone_active3.ogg')
ending_snd = 'sound/machines/drone_shutdown.ogg'

/obj/structure/drone/flying/Move()
..()
5 changes: 4 additions & 1 deletion code/game/objects/structures/transports.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
var/wheeled = FALSE
var/obj/item/vehicleparts/wheel/dwheel = null
var/moving = FALSE
var/movement_processes = 0
var/obj/structure/engine/internal/engine = null
var/obj/structure/vehicleparts/axis/axis = null
var/obj/item/weapon/reagent_containers/glass/barrel/fueltank/fueltank = null
Expand Down Expand Up @@ -117,12 +118,14 @@
movementloop()

/obj/structure/vehicle/proc/movementloop()
if (moving == TRUE && driver)
if (moving && driver && !movement_processes)
movement_processes++
if (do_vehicle_check() && axis.currentspeed > 0)
do_move(driver.dir)
else
axis.currentspeed = 0
spawn(vehicle_m_delay+1)
movement_processes--
movementloop()
return
else
Expand Down
7 changes: 6 additions & 1 deletion code/modules/1713/machinery/modular_vehicles/axis.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var/global/list/tank_names_nato = list("Alpha", "Bravo", "Charlie", "Delta", "Ec
var/maxdist = 5 //the highest of length and width
var/turntimer = 15
var/doorcode = 0
var/movement_processes = 0
/obj/structure/vehicleparts/axis/ex_act(severity)
switch(severity)
if (1.0)
Expand Down Expand Up @@ -46,12 +47,14 @@ var/global/list/tank_names_nato = list("Alpha", "Bravo", "Charlie", "Delta", "Ec
movementsound()

/obj/structure/vehicleparts/axis/proc/movementloop()
if (moving == TRUE)
if (moving && !movement_processes)
get_weight()
movement_processes++
if (do_vehicle_check() && currentspeed > 0)
for (var/obj/structure/vehicleparts/movement/W in wheels)
if (W.broken)
moving = FALSE
movement_processes--
stopmovementloop()
return
else
Expand All @@ -60,9 +63,11 @@ var/global/list/tank_names_nato = list("Alpha", "Bravo", "Charlie", "Delta", "Ec
else
currentspeed = 0
moving = FALSE
movement_processes--
stopmovementloop()
return
spawn(vehicle_m_delay+1)
movement_processes--
movementloop()
return
else
Expand Down
28 changes: 14 additions & 14 deletions code/modules/1713/machinery/modular_vehicles/carparts/apcs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -233,40 +233,40 @@
override_roof_icon = "mt_front_left_roof"
override_frame_icon = "mt_front_left_frame"

/obj/structure/vehicleparts/frame/cv90/front
w_front = list("mt_front_frame",TRUE,TRUE,35,50,FALSE,FALSE)
override_roof_icon = "mt_front_roof"
override_frame_icon = "mt_front_frame"

/obj/structure/vehicleparts/frame/cv90/rf
w_front = list("mt_front_left_frame",TRUE,TRUE,35,50,FALSE,FALSE)
w_right = list("c_wall",TRUE,TRUE,35,50,FALSE,FALSE)
override_roof_icon = "mt_front_right_roof"
override_frame_icon = "mt_front_right_frame"

/obj/structure/vehicleparts/frame/cv90/lfc
/obj/structure/vehicleparts/frame/cv90/left
w_left = list("mt_left_frame",TRUE,TRUE,35,50,FALSE,FALSE)
override_roof_icon = "mt_left_roof"
override_frame_icon = "mt_left_frame"

/obj/structure/vehicleparts/frame/cv90/rfc
/obj/structure/vehicleparts/frame/cv90/right
w_right = list("mt_right_frame",TRUE,TRUE,35,50,FALSE,FALSE)
override_roof_icon = "mt_right_roof"
override_frame_icon = "mt_right_frame"

/obj/structure/vehicleparts/frame/cv90/lbc
w_left = list("mt_left_frame",TRUE,TRUE,35,50,FALSE,FALSE)
override_roof_icon = "mt_front_left_roof"
override_frame_icon = "mt_front_left_frame"

/obj/structure/vehicleparts/frame/cv90/rbc
w_right = list("mt_right_frame",TRUE,TRUE,35,50,FALSE,FALSE)
override_roof_icon = "mt_front_right_roof"
override_frame_icon = "mt_front_right_frame"

/obj/structure/vehicleparts/frame/cv90/lb
w_back = list("mt_back_left_frame",TRUE,TRUE,35,50,TRUE,TRUE)
w_back = list("mt_back_left_frame",TRUE,TRUE,35,50,FALSE,FALSE)
w_left = list("c_wall",TRUE,TRUE,35,50,FALSE,FALSE)
override_roof_icon = "mt_back_left_roof"
override_frame_icon = "mt_back_left_frame"

/obj/structure/vehicleparts/frame/cv90/back
w_back = list("mt_back_door_frame",TRUE,TRUE,35,50,TRUE,TRUE)
override_roof_icon = "mt_back_door_roof"
override_frame_icon = "mt_back_door_frame"

/obj/structure/vehicleparts/frame/cv90/rb
w_back = list("mt_right_back_frame",TRUE,TRUE,35,50,TRUE,TRUE)
w_back = list("mt_right_back_frame",TRUE,TRUE,35,50,FALSE,FALSE)
w_right = list("c_wall",TRUE,TRUE,35,50,FALSE,FALSE)
override_roof_icon = "mt_back_right_roof"
override_frame_icon = "mt_back_right_frame"
Expand Down
16 changes: 10 additions & 6 deletions code/modules/1713/machinery/modular_vehicles/carparts/premade.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1175,16 +1175,20 @@
axis = /obj/structure/vehicleparts/axis/heavy/cv90
tocreate = list(
"1,1" = list(/obj/structure/vehicleparts/movement/tracks/right,/obj/structure/vehicleparts/frame/cv90/rf),
"2,1" = list(/obj/structure/vehicleparts/movement/tracks/left,/obj/structure/vehicleparts/frame/cv90/lf,/obj/structure/bed/chair/drivers/tank),
"2,1" = list(/obj/structure/vehicleparts/frame/cv90/front),
"3,1" = list(/obj/structure/vehicleparts/movement/tracks/left,/obj/structure/vehicleparts/frame/cv90/lf,/obj/structure/bed/chair/drivers/tank),

"1,2" = list(/obj/structure/vehicleparts/frame/cv90/rfc,/obj/structure/turret/cv90{density = 0}),
"2,2" = list(/obj/structure/vehicleparts/frame/cv90/lfc),
"1,2" = list(/obj/structure/vehicleparts/frame/cv90/right,/obj/structure/lamp/lamp_small/tank/red,/obj/item/ammo_magazine/a35mm_fap,/obj/item/ammo_magazine/a35mm_fap,/obj/item/ammo_magazine/a35mm_hei,/obj/item/ammo_magazine/a35mm_hei),
"2,2" = list(/obj/structure/vehicleparts/frame/cv90,/obj/structure/turret/cv90{density = 0}),
"3,2" = list(/obj/structure/vehicleparts/frame/cv90/left,/obj/item/ammo_magazine/m249,/obj/item/ammo_magazine/m249,/obj/item/ammo_magazine/m249),

"1,3" = list(/obj/structure/vehicleparts/frame/cv90/rbc,/obj/structure/lamp/lamp_small/tank/red,/obj/item/ammo_magazine/a35mm_fap,/obj/item/ammo_magazine/a35mm_fap,/obj/item/ammo_magazine/a35mm_hei,/obj/item/ammo_magazine/a35mm_hei),
"2,3" = list(/obj/structure/vehicleparts/frame/cv90/lbc,/obj/item/ammo_magazine/m249,/obj/item/ammo_magazine/m249,/obj/item/ammo_magazine/m249),
"1,3" = list(/obj/structure/vehicleparts/frame/cv90/right),
"2,3" = list(/obj/structure/vehicleparts/frame/cv90),
"3,3" = list(/obj/structure/vehicleparts/frame/cv90/left),

"1,4" = list(/obj/structure/vehicleparts/movement/tracks/left/reversed,/obj/structure/vehicleparts/frame/cv90/rb,/obj/structure/engine/internal/diesel/premade/btr80,/obj/item/weapon/reagent_containers/glass/barrel/fueltank/tank/fueleddiesel{density = 0}),
"2,4" = list(/obj/structure/vehicleparts/movement/tracks/right/reversed,/obj/structure/vehicleparts/frame/cv90/lb),
"2,4" = list(/obj/structure/vehicleparts/frame/cv90/back),
"3,4" = list(/obj/structure/vehicleparts/movement/tracks/right/reversed,/obj/structure/vehicleparts/frame/cv90/lb),
)

/obj/effects/premadevehicles/apc/bradley
Expand Down
Loading

0 comments on commit bd2090d

Please sign in to comment.