Skip to content

Commit

Permalink
made a new define and used it (#12826)
Browse files Browse the repository at this point in the history
  • Loading branch information
xTrainx authored Sep 25, 2021
1 parent 414c5fb commit a272103
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 1 deletion.
1 change: 1 addition & 0 deletions code/__DEFINES/~hippie_defines/shuttles.dm
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#define SHUTTLE_DISABLED "disabled"
#define MAX_CALL_SHUTTLE_REASON_LENGTH 112
4 changes: 4 additions & 0 deletions code/controllers/subsystem/shuttle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ SUBSYSTEM_DEF(shuttle)
to_chat(user, "<span class='alert'>You must provide a reason.</span>")
return

if(length(call_reason) > MAX_CALL_SHUTTLE_REASON_LENGTH)
to_chat(user, "Too many characters in your reason.")
return

var/area/signal_origin = get_area(user)
var/emergency_reason = "\nNature of emergency:\n\n[call_reason]"
var/security_num = seclevel2num(get_security_level())
Expand Down
2 changes: 2 additions & 0 deletions code/game/machinery/computer/communications.dm
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@
popup.set_content(dat)
popup.open()

/* HIPPIE START added max shuttle call reason character limit
/obj/machinery/computer/communications/proc/get_javascript_header(form_id)
var/dat = {"<script type="text/javascript">
function getLength(){
Expand All @@ -587,6 +588,7 @@
}
</script>"}
return dat
Hippie End*/

/obj/machinery/computer/communications/proc/get_call_shuttle_form(ai_interface = 0)
var/form_id = "callshuttle"
Expand Down
2 changes: 2 additions & 0 deletions code/modules/mob/living/silicon/ai/ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@
viewalerts = 1
src << browse(dat, "window=aialerts&can_close=0")

/* HIPPIE START added max characters to the shuttle call reason length
/mob/living/silicon/ai/proc/ai_call_shuttle()
if(control_disabled)
to_chat(usr, "<span class='warning'>Wireless control is disabled!</span>")
Expand All @@ -302,6 +303,7 @@
var/obj/machinery/computer/communications/C = locate() in GLOB.machines
if(C)
C.post_status("shuttle")
HIPPIE END*/

/mob/living/silicon/ai/can_interact_with(atom/A)
. = ..()
Expand Down
2 changes: 1 addition & 1 deletion config/game_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ MIDROUND_ANTAG WIZARD


## The amount of time it takes for the emergency shuttle to be called, from round start.
SHUTTLE_REFUEL_DELAY 12000
SHUTTLE_REFUEL_DELAY 0

## Variables calculate how number of antagonists will scale to population.
## Used as (Antagonists = Population / Coeff)
Expand Down
1 change: 1 addition & 0 deletions hippiestation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -3085,6 +3085,7 @@
#include "hippiestation\code\game\machinery\bots\screambot.dm"
#include "hippiestation\code\game\machinery\computer\_computer.dm"
#include "hippiestation\code\game\machinery\computer\arcade.dm"
#include "hippiestation\code\game\machinery\computer\communications.dm"
#include "hippiestation\code\game\machinery\doors\airlock.dm"
#include "hippiestation\code\game\machinery\doors\blastco.dm"
#include "hippiestation\code\game\machinery\doors\poddoor.dm"
Expand Down
4 changes: 4 additions & 0 deletions hippiestation/code/controllers/subsystem/shuttle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ SUBSYSTEM_DEF(shuttle)
to_chat(user, "You must provide a reason.")
return

if(length(call_reason) > MAX_CALL_SHUTTLE_REASON_LENGTH)
to_chat(user, "Too many characters in your reason.")
return

var/area/signal_origin = get_area(user)
var/emergency_reason = "\nNature of emergency:\n\n[call_reason]"
var/security_num = seclevel2num(get_security_level())
Expand Down
21 changes: 21 additions & 0 deletions hippiestation/code/game/machinery/computer/communications.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/obj/machinery/computer/communications/proc/get_javascript_header(form_id)
var/dat = {"<script type="text/javascript">
function getLength(){
var reasonField = document.getElementById('reasonfield');
if(reasonField.value.length >= [CALL_SHUTTLE_REASON_LENGTH]){
if(reasonField.value.length <= [MAX_CALL_SHUTTLE_REASON_LENGTH]){
reasonField.style.backgroundColor = "#DDFFDD";
}
else {
reasonField.style.backgroundColor = "#FFDDDD";
}
}
else {
reasonField.style.backgroundColor = "#FFDDDD";
}
}
function submit() {
document.getElementById('[form_id]').submit();
}
</script>"}
return dat
19 changes: 19 additions & 0 deletions hippiestation/code/modules/mob/living/silicon/ai/ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,22 @@
to_chat(src, "<span class='notice'>[A] opened.</span>")
else
to_chat(src, "<span class='notice'>Unable to locate airlock. It may be out of camera range.</span>")

/mob/living/silicon/ai/proc/ai_call_shuttle()
if(control_disabled)
to_chat(usr, "<span class='warning'>Wireless control is disabled!</span>")
return

var/reason = input(src, "What is the nature of your emergency? ([CALL_SHUTTLE_REASON_LENGTH] characters required and can't have more than [MAX_CALL_SHUTTLE_REASON_LENGTH] Characters.)", "Confirm Shuttle Call") as null|text

if(incapacitated())
return

if(trim(reason))
SSshuttle.requestEvac(src, reason)

// hack to display shuttle timer
if(!EMERGENCY_IDLE_OR_RECALLED)
var/obj/machinery/computer/communications/C = locate() in GLOB.machines
if(C)
C.post_status("shuttle")

0 comments on commit a272103

Please sign in to comment.