mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-21 20:20:33 +01:00
code optimizations
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
name = "lattice"
|
||||
desc = "A lightweight support lattice."
|
||||
icon = 'icons/obj/structures.dmi'
|
||||
icon_state = "lattice"
|
||||
icon_state = "latticefull"
|
||||
density = 0
|
||||
anchored = 1.0
|
||||
layer = 2.3 //under pipes
|
||||
@@ -60,7 +60,7 @@
|
||||
if (istype(C, /obj/item/weapon/weldingtool))
|
||||
var/obj/item/weapon/weldingtool/WT = C
|
||||
if(WT.remove_fuel(0, user))
|
||||
user << "<span class='notice'>Slicing [initial(icon_state)] joints ...</span>"
|
||||
user << "<span class='notice'>Slicing [name] joints ...</span>"
|
||||
Deconstruct()
|
||||
return
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
if(!(istype(get_step(src, direction), /turf/space)))
|
||||
dir_sum += direction
|
||||
|
||||
icon_state = "[initial(icon_state)][dir_sum]"
|
||||
icon_state = "[name][dir_sum]"
|
||||
return
|
||||
|
||||
/obj/structure/lattice/Deconstruct()
|
||||
@@ -93,7 +93,7 @@
|
||||
/obj/structure/lattice/catwalk
|
||||
name = "catwalk"
|
||||
desc = "A catwalk for easier EVA manuevering."
|
||||
icon_state = "catwalk"
|
||||
icon_state = "catwalkfull"
|
||||
|
||||
/obj/structure/lattice/catwalk/attackby(obj/item/C as obj, mob/user as mob)
|
||||
..()
|
||||
@@ -103,4 +103,4 @@
|
||||
if((LC.d1==0)||(LC.d2==0))
|
||||
LC.attackby(C,user)
|
||||
return
|
||||
coil.catwalk_place(src, user)
|
||||
coil.place(src, user)
|
||||
@@ -63,7 +63,7 @@
|
||||
if((LC.d1==0)||(LC.d2==0))
|
||||
LC.attackby(C,user)
|
||||
return
|
||||
coil.turf_place(src, user)
|
||||
coil.place(src, user)
|
||||
else if(istype(C, /obj/item/weapon/weldingtool))
|
||||
var/obj/item/weapon/weldingtool/welder = C
|
||||
if( welder.isOn() && (broken || burnt) )
|
||||
|
||||
@@ -623,7 +623,7 @@ obj/structure/cable/proc/avail()
|
||||
return new path (location)
|
||||
|
||||
// called when cable_coil is clicked on a turf/simulated/floor
|
||||
/obj/item/stack/cable_coil/proc/turf_place(turf/simulated/floor/F, mob/user)
|
||||
/obj/item/stack/cable_coil/proc/place(turf/simulated/floor/F, mob/user)
|
||||
if(!isturf(user.loc))
|
||||
return
|
||||
|
||||
@@ -677,57 +677,6 @@ obj/structure/cable/proc/avail()
|
||||
if (prob(50)) //fail
|
||||
C.Deconstruct()
|
||||
|
||||
|
||||
|
||||
// called when cable_coil is clicked on a catwalk
|
||||
/obj/item/stack/cable_coil/proc/catwalk_place(var/obj/structure/lattice/catwalk/W, mob/user)
|
||||
if(get_amount() < 1) // Out of cable
|
||||
user << "There is no cable left."
|
||||
return
|
||||
|
||||
if(get_dist(W,user) > 1) // Too far
|
||||
user << "You can't lay cable at a place that far away."
|
||||
return
|
||||
|
||||
else
|
||||
var/dirn
|
||||
|
||||
if(user.loc == W)
|
||||
dirn = user.dir // if laying on the tile we're on, lay in the direction we're facing
|
||||
else
|
||||
dirn = get_dir(W, user)
|
||||
|
||||
for(var/obj/structure/cable/LC in W)
|
||||
if(LC.d2 == dirn && LC.d1 == 0)
|
||||
user << "There's already a cable at that position."
|
||||
return
|
||||
|
||||
var/obj/structure/cable/C = get_new_cable (W)
|
||||
|
||||
//set up the new cable
|
||||
C.d1 = 0 //it's a O-X node cable
|
||||
C.d2 = dirn
|
||||
C.add_fingerprint(user)
|
||||
C.updateicon()
|
||||
|
||||
//create a new powernet with the cable, if needed it will be merged later
|
||||
var/datum/powernet/PN = new()
|
||||
PN.add_cable(C)
|
||||
|
||||
C.mergeConnectedNetworks(C.d2) //merge the powernet with adjacents powernets
|
||||
C.mergeConnectedNetworksOnTurf() //merge the powernet with on turf powernets
|
||||
|
||||
if(C.d2 & (C.d2 - 1))// if the cable is layed diagonally, check the others 2 possible directions
|
||||
C.mergeDiagonalsNetworks(C.d2)
|
||||
|
||||
|
||||
use(1)
|
||||
|
||||
if (C.shock(user, 50))
|
||||
if (prob(50)) //fail
|
||||
C.Deconstruct()
|
||||
|
||||
|
||||
// called when cable_coil is click on an installed obj/cable
|
||||
// or click on a turf that already contains a "node" cable
|
||||
/obj/item/stack/cable_coil/proc/cable_join(obj/structure/cable/C, mob/user)
|
||||
@@ -749,7 +698,7 @@ obj/structure/cable/proc/avail()
|
||||
for(var/obj/structure/lattice/catwalk/W in src)
|
||||
catwalk_place(W,user)
|
||||
return
|
||||
turf_place(T,user)
|
||||
place(T,user)
|
||||
return
|
||||
|
||||
var/dirn = get_dir(C, user)
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
if(get_dist(src, user) > 1)
|
||||
return
|
||||
|
||||
coil.turf_place(T, user)
|
||||
coil.place(T, user)
|
||||
return
|
||||
else
|
||||
..()
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 104 KiB |
Reference in New Issue
Block a user