- added feedback logging for alert levels

- alert level descriptions are now part of the config file config.txt
- alert levels default to the ones I had before, if the config file isn't configured.
- Restored a HTML vending machine interface, an updated one. (I have limited time so I'll commit this one too, it's part of the bundle i coded while offline today and I don't have time to separate it before discussing it. I'll revert it later if needed)

Vending machine demo:
http://www.kamletos.si/vending.html

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2641 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
baloh.matevz@gmail.com
2011-12-08 11:09:01 +00:00
parent 141977983c
commit b30bfac8f9
6 changed files with 186 additions and 31 deletions

View File

@@ -42,6 +42,14 @@
var/server
var/banappeals
//Alert level description
var/alert_desc_green = "All threats to the station have passed. Security may not have weapons visible, privacy laws are once again fully enforced."
var/alert_desc_blue_upto = "The station has received reliable information about possible hostile activity on the station. Security staff may have weapons visible, random searches are permitted."
var/alert_desc_blue_downto = "The immediate threat has passed. Security may no longer have weapons drawn at all times, but may continue to have them visible. Random searches are still allowed."
var/alert_desc_red_upto = "There is an immediate serious threat to the station. Security may have weapons unholstered at all times. Random searches are allowed and advised."
var/alert_desc_red_downto = "The self-destruct mechanism has been deactivated, there is still however an immediate serious threat to the station. Security may have weapons unholstered at all times, random searches are allowed and advised."
var/alert_desc_delta = "The station's self-destruct mechanism has been engaged. All crew are instructed to obey all instructions given by heads of staff. Any violations of these orders can be punished by death. This is not a drill."
//game_options.txt configs
var/health_threshold_crit = 0
@@ -220,6 +228,24 @@
if("load_jobs_from_txt")
load_jobs_from_txt = 1
if("alert_red_upto")
config.alert_desc_red_upto = value
if("alert_red_downto")
config.alert_desc_red_downto = value
if("alert_blue_downto")
config.alert_desc_blue_downto = value
if("alert_blue_upto")
config.alert_desc_blue_upto = value
if("alert_green")
config.alert_desc_green = value
if("alert_delta")
config.alert_desc_delta = value
else
diary << "Unknown setting in configuration: '[name]'"

View File

@@ -79,6 +79,11 @@
//Only notify the admins if an actual change happened
log_game("[key_name(usr)] has changed the security level to [get_security_level()].")
message_admins("[key_name_admin(usr)] has changed the security level to [get_security_level()].", 1)
switch(get_security_level())
if(SEC_LEVEL_GREEN)
feedback_inc("alert_comms_green",1)
if(SEC_LEVEL_GREEN)
feedback_inc("alert_comms_blue",1)
tmp_alertlevel = 0
else:
usr << "You are not authorized to do this."

View File

