mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-01-03 05:52:17 +00:00
A lot of new defines are now in inventory_sizes.dm, which contains; All the size identifiers (the thing that tells the game if something is bulky, or w/e). Storage costs for all the sizes, which are exponents of two, as previously. A few constants for inventory size. Also changes all storage item's capacity definitions by basing it off of how many 'normal slots' exist for it. This allows one to change the definition for all of the defines in the file, and everything will follow along without needing to change 500 files. In testing, I made all ITEMSIZE_COST_* defines doubled, and nothing had broke. The benefit of doing all of this is that it makes adding new weight classes in the future much simpler, and makes knowing how much space a container has easier, as seeing ITEMSIZE_COST_NORMAL * 7 means it can hold seven normal items.
303 lines
9.9 KiB
Plaintext
303 lines
9.9 KiB
Plaintext
/* Windoor (window door) assembly -Nodrak
|
|
* Step 1: Create a windoor out of rglass
|
|
* Step 2: Add r-glass to the assembly to make a secure windoor (Optional)
|
|
* Step 3: Rotate or Flip the assembly to face and open the way you want
|
|
* Step 4: Wrench the assembly in place
|
|
* Step 5: Add cables to the assembly
|
|
* Step 6: Set access for the door.
|
|
* Step 7: Screwdriver the door to complete
|
|
*/
|
|
|
|
|
|
obj/structure/windoor_assembly
|
|
name = "windoor assembly"
|
|
icon = 'icons/obj/doors/windoor.dmi'
|
|
icon_state = "l_windoor_assembly01"
|
|
anchored = 0
|
|
density = 0
|
|
dir = NORTH
|
|
w_class = ITEMSIZE_NORMAL
|
|
|
|
var/obj/item/weapon/airlock_electronics/electronics = null
|
|
var/created_name = null
|
|
|
|
//Vars to help with the icon's name
|
|
var/facing = "l" //Does the windoor open to the left or right?
|
|
var/secure = "" //Whether or not this creates a secure windoor
|
|
var/state = "01" //How far the door assembly has progressed in terms of sprites
|
|
|
|
obj/structure/windoor_assembly/secure
|
|
name = "secure windoor assembly"
|
|
secure = "secure_"
|
|
icon_state = "l_secure_windoor_assembly01"
|
|
|
|
obj/structure/windoor_assembly/New(Loc, start_dir=NORTH, constructed=0)
|
|
..()
|
|
if(constructed)
|
|
state = "01"
|
|
anchored = 0
|
|
switch(start_dir)
|
|
if(NORTH, SOUTH, EAST, WEST)
|
|
set_dir(start_dir)
|
|
else //If the user is facing northeast. northwest, southeast, southwest or north, default to north
|
|
set_dir(NORTH)
|
|
|
|
update_nearby_tiles(need_rebuild=1)
|
|
|
|
obj/structure/windoor_assembly/Destroy()
|
|
density = 0
|
|
update_nearby_tiles()
|
|
..()
|
|
|
|
/obj/structure/windoor_assembly/update_icon()
|
|
icon_state = "[facing]_[secure]windoor_assembly[state]"
|
|
|
|
/obj/structure/windoor_assembly/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
|
|
if(istype(mover) && mover.checkpass(PASSGLASS))
|
|
return 1
|
|
if(get_dir(loc, target) == dir) //Make sure looking at appropriate border
|
|
if(air_group) return 0
|
|
return !density
|
|
else
|
|
return 1
|
|
|
|
/obj/structure/windoor_assembly/CheckExit(atom/movable/mover as mob|obj, turf/target as turf)
|
|
if(istype(mover) && mover.checkpass(PASSGLASS))
|
|
return 1
|
|
if(get_dir(loc, target) == dir)
|
|
return !density
|
|
else
|
|
return 1
|
|
|
|
|
|
/obj/structure/windoor_assembly/attackby(obj/item/W as obj, mob/user as mob)
|
|
if(istype(W, /obj/item/weapon/pen))
|
|
var/t = sanitizeSafe(input(user, "Enter the name for the windoor.", src.name, src.created_name), MAX_NAME_LEN)
|
|
if(!t) return
|
|
if(!in_range(src, usr) && src.loc != usr) return
|
|
created_name = t
|
|
return
|
|
|
|
switch(state)
|
|
if("01")
|
|
if(istype(W, /obj/item/weapon/weldingtool) && !anchored )
|
|
var/obj/item/weapon/weldingtool/WT = W
|
|
if (WT.remove_fuel(0,user))
|
|
user.visible_message("[user] disassembles the windoor assembly.", "You start to disassemble the windoor assembly.")
|
|
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
|
|
|
|
if(do_after(user, 40))
|
|
if(!src || !WT.isOn()) return
|
|
user << "<span class='notice'>You disassembled the windoor assembly!</span>"
|
|
if(secure)
|
|
new /obj/item/stack/material/glass/reinforced(get_turf(src), 2)
|
|
else
|
|
new /obj/item/stack/material/glass(get_turf(src), 2)
|
|
qdel(src)
|
|
else
|
|
user << "<span class='notice'>You need more welding fuel to disassemble the windoor assembly.</span>"
|
|
return
|
|
|
|
//Wrenching an unsecure assembly anchors it in place. Step 4 complete
|
|
if(istype(W, /obj/item/weapon/wrench) && !anchored)
|
|
playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1)
|
|
user.visible_message("[user] secures the windoor assembly to the floor.", "You start to secure the windoor assembly to the floor.")
|
|
|
|
if(do_after(user, 40))
|
|
if(!src) return
|
|
user << "<span class='notice'>You've secured the windoor assembly!</span>"
|
|
src.anchored = 1
|
|
if(src.secure)
|
|
src.name = "secure anchored windoor assembly"
|
|
else
|
|
src.name = "anchored windoor assembly"
|
|
|
|
//Unwrenching an unsecure assembly un-anchors it. Step 4 undone
|
|
else if(istype(W, /obj/item/weapon/wrench) && anchored)
|
|
playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1)
|
|
user.visible_message("[user] unsecures the windoor assembly to the floor.", "You start to unsecure the windoor assembly to the floor.")
|
|
|
|
if(do_after(user, 40))
|
|
if(!src) return
|
|
user << "<span class='notice'>You've unsecured the windoor assembly!</span>"
|
|
src.anchored = 0
|
|
if(src.secure)
|
|
src.name = "secure windoor assembly"
|
|
else
|
|
src.name = "windoor assembly"
|
|
|
|
//Adding cable to the assembly. Step 5 complete.
|
|
else if(istype(W, /obj/item/stack/cable_coil) && anchored)
|
|
user.visible_message("[user] wires the windoor assembly.", "You start to wire the windoor assembly.")
|
|
|
|
var/obj/item/stack/cable_coil/CC = W
|
|
if(do_after(user, 40))
|
|
if (CC.use(1))
|
|
user << "<span class='notice'>You wire the windoor!</span>"
|
|
src.state = "02"
|
|
if(src.secure)
|
|
src.name = "secure wired windoor assembly"
|
|
else
|
|
src.name = "wired windoor assembly"
|
|
else
|
|
..()
|
|
|
|
if("02")
|
|
|
|
//Removing wire from the assembly. Step 5 undone.
|
|
if(istype(W, /obj/item/weapon/wirecutters) && !src.electronics)
|
|
playsound(src.loc, 'sound/items/Wirecutter.ogg', 100, 1)
|
|
user.visible_message("[user] cuts the wires from the airlock assembly.", "You start to cut the wires from airlock assembly.")
|
|
|
|
if(do_after(user, 40))
|
|
if(!src) return
|
|
|
|
user << "<span class='notice'>You cut the windoor wires.!</span>"
|
|
new/obj/item/stack/cable_coil(get_turf(user), 1)
|
|
src.state = "01"
|
|
if(src.secure)
|
|
src.name = "secure anchored windoor assembly"
|
|
else
|
|
src.name = "anchored windoor assembly"
|
|
|
|
//Adding airlock electronics for access. Step 6 complete.
|
|
else if(istype(W, /obj/item/weapon/airlock_electronics) && W:icon_state != "door_electronics_smoked")
|
|
playsound(src.loc, 'sound/items/Screwdriver.ogg', 100, 1)
|
|
user.visible_message("[user] installs the electronics into the airlock assembly.", "You start to install electronics into the airlock assembly.")
|
|
|
|
if(do_after(user, 40))
|
|
if(!src) return
|
|
|
|
user.drop_item()
|
|
W.loc = src
|
|
user << "<span class='notice'>You've installed the airlock electronics!</span>"
|
|
src.name = "near finished windoor assembly"
|
|
src.electronics = W
|
|
else
|
|
W.loc = src.loc
|
|
|
|
//Screwdriver to remove airlock electronics. Step 6 undone.
|
|
else if(istype(W, /obj/item/weapon/screwdriver) && src.electronics)
|
|
playsound(src.loc, 'sound/items/Screwdriver.ogg', 100, 1)
|
|
user.visible_message("[user] removes the electronics from the airlock assembly.", "You start to uninstall electronics from the airlock assembly.")
|
|
|
|
if(do_after(user, 40))
|
|
if(!src || !src.electronics) return
|
|
user << "<span class='notice'>You've removed the airlock electronics!</span>"
|
|
if(src.secure)
|
|
src.name = "secure wired windoor assembly"
|
|
else
|
|
src.name = "wired windoor assembly"
|
|
var/obj/item/weapon/airlock_electronics/ae = electronics
|
|
electronics = null
|
|
ae.loc = src.loc
|
|
|
|
//Crowbar to complete the assembly, Step 7 complete.
|
|
else if(istype(W, /obj/item/weapon/crowbar))
|
|
if(!src.electronics)
|
|
usr << "<span class='warning'>The assembly is missing electronics.</span>"
|
|
return
|
|
usr << browse(null, "window=windoor_access")
|
|
playsound(src.loc, 'sound/items/Crowbar.ogg', 100, 1)
|
|
user.visible_message("[user] pries the windoor into the frame.", "You start prying the windoor into the frame.")
|
|
|
|
if(do_after(user, 40))
|
|
|
|
if(!src) return
|
|
|
|
density = 1 //Shouldn't matter but just incase
|
|
user << "<span class='notice'>You finish the windoor!</span>"
|
|
|
|
if(secure)
|
|
var/obj/machinery/door/window/brigdoor/windoor = new /obj/machinery/door/window/brigdoor(src.loc)
|
|
if(src.facing == "l")
|
|
windoor.icon_state = "leftsecureopen"
|
|
windoor.base_state = "leftsecure"
|
|
else
|
|
windoor.icon_state = "rightsecureopen"
|
|
windoor.base_state = "rightsecure"
|
|
windoor.set_dir(src.dir)
|
|
windoor.density = 0
|
|
windoor.name = created_name
|
|
spawn(0)
|
|
windoor.close()
|
|
|
|
if(src.electronics.one_access)
|
|
windoor.req_access = null
|
|
windoor.req_one_access = src.electronics.conf_access
|
|
else
|
|
windoor.req_access = src.electronics.conf_access
|
|
windoor.electronics = src.electronics
|
|
src.electronics.loc = windoor
|
|
else
|
|
var/obj/machinery/door/window/windoor = new /obj/machinery/door/window(src.loc)
|
|
if(src.facing == "l")
|
|
windoor.icon_state = "leftopen"
|
|
windoor.base_state = "left"
|
|
else
|
|
windoor.icon_state = "rightopen"
|
|
windoor.base_state = "right"
|
|
windoor.set_dir(src.dir)
|
|
windoor.density = 0
|
|
windoor.name = created_name
|
|
spawn(0)
|
|
windoor.close()
|
|
|
|
if(src.electronics.one_access)
|
|
windoor.req_access = null
|
|
windoor.req_one_access = src.electronics.conf_access
|
|
else
|
|
windoor.req_access = src.electronics.conf_access
|
|
windoor.electronics = src.electronics
|
|
src.electronics.loc = windoor
|
|
|
|
|
|
qdel(src)
|
|
|
|
|
|
else
|
|
..()
|
|
|
|
//Update to reflect changes(if applicable)
|
|
update_state()
|
|
|
|
/obj/structure/windoor_assembly/proc/update_state()
|
|
update_icon()
|
|
name += " ([created_name])"
|
|
|
|
//Rotates the windoor assembly clockwise
|
|
/obj/structure/windoor_assembly/verb/revrotate()
|
|
set name = "Rotate Windoor Assembly"
|
|
set category = "Object"
|
|
set src in oview(1)
|
|
|
|
if (src.anchored)
|
|
usr << "It is fastened to the floor; therefore, you can't rotate it!"
|
|
return 0
|
|
if(src.state != "01")
|
|
update_nearby_tiles(need_rebuild=1) //Compel updates before
|
|
|
|
src.set_dir(turn(src.dir, 270))
|
|
|
|
if(src.state != "01")
|
|
update_nearby_tiles(need_rebuild=1)
|
|
|
|
update_icon()
|
|
return
|
|
|
|
//Flips the windoor assembly, determines whather the door opens to the left or the right
|
|
/obj/structure/windoor_assembly/verb/flip()
|
|
set name = "Flip Windoor Assembly"
|
|
set category = "Object"
|
|
set src in oview(1)
|
|
|
|
if(src.facing == "l")
|
|
usr << "The windoor will now slide to the right."
|
|
src.facing = "r"
|
|
else
|
|
src.facing = "l"
|
|
usr << "The windoor will now slide to the left."
|
|
|
|
update_icon()
|
|
return
|