Police tape overhaul

General purge of copypaste code

Framework for easier adding of new tape types
Now you only need two sprites of roll and sprites of tape length (H and V)
Define them in police_tape.dm

To show it off, engineering tape added, passable by engineers and atmos techs

Last but not least - ability to lift the tape, allowing passage for pretty much everything.
Done by those with access, attack by empty hand on help intent.
This commit is contained in:
unknown
2012-05-12 22:16:23 +03:00
parent 21f0783e90
commit 9efafd39bd
11 changed files with 134 additions and 171 deletions

View File

@@ -1,97 +1,89 @@
/obj/item/policetaperoll/attack_self(mob/user as mob)
if(icon_state == "rollstart")
tapestartx = src.loc.x
tapestarty = src.loc.y
tapestartz = src.loc.z
usr << "\blue You place the first end of the police tape."
icon_state = "rollstop"
/obj/item/taperoll/police
name = "police tape"
desc = "A roll of police tape used to block off crime scenes from the public."
icon_state = "police_start"
tape_type = /obj/item/tape/police
icon_base = "police"
/obj/item/tape/police
name = "police tape"
desc = "A length of police tape. Do not cross."
req_access = list(access_security)
icon_base = "police"
/obj/item/taperoll/engineering
name = "engineering tape"
desc = "A roll of engineering tape used to block off working areas from the public."
icon_state = "engineering_start"
tape_type = /obj/item/tape/engineering
icon_base = "engineering"
/obj/item/tape/engineering
name = "engineering tape"
desc = "A length of engineering tape. Better not cross it."
req_one_access = list(access_engine,access_atmospherics)
icon_base = "engineering"
/obj/item/taperoll/attack_self(mob/user as mob)
if(icon_state == "[icon_base]_start")
start = get_turf(src)
usr << "\blue You place the first end of the [src]."
icon_state = "[icon_base]_stop"
else
tapeendx = src.loc.x
tapeendy = src.loc.y
tapeendz = src.loc.z
icon_state = "[icon_base]_start"
end = get_turf(src)
if(start.y != end.y && start.x != end.x || start.z != end.z)
usr << "\blue [src] can only be laid horizontally or vertically."
var/turf/cur = start
var/dir
if (start.x == end.x)
var/d = end.y-start.y
if(d) d = d/abs(d)
end = get_turf(locate(end.x,end.y+d,end.z))
dir = "v"
else
var/d = end.x-start.x
if(d) d = d/abs(d)
end = get_turf(locate(end.x+d,end.y,end.z))
dir = "h"
while (cur!=end)
if(cur.density == 1)
usr << "\blue You can't run [src] through a wall!"
return
cur = get_step_towards(cur,end)
cur = start
var/tapetest = 0
if(tapestartx == tapeendx && tapestarty > tapeendy && tapestartz == tapeendz)
for(var/Y=tapestarty,Y>=tapeendy,Y--)
var/turf/T = get_turf(locate(tapestartx,Y,tapestartz))
if(T.density == 1)
usr << "\blue You can't run police tape through a wall!"
icon_state = "rollstart"
return
for(var/Y=tapestarty,Y>=tapeendy,Y--)
var/turf/T = get_turf(locate(tapestartx,Y,tapestartz))
for(var/obj/item/policetape/Ptest in T)
if(Ptest.icon_state == "vertical")
while (cur!=end)
for(var/obj/item/tape/Ptest in cur)
if(Ptest.icon_state == "[Ptest.icon_base]_[dir]")
tapetest = 1
if(tapetest != 1)
var/obj/item/policetape/P = new/obj/item/policetape(tapestartx,Y,tapestartz)
P.loc = locate(tapestartx,Y,tapestartz)
P.icon_state = "vertical"
usr << "\blue You finish placing the police tape." //Git Test
var/obj/item/tape/P = new tape_type(cur)
P.icon_state = "[P.icon_base]_[dir]"
cur = get_step_towards(cur,end)
//is_blocked_turf(var/turf/T)
usr << "\blue You finish placing the [src]." //Git Test
if(tapestartx == tapeendx && tapestarty < tapeendy && tapestartz == tapeendz)
for(var/Y=tapestarty,Y<=tapeendy,Y++)
var/turf/T = get_turf(locate(tapestartx,Y,tapestartz))
if(T.density == 1)
usr << "\blue You can't run police tape through a wall!"
icon_state = "rollstart"
return
for(var/Y=tapestarty,Y<=tapeendy,Y++)
var/turf/T = get_turf(locate(tapestartx,Y,tapestartz))
for(var/obj/item/policetape/Ptest in T)
if(Ptest.icon_state == "vertical")
tapetest = 1
if(tapetest != 1)
var/obj/item/policetape/P = new/obj/item/policetape(tapestartx,Y,tapestartz)
P.loc = locate(tapestartx,Y,tapestartz)
P.icon_state = "vertical"
usr << "\blue You finish placing the police tape."
/obj/item/taperoll/police/afterattack(var/atom/A, mob/user as mob)
if (istype(A, /obj/machinery/door/airlock))
var/turf/T = get_turf(A)
var/obj/item/tape/P = new tape_type(T.x,T.y,T.z)
P.loc = locate(T.x,T.y,T.z)
P.icon_state = "door"
P.layer = 3.2
user << "\blue You finish placing the [src]."
if(tapestarty == tapeendy && tapestartx > tapeendx && tapestartz == tapeendz)
for(var/X=tapestartx,X>=tapeendx,X--)
var/turf/T = get_turf(locate(X,tapestarty,tapestartz))
if(T.density == 1)
usr << "\blue You can't run police tape through a wall!"
icon_state = "rollstart"
return
for(var/X=tapestartx,X>=tapeendx,X--)
var/turf/T = get_turf(locate(X,tapestarty,tapestartz))
for(var/obj/item/policetape/Ptest in T)
if(Ptest.icon_state == "horizontal")
tapetest = 1
if(tapetest != 1)
var/obj/item/policetape/P = new/obj/item/policetape(X,tapestarty,tapestartz)
P.loc = locate(X,tapestarty,tapestartz)
P.icon_state = "horizontal"
usr << "\blue You finish placing the police tape."
if(tapestarty == tapeendy && tapestartx < tapeendx && tapestartz == tapeendz)
for(var/X=tapestartx,X<=tapeendx,X++)
var/turf/T = get_turf(locate(X,tapestarty,tapestartz))
if(T.density == 1)
usr << "\blue You can't run police tape through a wall!"
icon_state = "rollstart"
return
for(var/X=tapestartx,X<=tapeendx,X++)
var/turf/T = get_turf(locate(X,tapestarty,tapestartz))
for(var/obj/item/policetape/Ptest in T)
if(Ptest.icon_state == "horizontal")
tapetest = 1
if(tapetest != 1)
var/obj/item/policetape/P = new/obj/item/policetape(X,tapestarty,tapestartz)
P.loc = locate(X,tapestarty,tapestartz)
P.icon_state = "horizontal"
usr << "\blue You finish placing the police tape."
if(tapestarty != tapeendy && tapestartx != tapeendx)
usr << "\blue Police tape can only be laid horizontally or vertically."
icon_state = "rollstart"
/obj/item/policetape/Bumped(M as mob)
/obj/item/tape/Bumped(M as mob)
if(src.allowed(M))
var/turf/T = get_turf(src)
M:loc = T
/obj/item/policetape/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
/obj/item/tape/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if(!density) return 1
if(air_group || (height==0)) return 1
if ((mover.flags & 2 || istype(mover, /obj/effect/meteor) || mover.throwing == 1) )
@@ -99,78 +91,48 @@
else
return 0
/obj/item/policetape/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/item/tape/attackby(obj/item/weapon/W as obj, mob/user as mob)
breaktape(W, user)
/obj/item/policetape/attack_hand(mob/user as mob)
/obj/item/tape/attack_hand(mob/user as mob)
if (user.a_intent == "help" && src.allowed(user))
user.show_viewers("\blue [user] lifts [src], allowing passage.")
src.density = 0
spawn(200)
src.density = 1
else
breaktape(null, user)
/obj/item/policetape/attack_paw(mob/user as mob)
/obj/item/tape/attack_paw(mob/user as mob)
breaktape(/obj/item/weapon/wirecutters,user)
/obj/item/policetape/proc/breaktape(obj/item/weapon/W as obj, mob/user as mob)
/obj/item/tape/proc/breaktape(obj/item/weapon/W as obj, mob/user as mob)
if(user.a_intent == "help" && ((!is_sharp(W) && src.allowed(user)) ||(!is_cut(W) && !src.allowed(user))))
user << "You can't break the tape with that!"
user << "You can't break the [src] with that!"
return
user.show_viewers(text("\blue [] breaks the police tape!", user))
var/OX = src.x
var/OY = src.y
if(src.icon_state == "horizontal")
user.show_viewers("\blue [user] breaks the [src]!")
var/dir[2]
var/icon_dir = src.icon_state
if(icon_dir == "[src.icon_base]_h")
dir[1] = EAST
dir[2] = WEST
if(icon_dir == "[src.icon_base]_v")
dir[1] = NORTH
dir[2] = SOUTH
for(var/i=1;i<3;i++)
var/N = 0
var/X = OX + 1
var/turf/T = src.loc
var/turf/cur = get_step(src,dir[i])
while(N != 1)
N = 1
T = locate(X,T.y,T.z)
for (var/obj/item/policetape/P in T)
for (var/obj/item/tape/P in cur)
if(P.icon_state == icon_dir)
N = 0
if(P.icon_state == "horizontal")
del(P)
X += 1
X = OX - 1
N = 0
while(N != 1)
N = 1
T = locate(X,T.y,T.z)
for (var/obj/item/policetape/P in T)
N = 0
if(P.icon_state == "horizontal")
del(P)
X -= 1
if(src.icon_state == "vertical")
var/N = 0
var/Y = OY + 1
var/turf/T = src.loc
while(N != 1)
N = 1
T = locate(T.x,Y,T.z)
for (var/obj/item/policetape/P in T)
N = 0
if(P.icon_state == "vertical")
del(P)
Y += 1
Y = OY - 1
N = 0
while(N != 1)
N = 1
T = locate(T.x,Y,T.z)
for (var/obj/item/policetape/P in T)
N = 0
if(P.icon_state == "vertical")
del(P)
Y -= 1
cur = get_step(cur,dir[i])
del(src)
return
/obj/item/policetaperoll/afterattack(var/atom/A, mob/user as mob)
if (istype(A, /obj/machinery/door/airlock))
var/turf/T = get_turf(A)
var/obj/item/policetape/P = new/obj/item/policetape(T.x,T.y,T.z)
P.loc = locate(T.x,T.y,T.z)
P.icon_state = "door"
P.layer = 3.2
user << "\blue You finish placing the police tape."

