(Porta) turret update, map area update

This commit is contained in:
Markolie
2015-03-01 02:10:32 +01:00
parent bbcc9e63ce
commit b28f791f8f
21 changed files with 2466 additions and 1712 deletions
-6
View File
@@ -393,12 +393,6 @@ proc/listclearnulls(list/list)
//world.log << " output: [out.len]"
return reverselist(out)
/proc/find_record(field, value, list/L)
for(var/datum/data/record/R in L)
if(R.fields[field] == value)
return R
/proc/dd_sortedObjectList(var/list/L, var/cache=list())
if(L.len < 2)
return L
+2 -2
View File
@@ -159,7 +159,7 @@
Topic("breaker=1", list("breaker"="1"), 0) // 0 meaning no window (consistency! wait...)
/obj/machinery/turretid/AICtrlClick() //turns off/on Turrets
Topic("toggleOn", list("toggleOn" = 1), 1) // 1 meaning no window (consistency!)
Topic(src, list("src"= "\ref[src]", "command"="enable", "value"="[!enabled]"), 1) // 1 meaning no window (consistency!)
/atom/proc/AIAltClick(var/atom/A)
AltClick(A)
@@ -178,7 +178,7 @@
return
/obj/machinery/turretid/AIAltClick() //toggles lethal on turrets
Topic("toggleLethal", list("toggleLethal" = 1), 1) // 1 meaning no window (consistency!)
Topic(src, list("src"= "\ref[src]", "command"="lethal", "value"="[!lethal]"), 1) // 1 meaning no window (consistency!)
/atom/proc/AIMiddleClick()
return
+48
View File
@@ -0,0 +1,48 @@
/proc/CreateGeneralRecord()
var/mob/living/carbon/human/dummy = new()
dummy.mind = new()
var/icon/front = new(get_id_photo(dummy), dir = SOUTH)
var/icon/side = new(get_id_photo(dummy), dir = WEST)
var/datum/data/record/G = new /datum/data/record()
G.fields["name"] = "New Record"
G.fields["id"] = text("[]", add_zero(num2hex(rand(1, 1.6777215E7)), 6))
G.fields["rank"] = "Unassigned"
G.fields["real_rank"] = "Unassigned"
G.fields["sex"] = "Male"
G.fields["age"] = "Unknown"
G.fields["fingerprint"] = "Unknown"
G.fields["p_stat"] = "Active"
G.fields["m_stat"] = "Stable"
G.fields["species"] = "Human"
G.fields["home_system"] = "Unknown"
G.fields["citizenship"] = "Unknown"
G.fields["faction"] = "Unknown"
G.fields["religion"] = "Unknown"
G.fields["photo_front"] = front
G.fields["photo_side"] = side
data_core.general += G
del(dummy)
return G
/proc/CreateSecurityRecord(var/name as text, var/id as text)
var/datum/data/record/R = new /datum/data/record()
R.fields["name"] = name
R.fields["id"] = id
R.name = text("Security Record #[id]")
R.fields["criminal"] = "None"
R.fields["mi_crim"] = "None"
R.fields["mi_crim_d"] = "No minor crime convictions."
R.fields["ma_crim"] = "None"
R.fields["ma_crim_d"] = "No major crime convictions."
R.fields["notes"] = "No notes."
data_core.security += R
return R
/proc/find_security_record(field, value)
return find_record(field, value, data_core.security)
/proc/find_record(field, value, list/L)
for(var/datum/data/record/R in L)
if(R.fields[field] == value)
return R
+4 -1
View File
@@ -24,15 +24,18 @@
match_tag = "arrivals"
match_width = 5
match_height = 4
use_power = 0
/area/dynamic/source/lobby_russian
name = "\improper Russian Lounge"
match_tag = "arrivals"
match_width = 5
match_height = 4
use_power = 0
/area/dynamic/source/lobby_disco
name = "\improper Disco Lounge"
match_tag = "arrivals"
match_width = 5
match_height = 4
match_height = 4
use_power = 0
+9
View File
@@ -508,6 +508,15 @@
return assignment
return "Unknown"
proc/GetIdCard(var/mob/living/carbon/human/H)
if(H.wear_id)
var/id = H.wear_id.GetID()
if(id)
return id
if(H.get_active_hand())
var/obj/item/I = H.get_active_hand()
return I.GetID()
proc/FindNameFromID(var/mob/living/carbon/human/H)
ASSERT(istype(H))
+48
View File
@@ -401,3 +401,51 @@ Class Procs:
I.loc = loc
del(src)
return 1
/obj/machinery/proc/on_assess_perp(mob/living/carbon/human/perp)
return 0
/obj/machinery/proc/is_assess_emagged()
return emagged
/obj/machinery/proc/assess_perp(mob/living/carbon/human/perp, var/auth_weapons, var/check_records, var/check_arrest)
var/threatcount = 0 //the integer returned
if(is_assess_emagged())
return 10 //if emagged, always return 10.
threatcount += on_assess_perp(perp)
if(threatcount >= 10)
return threatcount
//Agent cards lower threatlevel.
var/obj/item/weapon/card/id/id = GetIdCard(perp)
if(id && istype(id, /obj/item/weapon/card/id/syndicate))
threatcount -= 2
if(auth_weapons && !src.allowed(perp))
if(istype(perp.l_hand, /obj/item/weapon/gun) || istype(perp.l_hand, /obj/item/weapon/melee))
threatcount += 4
if(istype(perp.r_hand, /obj/item/weapon/gun) || istype(perp.r_hand, /obj/item/weapon/melee))
threatcount += 4
if(istype(perp.belt, /obj/item/weapon/gun) || istype(perp.belt, /obj/item/weapon/melee))
threatcount += 2
if(perp.species.name != "Human") //beepsky so racist.
threatcount += 2
if(check_records || check_arrest)
var/perpname = perp.name
if(id)
perpname = id.registered_name
var/datum/data/record/R = find_security_record("name", perpname)
if(check_records && !R)
threatcount += 4
if(check_arrest && R && (R.fields["criminal"] == "*Arrest*"))
threatcount += 4
return threatcount
+124
View File
@@ -0,0 +1,124 @@
#define TURRET_PRIORITY_TARGET 2
#define TURRET_SECONDARY_TARGET 1
#define TURRET_NOT_TARGET 0
/obj/machinery/porta_turret/tag
// Reasonable defaults, in case someone manually spawns us
var/lasercolor = "r" //Something to do with lasertag turrets, blame Sieve for not adding a comment.
installation = /obj/item/weapon/gun/energy/laser/redtag
/obj/machinery/porta_turret/tag/red
/obj/machinery/porta_turret/tag/blue
lasercolor = "b"
installation = /obj/item/weapon/gun/energy/laser/bluetag
/obj/machinery/porta_turret/tag/New()
..()
icon_state = "[lasercolor]grey_target_prism"
/obj/machinery/porta_turret/tag/weapon_setup(var/obj/item/weapon/gun/energy/E)
switch(E.type)
if(/obj/item/weapon/gun/energy/laser/bluetag)
eprojectile = /obj/item/weapon/gun/energy/laser/bluetag
lasercolor = "b"
req_access = list(access_maint_tunnels, access_theatre)
check_arrest = 0
check_records = 0
check_weapons = 1
check_access = 0
check_anomalies = 0
shot_delay = 30
if(/obj/item/weapon/gun/energy/laser/redtag)
eprojectile = /obj/item/weapon/gun/energy/laser/redtag
lasercolor = "r"
req_access = list(access_maint_tunnels, access_theatre)
check_arrest = 0
check_records = 0
check_weapons = 1
check_access = 0
check_anomalies = 0
shot_delay = 30
iconholder = 1
/obj/machinery/porta_turret/tag/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
var/data[0]
data["access"] = !isLocked(user)
data["locked"] = locked
data["enabled"] = enabled
data["is_lethal"] = 0
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "turret_control.tmpl", "Turret Controls", 500, 300)
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
/obj/machinery/porta_turret/tag/update_icon()
if(!anchored)
icon_state = "turretCover"
return
if(stat & BROKEN)
icon_state = "[lasercolor]destroyed_target_prism"
else
if(powered())
if(enabled)
if(iconholder)
//lasers have a orange icon
icon_state = "[lasercolor]orange_target_prism"
else
//almost everything has a blue icon
icon_state = "[lasercolor]target_prism"
else
icon_state = "[lasercolor]grey_target_prism"
else
icon_state = "[lasercolor]grey_target_prism"
/obj/machinery/porta_turret/tag/bullet_act(obj/item/projectile/Proj)
..()
if(lasercolor == "b" && disabled == 0)
if(istype(Proj, /obj/item/weapon/gun/energy/laser/redtag))
disabled = 1
del(Proj) // qdel
sleep(100)
disabled = 0
if(lasercolor == "r" && disabled == 0)
if(istype(Proj, /obj/item/weapon/gun/energy/laser/bluetag))
disabled = 1
del(Proj) // qdel
sleep(100)
disabled = 0
/obj/machinery/porta_turret/tag/assess_living(var/mob/living/L)
if(!L)
return TURRET_NOT_TARGET
if(L.lying)
return TURRET_NOT_TARGET
var/target_suit
var/target_weapon
switch(lasercolor)
if("b")
target_suit = /obj/item/clothing/suit/redtag
target_weapon = /obj/item/weapon/gun/energy/laser/redtag
if("r")
target_suit = /obj/item/clothing/suit/bluetag
target_weapon = /obj/item/weapon/gun/energy/laser/bluetag
if(target_suit)//Lasertag turrets target the opposing team, how great is that? -Sieve
if((istype(L.r_hand, target_weapon)) || (istype(L.l_hand, target_weapon)))
return TURRET_PRIORITY_TARGET
if(istype(L, /mob/living/carbon/human))
var/mob/living/carbon/human/H = L
if(istype(H.wear_suit, target_suit))
return TURRET_PRIORITY_TARGET
if(istype(H.belt, target_weapon))
return TURRET_SECONDARY_TARGET
return TURRET_NOT_TARGET
File diff suppressed because it is too large Load Diff
+220
View File
@@ -0,0 +1,220 @@
////////////////////////
//Turret Control Panel//
////////////////////////
/area
// Turrets use this list to see if individual power/lethal settings are allowed
var/list/turret_controls = list()
/obj/machinery/turretid
name = "turret control panel"
desc = "Used to control a room's automated defenses."
icon = 'icons/obj/machines/turret_control.dmi'
icon_state = "control_standby"
anchored = 1
density = 0
var/enabled = 0
var/lethal = 0
var/locked = 1
var/area/control_area //can be area name, path or nothing.
var/check_arrest = 1 //checks if the perp is set to arrest
var/check_records = 1 //checks if a security record exists at all
var/check_weapons = 0 //checks if it can shoot people that have a weapon they aren't authorized to have
var/check_access = 1 //if this is active, the turret shoots everything that does not meet the access requirements
var/check_anomalies = 1 //checks if it can shoot at unidentified lifeforms (ie xenos)
var/check_synth = 0 //if active, will shoot at anything not an AI or cyborg
var/ailock = 0 //Silicons cannot use this
req_access = list(access_ai_upload)
/obj/machinery/turretid/stun
enabled = 1
icon_state = "control_stun"
/obj/machinery/turretid/lethal
enabled = 1
lethal = 1
icon_state = "control_kill"
/obj/machinery/turretid/Del()
if(control_area)
var/area/A = control_area
if(A && istype(A))
A.turret_controls -= src
..()
/obj/machinery/turretid/initialize()
if(!control_area)
var/area/CA = get_area(src)
control_area = CA.master
else if(istext(control_area))
for(var/area/A in world)
if(A.name && A.name==control_area)
control_area = A.master
break
if(control_area)
var/area/A = control_area
if(istype(A))
A.turret_controls += src
else
control_area = null
power_change() //Checks power and initial settings
return
/obj/machinery/turretid/proc/isLocked(mob/user)
if(ailock && (isrobot(user) || isAI(user)))
user << "<span class='notice'>There seems to be a firewall preventing you from accessing this device.</span>"
return 1
if(locked && !(isrobot(user) || isAI(user)))
user << "<span class='notice'>Access denied.</span>"
return 1
return 0
/obj/machinery/turretid/attackby(obj/item/weapon/W, mob/user)
if(stat & BROKEN)
return
if(!emagged && istype(W, /obj/item/weapon/card/emag))
user << "<span class='danger'>You short out the turret controls' access analysis module.</span>"
emagged = 1
locked = 0
ailock = 0
return
if(istype(W, /obj/item/weapon/card/id)||istype(W, /obj/item/device/pda))
if(src.allowed(usr))
if(emagged)
user << "<span class='notice'>The turret control is unresponsive.</span>"
else
locked = !locked
user << "<span class='notice'>You [ locked ? "lock" : "unlock"] the panel.</span>"
return
return ..()
/obj/machinery/turretid/attack_ai(mob/user as mob)
if(isLocked(user))
return
ui_interact(user)
/obj/machinery/turretid/attack_hand(mob/user as mob)
if(isLocked(user))
return
ui_interact(user)
/obj/machinery/turretid/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
var/data[0]
data["access"] = !isLocked(user)
data["locked"] = locked
data["enabled"] = enabled
data["is_lethal"] = 1
data["lethal"] = lethal
if(data["access"])
var/settings[0]
settings[++settings.len] = list("category" = "Neutralize All Non-Synthetics", "setting" = "check_synth", "value" = check_synth)
settings[++settings.len] = list("category" = "Check Weapon Authorization", "setting" = "check_weapons", "value" = check_weapons)
settings[++settings.len] = list("category" = "Check Security Records", "setting" = "check_records", "value" = check_records)
settings[++settings.len] = list("category" = "Check Arrest Status", "setting" = "check_arrest", "value" = check_arrest)
settings[++settings.len] = list("category" = "Check Access Authorization", "setting" = "check_access", "value" = check_access)
settings[++settings.len] = list("category" = "Check misc. Lifeforms", "setting" = "check_anomalies", "value" = check_anomalies)
data["settings"] = settings
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "turret_control.tmpl", "Turret Controls", 500, 300)
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
/obj/machinery/turretid/Topic(href, href_list, var/nowindow = 0)
if(..())
return 1
if(isLocked(usr))
return 1
if(href_list["command"] && href_list["value"])
var/value = text2num(href_list["value"])
if(href_list["command"] == "enable")
enabled = value
else if(href_list["command"] == "lethal")
lethal = value
else if(href_list["command"] == "check_synth")
check_synth = value
else if(href_list["command"] == "check_weapons")
check_weapons = value
else if(href_list["command"] == "check_records")
check_records = value
else if(href_list["command"] == "check_arrest")
check_arrest = value
else if(href_list["command"] == "check_access")
check_access = value
else if(href_list["command"] == "check_anomalies")
check_anomalies = value
updateTurrets()
return 1
/obj/machinery/turretid/proc/updateTurrets()
var/datum/turret_checks/TC = new
TC.enabled = enabled
TC.lethal = lethal
TC.check_synth = check_synth
TC.check_access = check_access
TC.check_records = check_records
TC.check_arrest = check_arrest
TC.check_weapons = check_weapons
TC.check_anomalies = check_anomalies
TC.ailock = ailock
if(istype(control_area))
for(var/area/sub_area in control_area.related)
for (var/obj/machinery/porta_turret/aTurret in sub_area)
aTurret.setState(TC)
update_icon()
/obj/machinery/turretid/power_change()
..()
updateTurrets()
update_icon()
/obj/machinery/turretid/update_icon()
..()
if(stat & NOPOWER)
icon_state = "control_off"
else if (enabled)
if (lethal)
icon_state = "control_kill"
else
icon_state = "control_stun"
else
icon_state = "control_standby"
/obj/machinery/turretid/emp_act(severity)
if(enabled)
//if the turret is on, the EMP no matter how severe disables the turret for a while
//and scrambles its settings, with a slight chance of having an emag effect
check_arrest = pick(0, 1)
check_records = pick(0, 1)
check_weapons = pick(0, 1)
check_access = pick(0, 0, 0, 0, 1) // check_access is a pretty big deal, so it's least likely to get turned on
check_anomalies = pick(0, 1)
enabled=0
updateTurrets()
sleep(rand(60,600))
if(!enabled)
enabled=1
updateTurrets()
..()
+1 -110
View File
@@ -331,110 +331,7 @@
spawn(13)
qdel(src)
/obj/machinery/turretid
name = "turret deactivation control"
icon = 'icons/obj/device.dmi'
icon_state = "control_stun"
anchored = 1
density = 0
var/enabled = 1
var/lethal = 0
var/locked = 1
var/control_area //can be area name, path or nothing.
var/ailock = 0 // AI cannot use this
req_access = list(access_ai_upload)
/obj/machinery/turretid/New()
..()
if(!control_area)
var/area/CA = get_area(src)
if(CA.master && CA.master != CA)
control_area = CA.master
else
control_area = CA
else if(istext(control_area))
for(var/area/A in world)
if(A.name && A.name==control_area)
control_area = A
break
//don't have to check if control_area is path, since get_area_all_atoms can take path.
return
/obj/machinery/turretid/attackby(obj/item/weapon/W, mob/user, params)
if(stat & BROKEN) return
if (istype(user, /mob/living/silicon))
return src.attack_hand(user)
else if( get_dist(src, user) == 0 ) // trying to unlock the interface
if (src.allowed(usr))
if(emagged)
user << "<span class='notice'>The turret control is unresponsive.</span>"
return
locked = !locked
user << "<span class='notice'>You [ locked ? "lock" : "unlock"] the panel.</span>"
if (locked)
if (user.machine==src)
user.unset_machine()
user << browse(null, "window=turretid")
else
if (user.machine==src)
src.attack_hand(user)
else
user << "<span class='warning'>Access denied.</span>"
/obj/machinery/turretid/emag_act(user as mob)
if (!emagged)
if(!ishuman(user))
return
var/mob/living/carbon/human/H = user
user << "\red You short out the turret controls' access analysis module."
emagged = 1
locked = 0
if(H.machine==src)
src.attack_hand(user)
/obj/machinery/turretid/attack_ai(mob/user as mob)
if(!ailock)
return attack_hand(user)
else
user << "<span class='notice'>There seems to be a firewall preventing you from accessing this device.</span>"
/obj/machinery/turretid/attack_hand(mob/user as mob)
if ( get_dist(src, user) > 0 )
if ( !issilicon(user) )
user << "<span class='notice'>You are too far away.</span>"
user.unset_machine()
user << browse(null, "window=turretid;size=500x250")
return
user.set_machine(src)
var/loc = src.loc
if (istype(loc, /turf))
loc = loc:loc
if (!istype(loc, /area))
user << text("Turret badly positioned - loc.loc is [].", loc)
return
var/area/area = loc
var/t = ""
if(src.locked && (!istype(user, /mob/living/silicon)))
t += "<div class='notice icon'>Swipe ID card to unlock interface</div>"
else
if (!istype(user, /mob/living/silicon))
t += "<div class='notice icon'>Swipe ID card to lock interface</div>"
t += text("Turrets [] - <A href='?src=\ref[];toggleOn=1'>[]?</a><br>\n", src.enabled?"activated":"deactivated", src, src.enabled?"Disable":"Enable")
t += text("Currently set for [] - <A href='?src=\ref[];toggleLethal=1'>Change to []?</a><br>\n", src.lethal?"lethal":"stun repeatedly", src, src.lethal?"Stun repeatedly":"Lethal")
//user << browse(t, "window=turretid;size=500x250")
//onclose(user, "turretid")
var/datum/browser/popup = new(user, "turretid", "Turret Control Panel ([area.name])", 500, 250)
popup.set_content(t)
popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state))
popup.open()
/obj/machinery/turret/attack_animal(mob/living/simple_animal/M as mob)
M.changeNext_move(CLICK_CD_MELEE)
M.do_attack_animation(src)
@@ -484,12 +381,6 @@
if(!nowindow)
src.attack_hand(usr)
/obj/machinery/turretid/proc/updateTurrets()
if(control_area)
for (var/obj/machinery/turret/aTurret in get_area_all_atoms(control_area))
aTurret.setState(enabled, lethal)
src.update_icons()
/obj/machinery/turretid/proc/update_icons()
if (src.enabled)
if (src.lethal)
+7
View File
@@ -158,6 +158,13 @@ proc/isnewplayer(A)
proc/hasorgans(A)
return ishuman(A)
proc/iscuffed(A)
if(istype(A, /mob/living/carbon))
var/mob/living/carbon/C = A
if(C.handcuffed)
return 1
return 0
proc/isdeaf(A)
if(istype(A, /mob))
+3 -2
View File
@@ -144,10 +144,9 @@ nanoui is used to open and update nano browser uis
return
var/status = user.can_interact_with_interface(host.nano_host())
set_status(status, push_update)
if(status == STATUS_CLOSE)
close()
else
set_status(status, push_update)
/*
Procs called by update_status()
@@ -501,6 +500,8 @@ nanoui is used to open and update nano browser uis
if (width && height)
window_size = "size=[width]x[height];"
update_status(0)
if(status == STATUS_CLOSE)
return
var/html=get_html()
if(src.writeDebug)
var/f = file("nano/debug.html")
+7
View File
@@ -36,6 +36,7 @@
var/last_fired = 0
var/obj/item/device/flashlight/F = null
var/can_flashlight = 0
var/heavy_weapon = 0
proc/ready_to_fire()
if(world.time >= last_fired + fire_delay)
@@ -122,6 +123,12 @@
if(!in_chamber)
return
if(heavy_weapon)
if(user.get_inactive_hand())
recoil = 4 //one-handed kick
else
recoil = initial(recoil)
in_chamber.firer = user
in_chamber.def_zone = user.zone_sel.selecting
@@ -130,3 +130,38 @@
update_charge()
update_reactor()
update_mode()
/obj/item/weapon/gun/energy/gun/turret
name = "hybrid turret gun"
desc = "A heavy hybrid energy cannon with two settings: Stun and kill."
icon_state = "turretlaser"
slot_flags = null
w_class = 5
heavy_weapon = 1
can_flashlight = 0
/obj/item/weapon/gun/energy/gun/turret/update_icon()
icon_state = initial(icon_state)
/obj/item/weapon/gun/energy/gun/turret/attack_self(mob/living/user as mob)
switch(mode)
if(0)
mode = 1
charge_cost = 1000
fire_sound = 'sound/weapons/Laser.ogg'
user << "\red [src.name] is now set to kill."
projectile_type = "/obj/item/projectile/beam"
modifystate = "energykill"
if(1)
mode = 0
charge_cost = 500
fire_sound = 'sound/weapons/Taser2.ogg'
user << "\red [src.name] is now set to disable."
projectile_type = "/obj/item/projectile/beam/disabler"
modifystate = "energystun"
update_icon()
if(user.l_hand == src)
user.update_inv_l_hand()
else
user.update_inv_r_hand()