Custom shuttles fixes (#21203)

* Fixes engines not connecting to heaters properly

1CHARFIIIIX

* Fixes custom shuttles not working due to a miriad of issues

 - Shuttle port wasn't being spawned properly
 - Couldn't actually move to anything because no initial docking port

* newline
This commit is contained in:
MadmanMartian
2019-01-02 19:53:47 +00:00
committed by jknpj
parent c2e4a4f607
commit 4e04bc9c9c
5 changed files with 32 additions and 29 deletions

View File

@@ -75,7 +75,7 @@
//When the shuttle moves, if stable is 0 then all unbuckled mobs will be stunned
var/stable = 0
var/password = 28011
var/password = null
var/can_link_to_computer = LINK_FORBIDDEN
//Whether the shuttle gibs or displaces stuff. Change this to COLLISION_DISPLACE to make all shuttles displace stuff by default
@@ -101,8 +101,8 @@
if(istype(linked_area) && linked_area.contents.len) //Only add the shuttle to the list if its area exists and it has something in it
shuttles |= src
password = rand(10000,99999)
if(password)
password = rand(10000,99999)
//initialize() proc - called automatically in proc/setup_shuttles() below.
//Returns INIT_SUCCESS, INIT_NO_AREA, INIT_NO_START or INIT_NO_PORT, depending on whether there were any errors
@@ -819,6 +819,7 @@
//Custom shuttles
/datum/shuttle/custom
name = "custom shuttle"
can_link_to_computer = LINK_FREE
/datum/shuttle/proc/show_outline(var/mob/user, var/turf/centered_at)
if(!user)

View File

@@ -186,9 +186,6 @@
span_s = "<i>"
span_e = "</i>"
if(shuttle && !shuttle.linked_port)
span_s = ""
span_e = ""
return "[span_s][name][span_e]"
@@ -224,12 +221,10 @@
dat += "Additional information has not been provided."
else if(!shuttle.linked_area)
dat = "<h2><font color='red'>UNABLE TO FIND [uppertext(shuttle.name)]</font></h2>"
else if(!shuttle.linked_port)
dat += {"<h2><font color='red'>This shuttle has no docking port specified.</font></h2><br>
<a href='?src=\ref[src];link_to_port=1'>Scan for docking ports</a>"}
else if(shuttle.moving)
dat += "<center><h3>Currently moving [shuttle.destination_port.areaname ? "to [shuttle.destination_port.areaname]" : ""]</h3></center>"
else
dat += {"<a href='?src=\ref[src];link_to_port=1'>Scan for docking ports</a><br>"}
if(shuttle.current_port)
dat += "Location: <b>[shuttle.current_port.areaname]</b><br>"
else
@@ -302,6 +297,7 @@
src.add_fingerprint(usr)
if(href_list["move"])
if(!shuttle)
to_chat(usr, "<span class = 'warning'>No shuttle detected.</span>")
return
if(!allowed(usr))
to_chat(usr, "<font color='red'>Access denied.</font>")
@@ -314,9 +310,11 @@
if(!allow_selecting_all && !(selected_port in shuttle.docking_ports))
//Check disks too
if(!disk || !disk.compactible(shuttle) || (disk.destination != selected_port))
to_chat(usr, "<span class = 'warning'>[!disk?"No disk detected":!disk.compactible(shuttle)?"Current disk not conpatable with current shuttle.":"Currently selected docking port not valid."]</span>")
return
if(selected_port.docked_with) //If used by another shuttle, don't try to move this shuttle
to_chat(usr, "<span class = 'warning'>Selected port is currently in use.</span>")
return
//Send a message to the shuttle to move
@@ -367,13 +365,15 @@
return
var/list/L = list()
for(var/datum/shuttle/S in shuttles)
var/name = S.name
switch(S.can_link_to_computer)
if(LINK_PASSWORD_ONLY)
name = "[name] (requires password)"
if(LINK_FORBIDDEN)
continue
var/name
if(S.can_link_to_computer == LINK_FORBIDDEN)
continue
else if(S.can_link_to_computer == LINK_FREE || get_area(src).get_shuttle() == S)
name = S.name
else if(S.password)
name = "[S.name] (requires password)"
else
continue
L += name
L[name] = S
@@ -383,7 +383,7 @@
if(L[choice] && istype(L[choice],/datum/shuttle))
var/datum/shuttle/S = L[choice]
if(S.can_link_to_computer == LINK_PASSWORD_ONLY)
if(S.password)
var/password_attempt = input(usr,"Please input [capitalize(S.name)]'s interface password:", "Shuttle control console", 00000) as num
if(!Adjacent(usr) && !isAdminGhost(usr) && !isAI(usr))
@@ -444,13 +444,15 @@
var/list/L = list()
for(var/datum/shuttle/S in shuttles)
var/name = S.name
switch(S.can_link_to_computer)
if(LINK_PASSWORD_ONLY)
name = "[name] (password)"
if(LINK_FORBIDDEN)
name = "[name] (private)"
var/name
if(S.can_link_to_computer == LINK_FORBIDDEN)
continue
else if(S.can_link_to_computer == LINK_FREE || get_area(src).get_shuttle() == S)
name = S.name
else if(S.password)
name = "[S.name] (requires password)"
else
continue
L += name
L[name] = S

View File

@@ -486,7 +486,7 @@ these cannot rename rooms that are in by default BUT can rename rooms that are c
var/area_size = A.area_turfs.len
var/active_engines = 0
for(var/obj/structure/shuttle/engine/propulsion/DIY/D in A)
if(D.heater && anchored)
if(D.heater && D.anchored)
active_engines++
if(active_engines < 2 || area_size/active_engines > 12.5) //2 engines per 25 tiles, with a minimum of 2 engines.
@@ -496,7 +496,7 @@ these cannot rename rooms that are in by default BUT can rename rooms that are c
var/turf/check_turf = get_step(user, user.dir)
if(!istype(check_turf, /turf/space))
if(get_area(check_turf) == A)
to_chat(user, "<span class = 'warning'>This area is not a viable shuttle. Reason: Unable to create docking port at current user location.</span>")
return
@@ -508,7 +508,7 @@ these cannot rename rooms that are in by default BUT can rename rooms that are c
to_chat(user, "Shuttlifying cancelled.")
return
var/obj/docking_port/shuttle/DP = new /obj/docking_port/shuttle(A.loc)
var/obj/docking_port/shuttle/DP = new /obj/docking_port/shuttle(get_turf(src))
DP.dir = user.dir

View File

@@ -48,7 +48,7 @@
/obj/structure/shuttle/engine/heater/DIY/attackby(obj/item/I, mob/user)
if(iswrench(I) && wrenchAnchor(user, 5 SECONDS))
if(anchored)
if(!anchored)
if(connected_engine)
connected_engine.heater = null
connected_engine = null

View File

@@ -12,7 +12,7 @@ var/global/datum/shuttle/salvage/salvage_shuttle = new(starting_area=/area/shutt
pre_flight_delay = 30
can_link_to_computer = LINK_PASSWORD_ONLY
password = TRUE
stable = 1 //Don't stun everyone and don't throw anything when moving
can_rotate = 0 //Sleepers, body scanners and multi-tile airlocks aren't rotated properly