Merge pull request #5085 from VOREStation/port-shuttle-piloting

Port Shuttle Pilot Helmet Animation
This commit is contained in:
Neerti
2018-03-22 22:34:48 -04:00
committed by GitHub
11 changed files with 251 additions and 41 deletions

View File

@@ -415,6 +415,8 @@
desc = "It's an extra resilient airlock intended for spacefaring vessels." desc = "It's an extra resilient airlock intended for spacefaring vessels."
icon = 'icons/obj/doors/shuttledoors.dmi' icon = 'icons/obj/doors/shuttledoors.dmi'
explosion_resistance = 20 explosion_resistance = 20
opacity = 0
glass = 1
assembly_type = /obj/structure/door_assembly/door_assembly_voidcraft assembly_type = /obj/structure/door_assembly/door_assembly_voidcraft
// Airlock opens from top-bottom instead of left-right. // Airlock opens from top-bottom instead of left-right.

View File

@@ -0,0 +1,201 @@
//Pilot
/obj/item/clothing/head/pilot
name = "pilot helmet"
desc = "Standard pilot gear. Protects the head from impacts."
icon_state = "pilot_helmet1"
item_icons = list(slot_head_str = 'icons/mob/pilot_helmet.dmi')
sprite_sheets = list(
SPECIES_TESHARI = 'icons/mob/species/seromi/pilot_helmet.dmi'
)
flags = THICKMATERIAL
armor = list(melee = 20, bullet = 10, laser = 10, energy = 5, bomb = 10, bio = 0, rad = 0)
flags_inv = HIDEEARS
cold_protection = HEAD
min_cold_protection_temperature = HELMET_MIN_COLD_PROTECTION_TEMPERATURE
heat_protection = HEAD
max_heat_protection_temperature = HELMET_MAX_HEAT_PROTECTION_TEMPERATURE
w_class = ITEMSIZE_NORMAL
var/obj/machinery/computer/shuttle_control/web/shuttle_comp
var/obj/screen/pilot_hud
var/list/images
var/list/raw_images
var/last_status
/obj/item/clothing/head/pilot/initialize()
. = ..()
images = list()
raw_images = list()
pilot_hud = new(src)
pilot_hud.screen_loc = "1,1"
pilot_hud.icon = 'icons/obj/piloting_overlay.dmi'
pilot_hud.icon_state = "dimmer"
pilot_hud.layer = SCREEN_LAYER
pilot_hud.plane = PLANE_FULLSCREEN
pilot_hud.mouse_opacity = 0
pilot_hud.alpha = 0
var/image/I
I = image(pilot_hud.icon,pilot_hud,"top_bar",layer=SCREEN_LAYER+1)
I.appearance_flags = RESET_ALPHA
I.alpha = 145
images["top_bar"] = I
raw_images += I
I = image(pilot_hud.icon,pilot_hud,"top_dots",layer=SCREEN_LAYER+1)
I.appearance_flags = RESET_ALPHA
I.alpha = 200
images["topdots"] = I
raw_images += I
I = image(pilot_hud.icon,pilot_hud,"words_discon",layer=SCREEN_LAYER+1) //words_standby, words_flying, words_spool, words_discon
I.appearance_flags = RESET_ALPHA
I.alpha = 200
images["top_words"] = I
raw_images += I
I = image(pilot_hud.icon,pilot_hud,"",layer=SCREEN_LAYER+1)
I.appearance_flags = RESET_ALPHA
I.alpha = 200
images["charging"] = I
raw_images += I
I = image(pilot_hud.icon,pilot_hud,"left_bar",layer=SCREEN_LAYER+1)
I.appearance_flags = RESET_ALPHA
I.alpha = 0
images["left_bar"] = I
raw_images += I
I = image(pilot_hud.icon,pilot_hud,"right_bar",layer=SCREEN_LAYER+1)
I.appearance_flags = RESET_ALPHA
I.alpha = 0
images["right_bar"] = I
raw_images += I
I = image(pilot_hud.icon,pilot_hud,"flyboxes",layer=SCREEN_LAYER+1)
I.appearance_flags = RESET_ALPHA
I.alpha = 0
images["flyboxes"] = I
raw_images += I
I = image(pilot_hud.icon,pilot_hud,"horizon",layer=SCREEN_LAYER+1)
I.appearance_flags = RESET_ALPHA
I.alpha = 0
images["horizon"] = I
raw_images += I
/obj/item/clothing/head/pilot/proc/update_hud(var/status)
if(last_status == status)
return
last_status = status
if(status == SHUTTLE_INTRANSIT)
var/image/I = images["top_words"]
I.icon_state = "words_flying"
I = images["left_bar"]
I.alpha = 200
I = images["right_bar"]
I.alpha = 200
I = images["flyboxes"]
I.alpha = 200
I = images["horizon"]
I.alpha = 200
I = images["charging"]
I.icon_state = ""
animate(pilot_hud,alpha=255,time=3 SECONDS)
else if(status == SHUTTLE_IDLE)
var/image/I = images["top_words"]
I.icon_state = "words_standby"
I = images["left_bar"]
I.alpha = 0
I = images["right_bar"]
I.alpha = 0
I = images["flyboxes"]
I.alpha = 0
I = images["horizon"]
I.alpha = 0
I = images["charging"]
I.icon_state = ""
animate(pilot_hud,alpha=0,time=3 SECONDS)
else if(status == SHUTTLE_WARMUP)
var/image/I = images["top_words"]
I.icon_state = "words_spool"
I = images["left_bar"]
I.alpha = 200
I = images["right_bar"]
I.alpha = 200
I = images["flyboxes"]
I.alpha = 0
I = images["horizon"]
I.alpha = 0
I = images["charging"]
I.icon_state = "charging"
animate(pilot_hud,alpha=255,time=3 SECONDS)
else if(status == "discon")
var/image/I = images["top_words"]
I.icon_state = "words_discon"
I = images["left_bar"]
I.alpha = 0
I = images["right_bar"]
I.alpha = 0
I = images["flyboxes"]
I.alpha = 0
I = images["horizon"]
I.alpha = 0
I = images["charging"]
I.icon_state = ""
animate(pilot_hud,alpha=0,time=3 SECONDS)
/obj/item/clothing/head/pilot/verb/hud_colors()
set name = "Alter HUD color"
set desc = "Change the color of the piloting HUD."
set category = "Object"
set src in usr
var/newcolor = input(usr,"Pick a color!","HUD Color") as null|color
if(newcolor)
for(var/img in list("top_words","left_bar","right_bar","flyboxes"))
var/image/I = images[img]
I.color = newcolor
/obj/item/clothing/head/pilot/Destroy()
for(var/img in raw_images)
var/image/I = img
I.loc = null
shuttle_comp = null
qdel(pilot_hud)
return ..()
/obj/item/clothing/head/pilot/equipped(var/mob/user,var/slot)
. = ..()
if(slot == slot_head && user.client)
user.client.screen |= pilot_hud
user.client.images |= raw_images
/obj/item/clothing/head/pilot/dropped(var/mob/user)
. = ..()
if(user.client)
user.client.screen -= pilot_hud
user.client.images -= raw_images
/obj/item/clothing/head/pilot/alt
name = "pilot helmet"
desc = "Standard pilot gear. Protects the head from impacts. This one has a retractable visor"
icon_state = "pilot_helmet2"
action_button_name = "Toggle Visor"
/obj/item/clothing/head/pilot/alt/attack_self(mob/user as mob)
if(src.icon_state == initial(icon_state))
src.icon_state = "[icon_state]up"
user << "You raise the visor on the pilot helmet."
else
src.icon_state = initial(icon_state)
user << "You lower the visor on the pilot helmet."
update_clothing_icon() //so our mob-overlays update

