Merge remote-tracking branch 'upstream/master' into dev-freeze

Conflicts:
	code/game/objects/items/weapons/power_cells.dm
This commit is contained in:
PsiOmega
2015-05-22 08:26:13 +02:00
12 changed files with 42 additions and 25 deletions

View File

@@ -217,7 +217,7 @@
category = "Medical"
/datum/autolathe/recipe/syringegun_ammo
name = "syringe"
name = "syringe gun cartridge"
path = /obj/item/weapon/syringe_cartridge
category = "Arms and Ammunition"

View File

@@ -169,7 +169,8 @@
return
if(!R.cell.fully_charged())
var/diff = min(R.cell.maxcharge - R.cell.charge, charge_rate) // Capped at charge_rate charge / tick
if (cell.use(diff))
if (cell.charge >= diff)
cell.use(diff)
R.cell.give(diff)
if(weld_rate && R.getBruteLoss())
R.adjustBruteLoss(-1)

View File

@@ -108,7 +108,7 @@
mode_nice = design
mode = "[replacetext(design, "-", "")]full"
if("corner")
var/design = input("Which design?", "Floor painter") in list("black", "red", "blue", "green", "yellow", "purple", "neutral", "white", "white-grey", "white-red", "white-blue", "white-green", "white-yellow", "white-purple")
var/design = input("Which design?", "Floor painter") in list("black", "red", "blue", "green", "yellow", "purple", "neutral", "white", "white-red", "white-blue", "white-green", "white-yellow", "white-purple")
mode_nice = "[design] corner"
mode = "[replacetext(design, "-", "")]corner"
tile_dir_mode = 2
@@ -128,7 +128,9 @@
if(design == "white")
mode = "whitehall"
mode_nice = "white side"
tile_dir_mode = 1
else if(design == "black") // because SOMEONE made the black/grey side/corner sprite have the same name as the 'empty space' sprite :(
mode = "blackfloor"
mode_nice = design
else
mode_nice = design
mode = replacetext(design, "-", "")

View File

@@ -105,8 +105,11 @@
name = "infinite-capacity power cell!"
icon_state = "icell"
origin_tech = null
maxcharge = 30000
maxcharge = 30000 //determines how badly mobs get shocked
matter = list(DEFAULT_WALL_MATERIAL = 700, "glass" = 80)
check_charge()
return 1
use()
return 1

View File

@@ -35,12 +35,13 @@
/obj/item/weapon/melee/baton/proc/deductcharge(var/chrgdeductamt)
if(bcell)
if(bcell.use(chrgdeductamt))
if(bcell.checked_use(chrgdeductamt))
return 1
else
status = 0
update_icon()
return 0
return null
/obj/item/weapon/melee/baton/update_icon()
if(status)

View File

@@ -707,7 +707,7 @@
take_hit((100/severity_class), "electrical pulse", 1)
/obj/item/weapon/rig/proc/shock(mob/user)
if (electrocute_mob(user, cell, src))
if (electrocute_mob(user, cell, src)) //electrocute_mob() handles removing charge from the cell, no need to do that here.
spark_system.start()
if(user.stunned)
return 1

View File

@@ -3,9 +3,7 @@
if(!istype(user,/mob/living)) return 0
if(electrified != 0)
if(cell && cell.charge >= 100)
cell.use(100)
if(shock(user, 100))
if(shock(user)) //Handles removing charge from the cell, as well. No need to do that here.
return
// Pass repair items on to the chestpiece.
@@ -193,8 +191,6 @@
/obj/item/weapon/rig/attack_hand(var/mob/user)
if(electrified != 0)
if(cell && cell.charge >= 100)
cell.use(100)
if(shock(user, 100))
if(shock(user)) //Handles removing charge from the cell, as well. No need to do that here.
return
..()

View File

@@ -1081,8 +1081,9 @@
if(cell.charge == 0)
return 0
if(cell.use(amount * CELLRATE * CYBORG_POWER_USAGE_MULTIPLIER))
used_power_this_tick += amount * CYBORG_POWER_USAGE_MULTIPLIER
var/power_use = amount * CYBORG_POWER_USAGE_MULTIPLIER
if(cell.checked_use(CELLRATE * power_use))
used_power_this_tick += power_use
return 1
return 0

View File

@@ -10,7 +10,7 @@
..()
updateicon()
/obj/item/weapon/cell/drain_power(var/drain_check, var/surge, var/amount = 0)
/obj/item/weapon/cell/drain_power(var/drain_check, var/surge, var/power = 0)
if(drain_check)
return 1
@@ -18,9 +18,9 @@
if(charge <= 0)
return 0
var/cell_amt = min((amount * CELLRATE), charge)
use(cell_amt)
return cell_amt / CELLRATE
var/cell_amt = power * CELLRATE
return use(cell_amt) / CELLRATE
/obj/item/weapon/cell/proc/updateicon()
overlays.Cut()
@@ -38,13 +38,26 @@
/obj/item/weapon/cell/proc/fully_charged()
return (charge == maxcharge)
// use power from a cell
// checks if the power cell is able to provide the specified amount of charge
/obj/item/weapon/cell/proc/check_charge(var/amount)
return (charge >= amount)
// use power from a cell, returns the amount actually used
/obj/item/weapon/cell/proc/use(var/amount)
if(rigged && amount > 0)
explode()
return 0
charge = max(0, charge - amount)
return charge
var/used = min(charge, amount)
charge -= used
return used
// Checks if the specified amount can be provided. If it can, it removes the amount
// from the cell and returns 1. Otherwise does nothing and returns 0.
/obj/item/weapon/cell/proc/checked_use(var/amount)
if(!check_charge(amount))
return 0
use(amount)
return 1
// recharge the cell
/obj/item/weapon/cell/proc/give(var/amount)

View File

@@ -374,7 +374,7 @@
if (source_area)
source_area.use_power(drained_energy/CELLRATE)
else if (istype(power_source,/datum/powernet))
var/drained_power = drained_energy/CELLRATE //convert from "joules" to "watts"
var/drained_power = drained_energy/CELLRATE
drained_power = PN.draw_power(drained_power)
else if (istype(power_source, /obj/item/weapon/cell))
cell.use(drained_energy)

View File

@@ -78,7 +78,7 @@
/obj/item/weapon/gun/energy/consume_next_projectile()
if(!power_supply) return null
if(!ispath(projectile_type)) return null
if(!power_supply.use(charge_cost)) return null
if(!power_supply.checked_use(charge_cost)) return null
return new projectile_type(src)
/obj/item/weapon/gun/energy/proc/get_external_power_supply()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 310 KiB

After

Width:  |  Height:  |  Size: 297 KiB