TG: Welding tool: Mostly code-related, the players won't notice much.

- Welding tool code how has proper comments! Maybe not "proper" but at least I
don't lie and say a proc is/does something that it doesn't actually do.
- Welders now start full of fuel instead of some random amount between 10-20
- Someone decided it would be a good idea to set the welding tool's 'on/off' var
in a ton of attackby() procs. These objects and turfs shouldnt even touch this
variable. This is why people have been noticing their welding being on without
the sprite or damagetype and amount reflecting that.
- - I've removed a bunch of these instances but there are so many objects and
turfs spread out through the code, there's no way to know if I've got them all
(This is the majority of the files)
- - I've created a new proc in welding tools that checks to see if they are
turned on or not. "isOn()"
- - Since I'm not sure if I've gotten every instance of this force-var-on, I've
set the welding tool to update it's icon every process(). I hate adding checks
like this to processes but it's necessary for now.
- Added a setWelding() proc. If you HAVE to turn the welding tool on or off, use
this, don't just change the var. In fact, dont even touch the 'welding' var
anymore
- Fixes  issue 435

While changing the hundreds(literally) of cases of welding tool uses I've
- Changed some :'s (object:varorproc) I've come across into .'s
(object.varorproc)
- Added checks to make sure the welding tool is actually on before using it
(some attackby()'s didnt have this. Heck, some checked how much fuel you had,
but didn't actually USE the fuel)
- Added sanity checks after some do_after()s that were missing them

Added traitor uplink items back to erro's stat tracker
- Added 'random' with the tag "RN"
- Added thermal meson glasses with the tag "TM"
- Reorganized uplinks.dm a little by moving the 'random' item generation to its
own proc
- NOTE: I have absolutely no way to test this on my own, but it should work!

I've tested a bunch of construction/deconstructions with the welding tool, but
again I've probably missed a few things. If there are any problems, please let
me know and I'll fix them asap.
Revision: r3741
Author: 	 johnsonmt88
This commit is contained in:
Erthilo
2012-06-07 03:30:13 +01:00
parent 2e8f1932a8
commit eb7ae97624
35 changed files with 661 additions and 510 deletions
+1 -1
View File
@@ -481,7 +481,7 @@
return null
update_canmove()
if(sleeping || paralysis || stunned || weakened || resting || buckled || (changeling && changeling.changeling_fakedeath))
if(stat || sleeping || paralysis || stunned || weakened || resting || buckled || (changeling && changeling.changeling_fakedeath))
canmove = 0
else
@@ -420,11 +420,12 @@
if (istype(W, /obj/item/weapon/handcuffs)) // fuck i don't even know why isrobot() in handcuff code isn't working so this will have to do
return
if (istype(W, /obj/item/weapon/weldingtool) && W:welding)
if (istype(W, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
if(getBruteLoss() == 0)
user << "There are no dents to fix here!"
return
else if (W:remove_fuel(0))
else if (WT.remove_fuel(0))
adjustBruteLoss(-30)
if(getBruteLoss() < 0) bruteloss = 0
updatehealth()
+20 -22
View File
@@ -394,29 +394,27 @@
else if (istype(W, /obj/item/weapon/module/power_control) && opened && has_electronics==0 && ((stat & BROKEN) || malfhack))
user << "\red You cannot put the board inside, the frame is damaged."
return
else if (istype(W, /obj/item/weapon/weldingtool) && W:welding && opened && has_electronics==0 && !terminal)
if (W:get_fuel() < 3)
user << "\blue You need more welding fuel to do this."
else if (istype(W, /obj/item/weapon/weldingtool) && opened && has_electronics==0 && !terminal)
var/obj/item/weapon/weldingtool/WT = W
if (WT.get_fuel() < 3)
user << "\blue You need more welding fuel to complete this task."
return
user << "You start welding APC frame..."
if(W:remove_fuel(0,user))
W:welding = 2
playsound(src.loc, 'Welder.ogg', 50, 1)
if(do_after(user, 50))
if (emagged || malfhack || (stat & BROKEN) || opened==2)
new /obj/item/stack/sheet/metal(loc)
user.visible_message(\
"\red \The [src] has been cut apart by [user.name] with the welding tool.",\
"You disassemble the broken APC frame.",\
"\red You hear welding.")
else
new /obj/item/apc_frame(loc)
user.visible_message(\
"\red \The [src] has been cut from the wall by [user.name] with the welding tool.",\
"You cut APC frame from the wall.",\
"\red You hear welding.")
W:welding = 1
playsound(src.loc, 'Welder.ogg', 50, 1)
if(do_after(user, 50))
if(!src || !WT.remove_fuel(3, user)) return
if (emagged || malfhack || (stat & BROKEN) || opened==2)
new /obj/item/stack/sheet/metal(loc)
user.visible_message(\
"\red [src] has been cut apart by [user.name] with the weldingtool.",\
"You disassembled the broken APC frame.",\
"\red You hear welding.")
else
new /obj/item/apc_frame(loc)
user.visible_message(\
"\red [src] has been cut from the wall by [user.name] with the weldingtool.",\
"You cut APC frame from the wall.",\
"\red You hear welding.")
del(src)
return
else if (istype(W, /obj/item/apc_frame) && opened && emagged)
@@ -769,7 +767,7 @@
(istype(robot) && (robot in malfai.connected_robots)) \
) \
)
user << "\red \The [src] has it's AI control disabled!"
user << "\red \The [src] has its AI control disabled!"
user << browse(null, "window=apc")
user.machine = null
return 0
+7 -8
View File
@@ -1,4 +1,4 @@
//This file was auto-corrected by findeclaration.exe on 29/05/2012 15:03:05
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
/obj/machinery/emitter
name = "Emitter"
@@ -149,7 +149,8 @@
user << "\red The [src.name] needs to be unwelded from the floor."
return
if(istype(W, /obj/item/weapon/weldingtool) && W:welding)
if(istype(W, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
if(active)
user << "Turn off the [src] first."
return
@@ -157,29 +158,27 @@
if(0)
user << "\red The [src.name] needs to be wrenched to the floor."
if(1)
if (W:remove_fuel(0,user))
W:welding = 2
if (WT.remove_fuel(0,user))
playsound(src.loc, 'Welder2.ogg', 50, 1)
user.visible_message("[user.name] starts to weld the [src.name] to the floor.", \
"You start to weld the [src] to the floor.", \
"You hear welding")
if (do_after(user,20))
if(!src || !WT.isOn()) return
state = 2
user << "You weld the [src] to the floor."
W:welding = 1
else
user << "\red You need more welding fuel to complete this task."
if(2)
if (W:remove_fuel(0,user))
W:welding = 2
if (WT.remove_fuel(0,user))
playsound(src.loc, 'Welder2.ogg', 50, 1)
user.visible_message("[user.name] starts to cut the [src.name] free from the floor.", \
"You start to cut the [src] free from the floor.", \
"You hear welding")
if (do_after(user,20))
if(!src || !WT.isOn()) return
state = 1
user << "You cut the [src] free from the floor."
W:welding = 1
else
user << "\red You need more welding fuel to complete this task."
return
@@ -1,4 +1,4 @@
//This file was auto-corrected by findeclaration.exe on 29/05/2012 15:03:05
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
var/containment_fail_announced = 0
@@ -119,35 +119,34 @@ field_generator power level display
if(2)
user << "\red The [src.name] needs to be unwelded from the floor."
return
else if(istype(W, /obj/item/weapon/weldingtool) && W:welding)
else if(istype(W, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
switch(state)
if(0)
user << "\red The [src.name] needs to be wrenched to the floor."
return
if(1)
if (W:remove_fuel(0,user))
W:welding = 2
if (WT.remove_fuel(0,user))
playsound(src.loc, 'Welder2.ogg', 50, 1)
user.visible_message("[user.name] starts to weld the [src.name] to the floor.", \
"You start to weld the [src] to the floor.", \
"You hear welding")
if (do_after(user,20))
if(!src || !WT.isOn()) return
state = 2
user << "You weld the field generator to the floor."
W:welding = 1
else
return
if(2)
if (W:remove_fuel(0,user))
W:welding = 2
if (WT.remove_fuel(0,user))
playsound(src.loc, 'Welder2.ogg', 50, 1)
user.visible_message("[user.name] starts to cut the [src.name] free from the floor.", \
"You start to cut the [src] free from the floor.", \
"You hear welding")
if (do_after(user,20))
if(!src || !WT.isOn()) return
state = 1
user << "You cut the [src] free from the floor."
W:welding = 2
else
return
else
@@ -356,4 +355,5 @@ field_generator power level display
if((world.time - O.last_warning) > 50) //to stop message-spam
temp = 0
message_admins("A singulo exists and a containment field has failed.",1)
investigate_log("has <font color='red'>failed</font> whilst a singulo exists.","singulo")
O.last_warning = world.time
@@ -203,8 +203,8 @@
if(W.remove_fuel(0,user))
playsound(src.loc, 'Welder2.ogg', 100, 1)
user << "Welding the [nicetype] in place."
W:welding = 2
if(do_after(user, 20))
if(!src || !W.isOn()) return
user << "The [nicetype] has been welded in place!"
update() // TODO: Make this neat
if(ispipe) // Pipe
@@ -233,7 +233,6 @@
del(src)
return
W:welding = 1
else
user << "You need more welding fuel to complete this task."
return
+31 -34
View File
@@ -68,8 +68,9 @@
if(W.remove_fuel(0,user))
playsound(src.loc, 'Welder2.ogg', 100, 1)
user << "You start slicing the floorweld off the disposal unit."
W:welding = 2
if(do_after(user,20))
if(!src || !W.isOn()) return
user << "You sliced the floorweld off the disposal unit."
var/obj/structure/disposalconstruct/C = new (src.loc)
C.ptype = 6 // 6 = disposal unit
@@ -77,7 +78,6 @@
C.density = 1
C.update()
del(src)
W:welding = 1
return
else
user << "You need more welding fuel to complete this task."
@@ -900,23 +900,21 @@
if(istype(I, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/W = I
if(W.welding)
if(W.remove_fuel(0,user))
W:welding = 2
playsound(src.loc, 'Welder2.ogg', 100, 1)
// check if anything changed over 2 seconds
var/turf/uloc = user.loc
var/atom/wloc = W.loc
user << "Slicing the disposal pipe."
sleep(30)
if(user.loc == uloc && wloc == W.loc)
welded()
else
user << "You must stay still while welding the pipe."
W:welding = 1
if(W.remove_fuel(0,user))
playsound(src.loc, 'Welder2.ogg', 100, 1)
// check if anything changed over 2 seconds
var/turf/uloc = user.loc
var/atom/wloc = W.loc
user << "Slicing the disposal pipe."
sleep(30)
if(!W.isOn()) return
if(user.loc == uloc && wloc == W.loc)
welded()
else
user << "You need more welding fuel to cut the pipe."
return
user << "You must stay still while welding the pipe."
else
user << "You need more welding fuel to cut the pipe."
return
// called when pipe is cut with welder
proc/welded()
@@ -1242,6 +1240,10 @@
return P
//a trunk joining to a disposal bin or outlet on the same turf
/obj/structure/disposalpipe/trunk
icon_state = "pipe-t"
@@ -1301,20 +1303,16 @@
if(istype(I, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/W = I
if(W.welding)
if(W.remove_fuel(0,user))
W:welding = 2
playsound(src.loc, 'Welder2.ogg', 100, 1)
// check if anything changed over 2 seconds
var/turf/uloc = user.loc
var/atom/wloc = W.loc
user << "Slicing the disposal pipe."
sleep(30)
if(user.loc == uloc && wloc == W.loc)
welded()
else
user << "You must stay still while welding the pipe."
W:welding = 1
if(W.remove_fuel(0,user))
playsound(src.loc, 'Welder2.ogg', 100, 1)
// check if anything changed over 2 seconds
var/turf/uloc = user.loc
var/atom/wloc = W.loc
user << "Slicing the disposal pipe."
sleep(30)
if(!W.isOn()) return
if(user.loc == uloc && wloc == W.loc)
welded()
else
user << "You must stay still while welding the pipe."
else
@@ -1447,8 +1445,8 @@
if(W.remove_fuel(0,user))
playsound(src.loc, 'Welder2.ogg', 100, 1)
user << "You start slicing the floorweld off the disposal outlet."
W:welding = 2
if(do_after(user,20))
if(!src || !W.isOn()) return
user << "You sliced the floorweld off the disposal outlet."
var/obj/structure/disposalconstruct/C = new (src.loc)
C.ptype = 7 // 7 = outlet
@@ -1456,7 +1454,6 @@
C.anchored = 1
C.density = 1
del(src)
W:welding = 1
return
else
user << "You need more welding fuel to complete this task."
+1 -2
View File
@@ -446,8 +446,8 @@
if(W.remove_fuel(0,user))
playsound(src.loc, 'Welder2.ogg', 100, 1)
user << "You start slicing the floorweld off the delivery chute."
W:welding = 2
if(do_after(user,20))
if(!src || !W.isOn()) return
user << "You sliced the floorweld off the delivery chute."
var/obj/structure/disposalconstruct/C = new (src.loc)
C.ptype = 8 // 8 = Delivery chute
@@ -455,7 +455,6 @@
C.anchored = 1
C.density = 1
del(src)
W:welding = 1
return
else
user << "You need more welding fuel to complete this task."