View File

@@ -422,7 +422,7 @@
new /obj/item/weapon/clipboard(src)
new /obj/item/weapon/clipboard/notebook(src)
new /obj/item/device/detective_scanner(src)
new /obj/item/policetaperoll(src)
new /obj/item/taperoll/police(src)
new /obj/item/weapon/storage/box/evidence(src)
new /obj/item/device/pda/detective(src)
new /obj/item/clothing/suit/det_suit/armor(src)
@@ -445,7 +445,7 @@
new /obj/item/weapon/pepperspray(src)
new /obj/item/device/flash(src)
new /obj/item/weapon/melee/baton(src)
new /obj/item/policetaperoll(src)
new /obj/item/taperoll/police(src)
new /obj/item/weapon/flashbang(src)
new /obj/item/device/pda/security(src)
new /obj/item/clothing/suit/armor/vest(src)

View File

@@ -23,28 +23,28 @@
proc/initialize()
/obj/item/policetaperoll
name = "police tape roll"
desc = "A roll of police tape used to block off crime scenes from the public."
//Define all tape types in policetape.dm
/obj/item/taperoll
name = "tape roll"
icon = 'policetape.dmi'
icon_state = "rollstart"
flags = FPRINT
w_class = 1.0
var/tapestartx = 0
var/tapestarty = 0
var/tapestartz = 0
var/tapeendx = 0
var/tapeendy = 0
var/tapeendz = 0
var
turf/start
turf/end
tape_type = /obj/item/tape
icon_base
/obj/item/policetape
name = "police tape"
desc = "A length of police tape. Do not cross."
/obj/item/tape
name = "tape"
icon = 'policetape.dmi'
anchored = 1
density = 1
req_access = list(access_security)
var/icon_base
/*
*/
/obj/structure/signpost
icon = 'stationobjs.dmi'
icon_state = "signpost"

