Merge pull request #4176 from Anewbe/battery_things

Swaps non-mounted recharging guns to batteries
This commit is contained in:
Neerti
2017-11-19 21:28:06 -05:00
committed by GitHub
10 changed files with 184 additions and 156 deletions
+31 -2
View File
@@ -2,6 +2,28 @@
// charge from 0 to 100%
// fits in APC to provide backup power
/obj/item/weapon/cell
name = "power cell"
desc = "A rechargable electrochemical power cell."
icon = 'icons/obj/power.dmi'
icon_state = "cell"
item_state = "cell"
origin_tech = list(TECH_POWER = 1)
force = 5.0
throwforce = 5.0
throw_speed = 3
throw_range = 5
w_class = ITEMSIZE_NORMAL
var/charge = 0 // note %age conveted to actual charge in New
var/maxcharge = 1000
var/rigged = 0 // true if rigged to explode
var/minor_fault = 0 //If not 100% reliable, it will build up faults.
var/self_recharge = FALSE // If true, the cell will recharge itself.
var/charge_amount = 25 // How much power to give, if self_recharge is true. The number is in absolute cell charge, as it gets divided by CELLRATE later.
var/last_use = 0 // A tracker for use in self-charging
var/charge_delay = 0 // How long it takes for the cell to start recharging after last use
matter = list(DEFAULT_WALL_MATERIAL = 700, "glass" = 50)
/obj/item/weapon/cell/New()
..()
charge = maxcharge
@@ -16,7 +38,8 @@
/obj/item/weapon/cell/process()
if(self_recharge)
give(charge_amount)
if(world.time >= last_use + charge_delay)
give(charge_amount)
else
return PROCESS_KILL
@@ -59,6 +82,7 @@
return 0
var/used = min(charge, amount)
charge -= used
last_use = world.time
update_icon()
return used
@@ -80,6 +104,8 @@
var/amount_used = min(maxcharge-charge,amount)
charge += amount_used
update_icon()
if(loc)
loc.update_icon()
return amount_used
@@ -112,7 +138,6 @@
S.reagents.clear_reagents()
/obj/item/weapon/cell/proc/explode()
var/turf/T = get_turf(src.loc)
/*
@@ -207,3 +232,7 @@
return min(rand(10,20),rand(10,20))
else
return 0
/obj/item/weapon/cell/suicide_act(mob/user)
viewers(user) << "<span class='danger'>\The [user] is licking the electrodes of \the [src]! It looks like \he's trying to commit suicide.</span>"
return (FIRELOSS)
+33
View File
@@ -0,0 +1,33 @@
//currently only used by energy-type guns, that may change in the future.
/obj/item/weapon/cell/device
name = "device power cell"
desc = "A small power cell designed to power handheld devices."
icon_state = "dcell"
item_state = "egg6"
w_class = ITEMSIZE_SMALL
force = 0
throw_speed = 5
throw_range = 7
maxcharge = 480
charge_amount = 5
matter = list("metal" = 350, "glass" = 50)
preserve_item = 1
/obj/item/weapon/cell/device/weapon
name = "weapon power cell"
desc = "A small power cell designed to power handheld weaponry."
icon_state = "wcell"
maxcharge = 2400
charge_amount = 20
/obj/item/weapon/cell/device/weapon/recharge
name = "self-charging weapon power cell"
desc = "A small power cell designed to power handheld weaponry. This one recharges itself."
// icon_state = "wcell" //TODO: Different sprite
self_recharge = TRUE
charge_amount = 120
charge_delay = 75
/obj/item/weapon/cell/device/weapon/recharge/captain
charge_amount = 160 //Recharges a lot more quickly...
charge_delay = 100 //... but it takes a while to get started
+93
View File
@@ -0,0 +1,93 @@
/obj/item/weapon/cell/crap
name = "\improper rechargable AA battery"
desc = "You can't top the plasma top." //TOTALLY TRADEMARK INFRINGEMENT
origin_tech = list(TECH_POWER = 0)
maxcharge = 500
matter = list(DEFAULT_WALL_MATERIAL = 700, "glass" = 40)
/obj/item/weapon/cell/crap/empty/New()
..()
charge = 0
/obj/item/weapon/cell/secborg
name = "security borg rechargable D battery"
origin_tech = list(TECH_POWER = 0)
maxcharge = 600 //600 max charge / 100 charge per shot = six shots
matter = list(DEFAULT_WALL_MATERIAL = 700, "glass" = 40)
/obj/item/weapon/cell/secborg/empty/New()
..()
charge = 0
/obj/item/weapon/cell/apc
name = "heavy-duty power cell"
origin_tech = list(TECH_POWER = 1)
maxcharge = 5000
matter = list(DEFAULT_WALL_MATERIAL = 700, "glass" = 50)
/obj/item/weapon/cell/high
name = "high-capacity power cell"
origin_tech = list(TECH_POWER = 2)
icon_state = "hcell"
maxcharge = 10000
matter = list(DEFAULT_WALL_MATERIAL = 700, "glass" = 60)
/obj/item/weapon/cell/high/empty/New()
..()
charge = 0
/obj/item/weapon/cell/super
name = "super-capacity power cell"
origin_tech = list(TECH_POWER = 5)
icon_state = "scell"
maxcharge = 20000
matter = list(DEFAULT_WALL_MATERIAL = 700, "glass" = 70)
/obj/item/weapon/cell/super/empty/New()
..()
charge = 0
/obj/item/weapon/cell/hyper
name = "hyper-capacity power cell"
origin_tech = list(TECH_POWER = 6)
icon_state = "hpcell"
maxcharge = 30000
matter = list(DEFAULT_WALL_MATERIAL = 700, "glass" = 80)
/obj/item/weapon/cell/hyper/empty/New()
..()
charge = 0
/obj/item/weapon/cell/infinite
name = "infinite-capacity power cell!"
icon_state = "icell"
origin_tech = null
maxcharge = 30000 //determines how badly mobs get shocked
matter = list(DEFAULT_WALL_MATERIAL = 700, "glass" = 80)
/obj/item/weapon/cell/infinite/check_charge()
return 1
/obj/item/weapon/cell/infinite/use()
return 1
/obj/item/weapon/cell/potato
name = "potato battery"
desc = "A rechargable starch based power cell."
origin_tech = list(TECH_POWER = 1)
icon = 'icons/obj/power.dmi' //'icons/obj/harvest.dmi'
icon_state = "potato_cell" //"potato_battery"
charge = 100
maxcharge = 300
minor_fault = 1
/obj/item/weapon/cell/slime
name = "charged slime core"
desc = "A yellow slime core infused with phoron, it crackles with power."
origin_tech = list(TECH_POWER = 4, TECH_BIO = 5)
icon = 'icons/mob/slimes.dmi' //'icons/obj/harvest.dmi'
icon_state = "yellow slime extract" //"potato_battery"
description_info = "This 'cell' holds a max charge of 10k and self recharges over time."
maxcharge = 10000
matter = null
self_recharge = TRUE
+7 -4
View File
@@ -34,12 +34,15 @@
/obj/item/weapon/gun/energy/New()
..()
if(cell_type)
power_supply = new cell_type(src)
else
power_supply = new /obj/item/weapon/cell/device/weapon(src)
if(self_recharge)
power_supply = new /obj/item/weapon/cell/device/weapon(src)
processing_objects.Add(src)
else
if(cell_type)
power_supply = new cell_type(src)
else
power_supply = new /obj/item/weapon/cell/device/weapon(src)
update_icon()
/obj/item/weapon/gun/energy/Destroy()
@@ -65,9 +65,8 @@
origin_tech = null
fire_delay = 10 //Old pistol
charge_cost = 480 //to compensate a bit for self-recharging
self_recharge = 1
recharge_time = 3 //Recharges a bit more quickly...
charge_delay = 100 //... but it takes a while to get started
cell_type = /obj/item/weapon/cell/device/weapon/recharge/captain
battery_lock = 1
/obj/item/weapon/gun/energy/lasercannon
name = "laser cannon"
@@ -87,7 +86,6 @@
accuracy = 3
charge_cost = 600
/obj/item/weapon/gun/energy/lasercannon/mounted
name = "mounted laser cannon"
self_recharge = 1
@@ -145,10 +143,11 @@
item_state = "laser"
desc = "Standard issue weapon of the Imperial Guard"
origin_tech = list(TECH_COMBAT = 1, TECH_MAGNET = 2)
self_recharge = 1
matter = list(DEFAULT_WALL_MATERIAL = 2000)
fire_sound = 'sound/weapons/Laser.ogg'
projectile_type = /obj/item/projectile/beam/lastertag/blue
cell_type = /obj/item/weapon/cell/device/weapon/recharge
battery_lock = 1
var/required_vest
/obj/item/weapon/gun/energy/lasertag/special_check(var/mob/living/carbon/human/M)
@@ -56,7 +56,8 @@
force = 8 //looks heavier than a pistol
w_class = ITEMSIZE_LARGE //Looks bigger than a pistol, too.
fire_delay = 6 //This one's not a handgun, it should have the same fire delay as everything else
self_recharge = 1
cell_type = /obj/item/weapon/cell/device/weapon/recharge
battery_lock = 1
modifystate = null
// requires_two_hands = 1
@@ -43,7 +43,8 @@
projectile_type = /obj/item/projectile/energy/floramut
origin_tech = list(TECH_MATERIAL = 2, TECH_BIO = 3, TECH_POWER = 3)
modifystate = "floramut"
self_recharge = 1
cell_type = /obj/item/weapon/cell/device/weapon/recharge
battery_lock = 1
var/decl/plantgene/gene = null
firemodes = list(
@@ -137,7 +138,8 @@
charge_cost = 480
projectile_type = /obj/item/projectile/change
origin_tech = null
self_recharge = 1
cell_type = /obj/item/weapon/cell/device/weapon/recharge
battery_lock = 1
charge_meter = 0
/obj/item/weapon/gun/energy/staff/special_check(var/mob/user)
@@ -188,7 +190,8 @@ obj/item/weapon/gun/energy/staff/focus
w_class = ITEMSIZE_HUGE
charge_cost = 24 // 100 shots, it's a spray and pray (to RNGesus) weapon.
projectile_type = /obj/item/projectile/energy/blue_pellet
self_recharge = 1
cell_type = /obj/item/weapon/cell/device/weapon/recharge
battery_lock = 1
accuracy = 5 // Suppressive weapons don't work too well if there's no risk of being hit.
burst_delay = 1 // Burst faster than average.
origin_tech = list(TECH_COMBAT = 6, TECH_MAGNET = 6, TECH_ILLEGAL = 6)
+2 -1
View File
@@ -41,7 +41,8 @@
fire_sound = 'sound/weapons/Genhit.ogg'
projectile_type = /obj/item/projectile/energy/bolt
charge_cost = 480
self_recharge = 1
cell_type = /obj/item/weapon/cell/device/weapon/recharge
battery_lock = 1
charge_meter = 0
/obj/item/weapon/gun/energy/crossbow/ninja
+4 -2
View File
@@ -60,7 +60,8 @@
w_class = ITEMSIZE_HUGE
charge_cost = 300
projectile_type = /obj/item/projectile/beam/stun/darkmatter
self_recharge = 1
cell_type = /obj/item/weapon/cell/device/weapon/recharge
battery_lock = 1
accuracy = 2
firemodes = list(
@@ -118,7 +119,8 @@
item_state = "noise"
fire_sound = 'sound/effects/basscannon.ogg'
w_class = ITEMSIZE_HUGE
self_recharge = 1
cell_type = /obj/item/weapon/cell/device/weapon/recharge
battery_lock = 1
charge_cost = 600
projectile_type=/obj/item/projectile/sonic/weak