mirror of
https://github.com/fulpstation/fulpstation.git
synced 2025-12-10 10:01:40 +00:00
Captain can buy a new escape shuttle (#21398)
* Captain can buy a new escape shuttle * A messy way to fix/avoid the issue * Hopefully fixes potential href exploit * Makes the code better so oranges wont yell at me anymore
This commit is contained in:
@@ -40,6 +40,8 @@ var/datum/subsystem/shuttle/SSshuttle
|
||||
|
||||
var/datum/round_event/shuttle_loan/shuttle_loan
|
||||
|
||||
var/shuttle_purchased = FALSE //If the station has purchased a replacement escape shuttle this round
|
||||
|
||||
/datum/subsystem/shuttle/New()
|
||||
NEW_SS_GLOBAL(SSshuttle)
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
var/description
|
||||
var/admin_notes
|
||||
|
||||
var/credit_cost = INFINITY
|
||||
|
||||
/datum/map_template/shuttle/New()
|
||||
shuttle_id = "[port_id]_[suffix]"
|
||||
mappath = "[prefix][shuttle_id].dmm"
|
||||
@@ -41,6 +43,7 @@
|
||||
/datum/map_template/shuttle/emergency/asteroid
|
||||
suffix = "asteroid"
|
||||
name = "Asteroid emergency shuttle"
|
||||
credit_cost = 3000
|
||||
|
||||
/datum/map_template/shuttle/emergency/bar
|
||||
suffix = "bar"
|
||||
@@ -51,6 +54,8 @@
|
||||
admin_notes = "Bardrone and Barmaid are GODMODE, will be automatically \
|
||||
sentienced by the fun balloon at 60 seconds before arrival. Has \
|
||||
medical facilities."
|
||||
credit_cost = 5000
|
||||
|
||||
|
||||
/datum/map_template/shuttle/emergency/birdboat
|
||||
suffix = "birdboat"
|
||||
@@ -59,6 +64,7 @@
|
||||
/datum/map_template/shuttle/emergency/box
|
||||
suffix = "box"
|
||||
name = "Box emergency shuttle"
|
||||
credit_cost = 2000
|
||||
|
||||
/datum/map_template/shuttle/emergency/clown
|
||||
suffix = "clown"
|
||||
@@ -74,6 +80,7 @@
|
||||
admin_notes = "Brig is replaced by anchored greentext book surrounded by \
|
||||
lavaland chasms, stationside door has been removed to prevent \
|
||||
accidental dropping. No brig."
|
||||
credit_cost = 8000
|
||||
|
||||
/datum/map_template/shuttle/emergency/cramped
|
||||
suffix = "cramped"
|
||||
@@ -88,14 +95,17 @@
|
||||
crates!"
|
||||
admin_notes = "Due to origin as a solo piloted secure vessel, has an \
|
||||
active GPS onboard labeled STV5."
|
||||
credit_cost = -7500
|
||||
|
||||
/datum/map_template/shuttle/emergency/meta
|
||||
suffix = "meta"
|
||||
name = "Meta emergency shuttle"
|
||||
credit_cost = 4000
|
||||
|
||||
/datum/map_template/shuttle/emergency/mini
|
||||
suffix = "mini"
|
||||
name = "Mini emergency shuttle"
|
||||
name = "Ministation emergency shuttle"
|
||||
credit_cost = 1000
|
||||
|
||||
/datum/map_template/shuttle/emergency/narnar
|
||||
suffix = "narnar"
|
||||
@@ -138,6 +148,7 @@
|
||||
I cannot tell you; it's space confidential. \
|
||||
Aw, come space on. Why not? \
|
||||
No, I can't. Anyway, how is your space roleplay life?"
|
||||
credit_cost = -5000
|
||||
|
||||
/datum/map_template/shuttle/emergency/goon
|
||||
suffix = "goon"
|
||||
@@ -145,6 +156,7 @@
|
||||
description = "The Nanotrasen Emergency Shuttle Port(NES Port for short) \
|
||||
is a shuttle used at other less known nanotrasen facilities \
|
||||
and has a more open inside for larger crowds."
|
||||
credit_cost = 3000
|
||||
|
||||
/datum/map_template/shuttle/emergency/wabbajack
|
||||
suffix = "wabbajack"
|
||||
@@ -158,6 +170,7 @@
|
||||
admin_notes = "If the crew can solve the puzzle, they will wake the \
|
||||
wabbajack statue. It will likely not end well. There's a reason it's \
|
||||
boarded up. Maybe they should have just left it alone."
|
||||
credit_cost = 15000
|
||||
|
||||
/datum/map_template/shuttle/ferry/base
|
||||
suffix = "base"
|
||||
|
||||
@@ -31,6 +31,7 @@ var/const/CALL_SHUTTLE_REASON_LENGTH = 12
|
||||
var/const/STATE_ALERT_LEVEL = 8
|
||||
var/const/STATE_CONFIRM_LEVEL = 9
|
||||
var/const/STATE_TOGGLE_EMERGENCY = 10
|
||||
var/const/STATE_PURCHASE = 11
|
||||
var/const/COMMUNICATION_COOLDOWN = 600
|
||||
var/const/COMMUNICATION_COOLDOWN_AI = 600
|
||||
|
||||
@@ -130,6 +131,34 @@ var/const/CALL_SHUTTLE_REASON_LENGTH = 12
|
||||
message_admins("[key_name_admin(usr)] has sent a message to the other server.")
|
||||
CM.lastTimeUsed = world.time
|
||||
|
||||
if("purchase_menu")
|
||||
state = STATE_PURCHASE
|
||||
|
||||
if("buyshuttle")
|
||||
if(authenticated==2)
|
||||
var/list/shuttles = flatten_list(shuttle_templates)
|
||||
var/datum/map_template/shuttle/S = locate(href_list["chosen_shuttle"]) in shuttles
|
||||
if(S && istype(S))
|
||||
if(SSshuttle.shuttle_purchased)
|
||||
usr << "A replacement shuttle has already been purchased."
|
||||
else
|
||||
if(SSshuttle.points >= S.credit_cost)
|
||||
var/obj/machinery/shuttle_manipulator/M = locate() in machines
|
||||
if(M)
|
||||
SSshuttle.shuttle_purchased = TRUE
|
||||
M.unload_preview()
|
||||
M.load_template(S)
|
||||
M.existing_shuttle = SSshuttle.emergency
|
||||
M.action_load(S)
|
||||
SSshuttle.points -= S.credit_cost
|
||||
minor_announce("[usr.name] has purchased [S.name] for [S.credit_cost] credits." , "Shuttle Purchase")
|
||||
message_admins("[key_name_admin(usr)] purchased [S.name].")
|
||||
feedback_add_details("shuttle_manipulator", S.name)
|
||||
else
|
||||
usr << "Something went wrong! The shuttle exchange system seems to be down."
|
||||
else
|
||||
usr << "Not enough credits."
|
||||
|
||||
if("callshuttle")
|
||||
src.state = STATE_DEFAULT
|
||||
if(src.authenticated)
|
||||
@@ -399,6 +428,7 @@ var/const/CALL_SHUTTLE_REASON_LENGTH = 12
|
||||
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=announce'>Make a Captain's Announcement</A> \]"
|
||||
if(cross_allowed)
|
||||
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=crossserver'>Send a message to an allied station</A> \]"
|
||||
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=purchase_menu'>Purchase Shuttle</A> \]"
|
||||
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=changeseclevel'>Change Alert Level</A> \]"
|
||||
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=emergencyaccess'>Emergency Maintenance Access</A> \]"
|
||||
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=nukerequest'>Request Nuclear Authentication Codes</A> \]"
|
||||
@@ -463,9 +493,19 @@ var/const/CALL_SHUTTLE_REASON_LENGTH = 12
|
||||
dat += "<b>Emergency Maintenance Access is currently <font color='green'>DISABLED</font></b>"
|
||||
dat += "<BR>Lift access restrictions on maintenance and external airlocks? <BR>\[ <A HREF='?src=\ref[src];operation=enableemergency'>OK</A> | <A HREF='?src=\ref[src];operation=viewmessage'>Cancel</A> \]"
|
||||
|
||||
if(STATE_PURCHASE)
|
||||
dat += "Budget: [SSshuttle.points] Credits.<BR>"
|
||||
for(var/shuttle_id in shuttle_templates)
|
||||
var/datum/map_template/shuttle/S = shuttle_templates[shuttle_id]
|
||||
if(S.credit_cost < INFINITY)
|
||||
dat += "[S.name] | [S.credit_cost] Credits<BR>"
|
||||
dat += "[S.description]<BR>"
|
||||
dat += "<A href='?src=\ref[src];operation=buyshuttle;chosen_shuttle=\ref[S]'>(<font color=red><i>Purchase</i></font>)</A><BR>"
|
||||
|
||||
dat += "<BR><BR>\[ [(src.state != STATE_DEFAULT) ? "<A HREF='?src=\ref[src];operation=main'>Main Menu</A> | " : ""]<A HREF='?src=\ref[user];mach_close=communications'>Close</A> \]"
|
||||
//user << browse(dat, "window=communications;size=400x500")
|
||||
//onclose(user, "communications")
|
||||
|
||||
popup.set_content(dat)
|
||||
popup.open()
|
||||
popup.set_content(dat)
|
||||
popup.open()
|
||||
|
||||
@@ -630,4 +670,4 @@ var/const/CALL_SHUTTLE_REASON_LENGTH = 12
|
||||
|
||||
/obj/machinery/computer/communications/proc/overrideCooldown()
|
||||
var/obj/item/weapon/circuitboard/computer/communications/CM = circuit
|
||||
CM.lastTimeUsed = 0
|
||||
CM.lastTimeUsed = 0
|
||||
@@ -185,6 +185,9 @@
|
||||
roundstart_move = "emergency_away"
|
||||
var/sound_played = 0 //If the launch sound has been sent to all players on the shuttle itself
|
||||
|
||||
/obj/docking_port/mobile/emergency/canDock(obj/docking_port/stationary/S)
|
||||
return SHUTTLE_CAN_DOCK //If the emergency shuttle can't move, the whole game breaks, so it will force itself to land even if it has to crush a few departments in the process
|
||||
|
||||
/obj/docking_port/mobile/emergency/register()
|
||||
. = ..()
|
||||
SSshuttle.emergency = src
|
||||
|
||||
Reference in New Issue
Block a user