View File

@@ -362,7 +362,7 @@ Airlock index -> wire color are { 9, 4, 6, 7, 5, 8, 1, 2, 3 }.
//world << text("airlock attackby src [] obj [] mob []", src, C, user)
if(istype(C, /obj/item/device/detective_scanner))
return
if(istype(C, /obj/item/policetaperoll))
if(istype(C, /obj/item/taperoll/police))
return
if (!istype(usr, /mob/living/silicon))
if (src.isElectrified())

View File

@@ -32,6 +32,7 @@
new /obj/item/device/multitool(src)
new /obj/item/device/flash(src)
new /obj/item/clothing/glasses/meson(src)
new /obj/item/taperoll/engineering(src)
return

View File

@@ -136,7 +136,7 @@
var/obj/item/weapon/storage/backpack/security/BPK = new /obj/item/weapon/storage/backpack/security(src)
var/obj/item/weapon/storage/box/B = new(BPK)
new /obj/item/weapon/pen(B)
new /obj/item/policetaperoll(src)
new /obj/item/taperoll/police(src)
new /obj/item/clothing/suit/armor/vest(src)
new /obj/item/clothing/suit/storage/gearharness(src)
new /obj/item/clothing/head/helmet(src)
@@ -174,7 +174,7 @@
new /obj/item/weapon/pen(C)
new /obj/item/weapon/clipboard/notebook(src)
new /obj/item/device/detective_scanner(src)
new /obj/item/policetaperoll(src)
new /obj/item/taperoll/police(src)
new /obj/item/weapon/storage/box/evidence(src)
new /obj/item/device/pda/detective(src)
new /obj/item/device/radio/headset/headset_sec(src)