View File

@@ -90,7 +90,7 @@
make_sounds(origin, HYPERSPACE_END) make_sounds(origin, HYPERSPACE_END)
return //someone cancelled the launch return //someone cancelled the launch
on_shuttle_departure() on_shuttle_departure(origin)
moving_status = SHUTTLE_INTRANSIT //shouldn't matter but just to be safe moving_status = SHUTTLE_INTRANSIT //shouldn't matter but just to be safe
move(origin, destination) move(origin, destination)
@@ -127,10 +127,10 @@
depart_time = world.time depart_time = world.time
on_shuttle_departure(departing)
moving_status = SHUTTLE_INTRANSIT moving_status = SHUTTLE_INTRANSIT
on_shuttle_departure(departing)
move(departing, interim, direction) move(departing, interim, direction)
interim.shuttle_arrived() interim.shuttle_arrived()

View File

@@ -16,6 +16,7 @@
var/autopilot_first_delay = null // If your want your shuttle to stay for a different amount of time for the first time, set this. var/autopilot_first_delay = null // If your want your shuttle to stay for a different amount of time for the first time, set this.
var/can_rename = TRUE // Lets the pilot rename the shuttle. Only available once. var/can_rename = TRUE // Lets the pilot rename the shuttle. Only available once.
category = /datum/shuttle/web_shuttle category = /datum/shuttle/web_shuttle
var/list/obj/item/clothing/head/pilot/helmets
/datum/shuttle/web_shuttle/New() /datum/shuttle/web_shuttle/New()
current_area = locate(current_area) current_area = locate(current_area)
@@ -27,10 +28,12 @@
autopilot_delay = autopilot_first_delay autopilot_delay = autopilot_first_delay
if(!visible_name) if(!visible_name)
visible_name = name visible_name = name
helmets = list()
..() ..()
/datum/shuttle/web_shuttle/Destroy() /datum/shuttle/web_shuttle/Destroy()
qdel(web_master) qdel(web_master)
helmets.Cut()
return ..() return ..()
@@ -42,16 +45,30 @@
..() ..()
last_move = world.time last_move = world.time
/datum/shuttle/web_shuttle/short_jump()
. = ..()
update_helmets()
/datum/shuttle/web_shuttle/long_jump()
. = ..()
update_helmets()
/datum/shuttle/web_shuttle/on_shuttle_departure() /datum/shuttle/web_shuttle/on_shuttle_departure()
. = ..()
web_master.on_shuttle_departure() web_master.on_shuttle_departure()
update_helmets()
/datum/shuttle/web_shuttle/on_shuttle_arrival() /datum/shuttle/web_shuttle/on_shuttle_arrival()
. = ..()
web_master.on_shuttle_arrival() web_master.on_shuttle_arrival()
update_helmets()
/datum/shuttle/web_shuttle/proc/build_destinations() /datum/shuttle/web_shuttle/proc/build_destinations()
return return
/datum/shuttle/web_shuttle/process() /datum/shuttle/web_shuttle/process()
update_helmets()
if(moving_status == SHUTTLE_IDLE) if(moving_status == SHUTTLE_IDLE)
if(web_master.autopath) // We're currently flying a path. if(web_master.autopath) // We're currently flying a path.
autopilot_say("Continuing route.") autopilot_say("Continuing route.")
@@ -92,6 +109,20 @@
autopilot_say("Taking off.") autopilot_say("Taking off.")
web_master.process_autopath() web_master.process_autopath()
/datum/shuttle/web_shuttle/proc/update_helmets()
for(var/helm in helmets)
if(!helm)
helmets -= helm
continue
var/obj/item/clothing/head/pilot/H = helm
if(!H.shuttle_comp || get_area(H.shuttle_comp) != get_area(H))
H.shuttle_comp = null
H.audible_message("<span class='warning'>\The [H] pings as it loses it's connection with the ship.</span>")
H.update_hud("discon")
helmets -= H
else
H.update_hud(moving_status)
/datum/shuttle/web_shuttle/proc/adjust_autopilot(on) /datum/shuttle/web_shuttle/proc/adjust_autopilot(on)
if(on) if(on)
if(autopilot) if(autopilot)
@@ -154,6 +185,19 @@
for(var/lost in find_sensors) for(var/lost in find_sensors)
log_debug("[my_area] shuttle computer couldn't find [lost] sensor!") log_debug("[my_area] shuttle computer couldn't find [lost] sensor!")
/obj/machinery/computer/shuttle_control/web/attackby(obj/I, mob/user)
var/datum/shuttle/web_shuttle/shuttle = shuttle_controller.shuttles[shuttle_tag]
if(shuttle && istype(I,/obj/item/clothing/head/pilot))
var/obj/item/clothing/head/pilot/H = I
H.shuttle_comp = src
shuttle.helmets |= I
to_chat(user,"<span class='notice'>You register the helmet with the ship's console.</span>")
shuttle.update_helmets()
return
return ..()
// Fairly copypasta-y. // Fairly copypasta-y.
/obj/machinery/computer/shuttle_control/web/attack_hand(mob/user) /obj/machinery/computer/shuttle_control/web/attack_hand(mob/user)
if(..(user)) if(..(user))

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

View File

@@ -1,37 +0,0 @@
//Pilot
/obj/item/clothing/head/pilot
name = "pilot helmet"
desc = "Standard pilot gear. Protects the head from impacts."
icon_state = "pilot_helmet1"
item_icons = list(slot_head_str = 'maps/southern_cross/icons/mob/sc_head.dmi')
icon = 'maps/southern_cross/icons/obj/sc_hats.dmi'
sprite_sheets = list(
"Teshari" = 'maps/southern_cross/icons/mob/species/teshari/sc_head.dmi'
)
flags = THICKMATERIAL
armor = list(melee = 20, bullet = 10, laser = 10, energy = 5, bomb = 10, bio = 0, rad = 0)
flags_inv = HIDEEARS
cold_protection = HEAD
min_cold_protection_temperature = HELMET_MIN_COLD_PROTECTION_TEMPERATURE
heat_protection = HEAD
max_heat_protection_temperature = HELMET_MAX_HEAT_PROTECTION_TEMPERATURE
w_class = ITEMSIZE_NORMAL
/obj/item/clothing/head/pilot/alt
name = "pilot helmet"
desc = "Standard pilot gear. Protects the head from impacts. This one has a retractable visor"
icon_state = "pilot_helmet2"
sprite_sheets = list(
"Teshari" = 'maps/southern_cross/icons/mob/species/teshari/sc_head.dmi'
)
action_button_name = "Toggle Visor"
/obj/item/clothing/head/pilot/alt/attack_self(mob/user as mob)
if(src.icon_state == initial(icon_state))
src.icon_state = "[icon_state]up"
user << "You raise the visor on the pilot helmet."
else
src.icon_state = initial(icon_state)
user << "You lower the visor on the pilot helmet."
update_clothing_icon() //so our mob-overlays update

View File

@@ -25,7 +25,6 @@
#include "items/headset_sc.dm" #include "items/headset_sc.dm"
#include "items/clothing/sc_suit.dm" #include "items/clothing/sc_suit.dm"
#include "items/clothing/sc_under.dm" #include "items/clothing/sc_under.dm"
#include "items/clothing/sc_head.dm"
#include "items/clothing/sc_accessory.dm" #include "items/clothing/sc_accessory.dm"
#include "job/outfits.dm" #include "job/outfits.dm"
#include "structures/closets/engineering.dm" #include "structures/closets/engineering.dm"

View File

@@ -1358,6 +1358,7 @@
#include "code\modules\clothing\head\jobs.dm" #include "code\modules\clothing\head\jobs.dm"
#include "code\modules\clothing\head\misc.dm" #include "code\modules\clothing\head\misc.dm"
#include "code\modules\clothing\head\misc_special.dm" #include "code\modules\clothing\head\misc_special.dm"
#include "code\modules\clothing\head\pilot_helmet.dm"
#include "code\modules\clothing\head\soft_caps.dm" #include "code\modules\clothing\head\soft_caps.dm"
#include "code\modules\clothing\head\solgov.dm" #include "code\modules\clothing\head\solgov.dm"
#include "code\modules\clothing\masks\boxing.dm" #include "code\modules\clothing\masks\boxing.dm"