@@ -1,3 +1,11 @@
//Comment related to the commenting out of dmf stuff:
//Yes, I know it has the benefit of working without needing to refresh the screen, but it
//just looked absolutely terrible. People with light on dark windows setups couldn't view it.
//If you make it better, prettier... decent looking, sure, add it. But as it is it's just awful, sorry.
//The updateWindow() and SkinCmd() procs have been commented out along with a part of attack_hand().
//There were four or five calls to updateWindow() scattered through the file. They are commented out with '//' comments.
//-Errorage
/obj/machinery/vending
var/const
WIRE_EXTEND = 1
@@ -10,6 +18,11 @@
var/product_name = "generic"
var/product_path = null
var/amount = 0
var/color = "#ffffff"
New()
..()
color = "#[pick(list("ff","ee","dd"))][pick(list("ff","ee","dd"))][pick(list("ff","ee","dd"))]"
/obj/machinery/vending/New()
..()
@@ -93,7 +106,11 @@
continue
return
/*
/obj/machinery/vending/proc/updateWindow(mob/user as mob)
var/i
for (i = 1, i <= 6, i++)
winclone(user, "vendingslot", "vendingslot[i]")
@@ -127,6 +144,7 @@
else
winshow(user, "vendingwindow.slot[i+1]", 0)
/obj/machinery/vending/SkinCmd(mob/user as mob, var/data as text)
if (get_dist(user, src) > 1)
return
@@ -191,7 +209,7 @@
new product_path(get_turf(src))
src.vend_ready = 1
updateWindow(user)
updateWindow(user)*/
/obj/machinery/vending/attackby(obj/item/weapon/W as obj, mob/user as mob)
@@ -216,7 +234,7 @@
W.loc = src
coin = W
user << "\blue You insert the [W] into the [src]"
updateWindow(user)
//updateWindow(user)
return
else
..()
@@ -236,43 +254,139 @@
if(src.shock(user, 100))
return
updateWindow(user)
/*updateWindow(user)
winshow(user, "vendingwindow", 1)
user.skincmds["vending"] = src
user.skincmds["vending"] = src*/
var/dat = "<B>[src.name]</B>"
var/dat = ""
dat += {"
<table width='400' cellspacing='10' bgcolor='black'>
<tr align='center' valign='bottom'>
<td colspan='2'>
<table width='100%'>
<tr>
<td colspan='3' align='center'>
<font color='white'><b>[src.name]</b></font>
</td>
<td rowspan='2' align='center'>
<font color='white'>
<b>Coin slot</b><br>
[coin ? "<a href='?src=\ref[src];remove_coin=1'>[coin.name]</a>" : "empty"]
</font>
</td>
</tr>
<tr>
<td width='25'>
&nbsp;
</td>
<td bgcolor='darkgreen' align='center' valign='middle'>
<font color='lightgreen' style='font-family:Arial;' size='5'>
SELECT ITEM
</font>
</td>
<td width='25'>
&nbsp;
</td>
</tr>
</table>
</td>
</tr>
"}
for( var/datum/data/vending_product/product in product_records)
dat += {"
<tr height='37'>
<td align='center' bgcolor='[product.color]' width='330'><b>[product.product_name][product.amount ? " ([product.amount])" : "<font color='red' size='2'><br>Out of stock</font>"]</b></td>
<td width='70'>
<form name='vending' action='?src=\ref[src]' method='get'>
<input type='hidden' name='src' value='\ref[src]'>
<input type='hidden' name='vend' value='\ref[product]'>
<input type='submit' value='Vend' style='width:70px;position:relative;top:10px;'>
</form>
</td>
</tr>
"}
if(extended_inventory)
for( var/datum/data/vending_product/product in hidden_records)
dat += {"
<tr height='37'>
<td align='center' bgcolor='[product.color]' width='330'><b>[product.product_name][product.amount ? " ([product.amount])" : "<font color='red' size='2'><br>Out of stock</font>"]</b></td>
<td width='70'>
<form name='vending' action='?src=\ref[src]' method='get'>
<input type='hidden' name='src' value='\ref[src]'>
<input type='hidden' name='vend' value='\ref[product]'>
<input type='submit' value='Vend' style='width:70px;position:relative;top:10px;'>
</form>
</td>
</tr>
"}
if(coin)
dat += "<br>There is a <a href='?src=\ref[src];remove_coin=1'>[coin.name]</a> in the slot!"
else
dat += "<br>The coin slot is empty."
for( var/datum/data/vending_product/product in coin_records)
dat += {"
<tr height='37'>
<td align='center' bgcolor='[product.color]' width='330'><b>[product.product_name][product.amount ? " ([product.amount])" : "<font color='red' size='2'><br>Out of stock</font>"]</b></td>
<td width='70'>
<form name='vending' action='?src=\ref[src]' method='get'>
<input type='hidden' name='src' value='\ref[src]'>
<input type='hidden' name='vend' value='\ref[product]'>
<input type='submit' value='Vend' style='width:70px;position:relative;top:10px;'>
</form>
</td>
</tr>
"}
dat += {"
</table>
</p>
</div>
"}
if(panel_open)
var/dat2 = ""
var/list/vendwires = list(
"Violet" = 1,
"Orange" = 2,
"Goldenrod" = 3,
"Green" = 4,
)
dat += "<hr><B>Access Panel</B><br>"
dat2 += "<hr><B>Access Panel</B><br>"
for(var/wiredesc in vendwires)
var/is_uncut = src.wires & APCWireColorToFlag[vendwires[wiredesc]]
dat += "[wiredesc] wire: "
dat2 += "[wiredesc] wire: "
if(!is_uncut)
dat += "<a href='?src=\ref[src];cutwire=[vendwires[wiredesc]]'>Mend</a>"
dat2 += "<a href='?src=\ref[src];cutwire=[vendwires[wiredesc]]'>Mend</a>"
else
dat += "<a href='?src=\ref[src];cutwire=[vendwires[wiredesc]]'>Cut</a> "
dat += "<a href='?src=\ref[src];pulsewire=[vendwires[wiredesc]]'>Pulse</a> "
dat += "<br>"
dat2 += "<a href='?src=\ref[src];cutwire=[vendwires[wiredesc]]'>Cut</a> "
dat2 += "<a href='?src=\ref[src];pulsewire=[vendwires[wiredesc]]'>Pulse</a> "
dat2 += "<br>"
dat += "<br>"
dat += "The orange light is [(src.seconds_electrified == 0) ? "off" : "on"].<BR>"
dat += "The red light is [src.shoot_inventory ? "off" : "blinking"].<BR>"
dat += "The green light is [src.extended_inventory ? "on" : "off"].<BR>"
dat += "The [(src.wires & WIRE_SCANID) ? "purple" : "yellow"] light is on.<BR>"
dat2 += "<br>"
dat2 += "The orange light is [(src.seconds_electrified == 0) ? "off" : "on"].<BR>"
dat2 += "The red light is [src.shoot_inventory ? "off" : "blinking"].<BR>"
dat2 += "The green light is [src.extended_inventory ? "on" : "off"].<BR>"
dat2 += "The [(src.wires & WIRE_SCANID) ? "purple" : "yellow"] light is on.<BR>"
if(product_slogans != "")
dat += "The speaker switch is [src.shut_up ? "off" : "on"]. <a href='?src=\ref[src];togglevoice=[1]'>Toggle</a>"
dat2 += "The speaker switch is [src.shut_up ? "off" : "on"]. <a href='?src=\ref[src];togglevoice=[1]'>Toggle</a><br>"
user << browse(dat2, "window=vending")
user << browse(dat, "")
onclose(user, "")
@@ -303,14 +417,13 @@
usr.put_in_hand(coin)
usr << "\blue You remove the [coin] from the [src]"
coin = null
updateWindow(usr)
//updateWindow(usr)
usr.skincmds["vending"] = src
if ((usr.contents.Find(src) || (in_range(src, usr) && istype(src.loc, /turf))))
usr.machine = src
if ((href_list["vend"]) && (src.vend_ready))
if ((!src.allowed(usr)) && (!src.emagged) && (src.wires & WIRE_SCANID)) //For SECURE VENDING MACHINES YEAH
usr << "\red Access denied." //Unless emagged of course
flick(src.icon_deny,src)
@@ -371,7 +484,7 @@
src.mend(twire)
else
src.cut(twire)
updateWindow(usr)
//updateWindow(usr)
usr.skincmds["vending"] = src
else if ((href_list["pulsewire"]) && (src.panel_open))
@@ -384,7 +497,7 @@
return
else
src.pulse(twire)
updateWindow(usr)
//updateWindow(usr)
usr.skincmds["vending"] = src
else if ((href_list["togglevoice"]) && (src.panel_open))

View File

@@ -140,4 +140,5 @@
/obj/machinery/keycard_auth/proc/trigger_event()
switch(event)
if("Red alert")
set_security_level(SEC_LEVEL_RED)
set_security_level(SEC_LEVEL_RED)
feedback_inc("alert_keycard_auth_red",1)

View File

@@ -4,6 +4,8 @@
//2 = code red
//3 = code delta
//config.alert_desc_blue_downto
/proc/set_security_level(var/level)
switch(level)
if("green")
@@ -20,7 +22,7 @@
switch(level)
if(SEC_LEVEL_GREEN)
world << "<font size=4 color='red'>Attention! security level lowered to green</font>"
world << "<font color='red'>All threats to the station have passed. Security may not have weapons visible, privacy laws are once again fully enforced.</font>"
world << "<font color='red'>[config.alert_desc_green]</font>"
security_level = SEC_LEVEL_GREEN
for(var/obj/machinery/firealarm/FA in world)
if(FA.z == 1)
@@ -29,10 +31,10 @@
if(SEC_LEVEL_BLUE)
if(security_level < SEC_LEVEL_BLUE)
world << "<font size=4 color='red'>Attention! security level elevated to blue</font>"
world << "<font color='red'>The station has received reliable information about possible hostile activity on the station. Security staff may have weapons visible, random searches are permitted.</font>"
world << "<font color='red'>[config.alert_desc_blue_upto]</font>"
else
world << "<font size=4 color='red'>Attention! security level lowered to blue</font>"
world << "<font color='red'>The immediate threat has passed. Security may no longer have weapons drawn at all times, but may continue to have them visible. Random searches are still allowed.</font>"
world << "<font color='red'>[config.alert_desc_blue_downto]</font>"
security_level = SEC_LEVEL_BLUE
for(var/obj/machinery/firealarm/FA in world)
if(FA.z == 1)
@@ -41,10 +43,10 @@
if(SEC_LEVEL_RED)
if(security_level < SEC_LEVEL_RED)
world << "<font size=4 color='red'>Attention! Code red!</font>"
world << "<font color='red'>There is an immediate serious threat to the station. Security may have weapons unholstered at all times. Random searches are allowed and advised.</font>"
world << "<font color='red'>[config.alert_desc_red_upto]</font>"
else
world << "<font size=4 color='red'>Attention! Code red!</font>"
world << "<font color='red'>The self-destruct mechanism has been deactivated, there is still however an immediate serious threat to the station. Security may have weapons unholstered at all times, random searches are allowed and advised.</font>"
world << "<font color='red'>[config.alert_desc_red_downto]</font>"
security_level = SEC_LEVEL_RED
/* - At the time of commit, setting status displays didn't work properly
@@ -58,7 +60,7 @@
FA.overlays += image('monitors.dmi', "overlay_red")
if(SEC_LEVEL_DELTA)
world << "<font size=4 color='red'>Attention! Delta security level reached!</font>"
world << "<font color='red'>The ship's self-destruct mechanism has been engaged. All crew are instructed to obey all instructions given by heads of staff. Any violations of these orders can be punished by death. This is not a drill.</font>"
world << "<font color='red'>[config.alert_desc_delta]</font>"
security_level = SEC_LEVEL_DELTA
for(var/obj/machinery/firealarm/FA in world)
if(FA.z == 1)

View File

@@ -1,3 +1,11 @@
## Alert levels
ALERT_GREEN All threats to the station have passed. Security may not have weapons visible, privacy laws are once again fully enforced.
ALERT_BLUE_UPTO The station has received reliable information about possible hostile activity on the station. Security staff may have weapons visible, random searches are permitted.
ALERT_BLUE_DOWNTO The immediate threat has passed. Security may no longer have weapons drawn at all times, but may continue to have them visible. Random searches are still allowed.
ALERT_RED_UPTO There is an immediate serious threat to the station. Security may have weapons unholstered at all times. Random searches are allowed and advised.
ALERT_RED_DOWNTO The self-destruct mechanism has been deactivated, there is still however an immediate serious threat to the station. Security may have weapons unholstered at all times, random searches are allowed and advised.
ALERT_DELTA The station's self-destruct mechanism has been engaged. All crew are instructed to obey all instructions given by heads of staff. Any violations of these orders can be punished by death. This is not a drill.
## log OOC channel
LOG_OOC