View File

@@ -153,7 +153,7 @@
"/obj/item/weapon/zippo",
"/obj/item/device/taperecorder",
"/obj/item/weapon/evidencebag",
"/obj/item/policetaperoll"
"/obj/item/taperoll/police"
)
/obj/item/weapon/storage/belt/soulstone

View File

@@ -1,5 +1,5 @@
/obj/item/clothing/suit/armor
allowed = list(/obj/item/weapon/gun/energy,/obj/item/weapon/pepperspray,/obj/item/weapon/gun/projectile,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/weapon/melee/baton,/obj/item/weapon/handcuffs,/obj/item/policetaperoll)
allowed = list(/obj/item/weapon/gun/energy,/obj/item/weapon/pepperspray,/obj/item/weapon/gun/projectile,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/weapon/melee/baton,/obj/item/weapon/handcuffs,/obj/item/taperoll/police)
body_parts_covered = UPPER_TORSO|LOWER_TORSO
flags = FPRINT | TABLEPASS
flags_inv = HIDEJUMPSUIT
@@ -52,7 +52,7 @@
item_state = "gearharness"
body_parts_covered = UPPER_TORSO|LOWER_TORSO
flags = FPRINT | TABLEPASS | ONESIZEFITSALL
allowed = list(/obj/item/weapon/gun/energy,/obj/item/weapon/pepperspray,/obj/item/weapon/gun/projectile,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/weapon/melee/baton,/obj/item/weapon/handcuffs,/obj/item/policetaperoll)
allowed = list(/obj/item/weapon/gun/energy,/obj/item/weapon/pepperspray,/obj/item/weapon/gun/projectile,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/weapon/melee/baton,/obj/item/weapon/handcuffs,/obj/item/taperoll/police)
flags_inv = 0
/obj/item/clothing/suit/armor/reactive
@@ -72,7 +72,7 @@
item_state = "armourrigvest"
body_parts_covered = UPPER_TORSO|LOWER_TORSO
flags = FPRINT | TABLEPASS | ONESIZEFITSALL
allowed = list(/obj/item/weapon/gun/energy,/obj/item/weapon/pepperspray,/obj/item/weapon/gun/projectile,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/weapon/melee/baton,/obj/item/weapon/handcuffs,/obj/item/policetaperoll)
allowed = list(/obj/item/weapon/gun/energy,/obj/item/weapon/pepperspray,/obj/item/weapon/gun/projectile,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/weapon/melee/baton,/obj/item/weapon/handcuffs,/obj/item/taperoll/police)
armor = list(melee = 50, bullet = 15, laser = 50, energy = 10, bomb = 25, bio = 0, rad = 0)
/obj/item/clothing/suit/armor/reactive/IsShield()

View File

@@ -12,7 +12,7 @@
icon_state = "detective"
item_state = "det_suit"
body_parts_covered = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS
allowed = list(/obj/item/weapon/tank/emergency_oxygen, /obj/item/device/flashlight,/obj/item/weapon/gun/energy,/obj/item/weapon/gun/projectile,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/weapon/melee/baton,/obj/item/weapon/handcuffs,/obj/item/weapon/cigpacket,/obj/item/weapon/lighter,/obj/item/device/detective_scanner,/obj/item/device/taperecorder,/obj/item/policetaperoll)
allowed = list(/obj/item/weapon/tank/emergency_oxygen, /obj/item/device/flashlight,/obj/item/weapon/gun/energy,/obj/item/weapon/gun/projectile,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/weapon/melee/baton,/obj/item/weapon/handcuffs,/obj/item/weapon/cigpacket,/obj/item/weapon/lighter,/obj/item/device/detective_scanner,/obj/item/device/taperecorder,/obj/item/taperoll/police)
armor = list(melee = 50, bullet = 10, laser = 25, energy = 10, bomb = 0, bio = 0, rad = 0)
@@ -23,7 +23,7 @@
item_state = "armor"
flags = FPRINT | TABLEPASS | ONESIZEFITSALL
body_parts_covered = UPPER_TORSO|LOWER_TORSO
allowed = list(/obj/item/weapon/gun/energy,/obj/item/weapon/gun/projectile,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/weapon/melee/baton,/obj/item/weapon/handcuffs,/obj/item/policetaperoll)
allowed = list(/obj/item/weapon/gun/energy,/obj/item/weapon/gun/projectile,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/weapon/melee/baton,/obj/item/weapon/handcuffs,/obj/item/taperoll/police)
armor = list(melee = 50, bullet = 15, laser = 50, energy = 10, bomb = 25, bio = 0, rad = 0)
/obj/item/clothing/under/det/verb/holster()

View File

@@ -75,7 +75,7 @@
item_state = "invisible"
body_parts_covered = UPPER_TORSO|LOWER_TORSO
flags = FPRINT | TABLEPASS | ONESIZEFITSALL
allowed = list(/obj/item/weapon/gun/energy,/obj/item/weapon/pepperspray,/obj/item/weapon/gun/projectile,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/weapon/melee/baton,/obj/item/weapon/handcuffs,/obj/item/policetaperoll)
allowed = list(/obj/item/weapon/gun/energy,/obj/item/weapon/pepperspray,/obj/item/weapon/gun/projectile,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/weapon/melee/baton,/obj/item/weapon/handcuffs,/obj/item/taperoll/police)
armor = list(melee = 50, bullet = 15, laser = 50, energy = 10, bomb = 25, bio = 0, rad = 0)
flags_inv = 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB