Swaps non-mounted recharging guns to batteries

This commit is contained in:
Anewbe
2017-10-27 20:00:27 -05:00
parent 957b6daecc
commit c9cbbd3a9b
10 changed files with 183 additions and 156 deletions

View File

@@ -2,6 +2,28 @@
// charge from 0 to 100% // charge from 0 to 100%
// fits in APC to provide backup power // 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() /obj/item/weapon/cell/New()
..() ..()
charge = maxcharge charge = maxcharge
@@ -16,7 +38,8 @@
/obj/item/weapon/cell/process() /obj/item/weapon/cell/process()
if(self_recharge) if(self_recharge)
give(charge_amount) if(world.time >= last_use + charge_delay)
give(charge_amount)
else else
return PROCESS_KILL return PROCESS_KILL
@@ -59,6 +82,7 @@
return 0 return 0
var/used = min(charge, amount) var/used = min(charge, amount)
charge -= used charge -= used
last_use = world.time
update_icon() update_icon()
return used return used
@@ -80,6 +104,8 @@
var/amount_used = min(maxcharge-charge,amount) var/amount_used = min(maxcharge-charge,amount)
charge += amount_used charge += amount_used
update_icon() update_icon()
if(loc)
loc.update_icon()
return amount_used return amount_used
@@ -112,7 +138,6 @@
S.reagents.clear_reagents() S.reagents.clear_reagents()
/obj/item/weapon/cell/proc/explode() /obj/item/weapon/cell/proc/explode()
var/turf/T = get_turf(src.loc) var/turf/T = get_turf(src.loc)
/* /*
@@ -207,3 +232,7 @@
return min(rand(10,20),rand(10,20)) return min(rand(10,20),rand(10,20))
else else
return 0 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)

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

View File

@@ -1,137 +1,92 @@
/obj/item/weapon/cell /obj/item/weapon/cell/crap
name = "power cell" name = "\improper rechargable AA battery"
desc = "A rechargable electrochemical power cell." desc = "You can't top the plasma top." //TOTALLY TRADEMARK INFRINGEMENT
icon = 'icons/obj/power.dmi' origin_tech = list(TECH_POWER = 0)
icon_state = "cell" maxcharge = 500
item_state = "cell" matter = list(DEFAULT_WALL_MATERIAL = 700, "glass" = 40)
origin_tech = list(TECH_POWER = 1)
force = 5.0 /obj/item/weapon/cell/crap/empty/New()
throwforce = 5.0 ..()
throw_speed = 3 charge = 0
throw_range = 5
w_class = ITEMSIZE_NORMAL /obj/item/weapon/cell/secborg
var/charge = 0 // note %age conveted to actual charge in New name = "security borg rechargable D battery"
var/maxcharge = 1000 origin_tech = list(TECH_POWER = 0)
var/rigged = 0 // true if rigged to explode maxcharge = 600 //600 max charge / 100 charge per shot = six shots
var/minor_fault = 0 //If not 100% reliable, it will build up faults. matter = list(DEFAULT_WALL_MATERIAL = 700, "glass" = 40)
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. /obj/item/weapon/cell/secborg/empty/New()
matter = list(DEFAULT_WALL_MATERIAL = 700, "glass" = 50) ..()
charge = 0
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>" /obj/item/weapon/cell/apc
return (FIRELOSS) name = "heavy-duty power cell"
origin_tech = list(TECH_POWER = 1)
//currently only used by energy-type guns, that may change in the future. maxcharge = 5000
/obj/item/weapon/cell/device matter = list(DEFAULT_WALL_MATERIAL = 700, "glass" = 50)
name = "device power cell"
desc = "A small power cell designed to power handheld devices." /obj/item/weapon/cell/high
icon_state = "dcell" name = "high-capacity power cell"
item_state = "egg6" origin_tech = list(TECH_POWER = 2)
w_class = ITEMSIZE_SMALL icon_state = "hcell"
force = 0 maxcharge = 10000
throw_speed = 5 matter = list(DEFAULT_WALL_MATERIAL = 700, "glass" = 60)
throw_range = 7
maxcharge = 480 /obj/item/weapon/cell/high/empty/New()
matter = list("metal" = 350, "glass" = 50) ..()
preserve_item = 1 charge = 0
/obj/item/weapon/cell/device/weapon /obj/item/weapon/cell/super
name = "weapon power cell" name = "super-capacity power cell"
desc = "A small power cell designed to power handheld weaponry." origin_tech = list(TECH_POWER = 5)
icon_state = "wcell" icon_state = "scell"
maxcharge = 2400 maxcharge = 20000
matter = list(DEFAULT_WALL_MATERIAL = 700, "glass" = 70)
/obj/item/weapon/cell/crap
name = "\improper rechargable AA battery" /obj/item/weapon/cell/super/empty/New()
desc = "You can't top the plasma top." //TOTALLY TRADEMARK INFRINGEMENT ..()
origin_tech = list(TECH_POWER = 0) charge = 0
maxcharge = 500
matter = list(DEFAULT_WALL_MATERIAL = 700, "glass" = 40) /obj/item/weapon/cell/hyper
name = "hyper-capacity power cell"
/obj/item/weapon/cell/crap/empty/New() origin_tech = list(TECH_POWER = 6)
..() icon_state = "hpcell"
charge = 0 maxcharge = 30000
matter = list(DEFAULT_WALL_MATERIAL = 700, "glass" = 80)
/obj/item/weapon/cell/secborg
name = "security borg rechargable D battery" /obj/item/weapon/cell/hyper/empty/New()
origin_tech = list(TECH_POWER = 0) ..()
maxcharge = 600 //600 max charge / 100 charge per shot = six shots charge = 0
matter = list(DEFAULT_WALL_MATERIAL = 700, "glass" = 40)
/obj/item/weapon/cell/infinite
/obj/item/weapon/cell/secborg/empty/New() name = "infinite-capacity power cell!"
..() icon_state = "icell"
charge = 0 origin_tech = null
maxcharge = 30000 //determines how badly mobs get shocked
/obj/item/weapon/cell/apc matter = list(DEFAULT_WALL_MATERIAL = 700, "glass" = 80)
name = "heavy-duty power cell"
origin_tech = list(TECH_POWER = 1) check_charge()
maxcharge = 5000 return 1
matter = list(DEFAULT_WALL_MATERIAL = 700, "glass" = 50) use()
return 1
/obj/item/weapon/cell/high
name = "high-capacity power cell" /obj/item/weapon/cell/potato
origin_tech = list(TECH_POWER = 2) name = "potato battery"
icon_state = "hcell" desc = "A rechargable starch based power cell."
maxcharge = 10000 origin_tech = list(TECH_POWER = 1)
matter = list(DEFAULT_WALL_MATERIAL = 700, "glass" = 60) icon = 'icons/obj/power.dmi' //'icons/obj/harvest.dmi'
icon_state = "potato_cell" //"potato_battery"
/obj/item/weapon/cell/high/empty/New() charge = 100
..() maxcharge = 300
charge = 0 minor_fault = 1
/obj/item/weapon/cell/super /obj/item/weapon/cell/slime
name = "super-capacity power cell" name = "charged slime core"
origin_tech = list(TECH_POWER = 5) desc = "A yellow slime core infused with phoron, it crackles with power."
icon_state = "scell" origin_tech = list(TECH_POWER = 4, TECH_BIO = 5)
maxcharge = 20000 icon = 'icons/mob/slimes.dmi' //'icons/obj/harvest.dmi'
matter = list(DEFAULT_WALL_MATERIAL = 700, "glass" = 70) icon_state = "yellow slime extract" //"potato_battery"
description_info = "This 'cell' holds a max charge of 10k and self recharges over time."
/obj/item/weapon/cell/super/empty/New() maxcharge = 10000
..() matter = null
charge = 0 self_recharge = TRUE
/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)
check_charge()
return 1
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

View File

@@ -34,12 +34,15 @@
/obj/item/weapon/gun/energy/New() /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) if(self_recharge)
power_supply = new /obj/item/weapon/cell/device/weapon(src)
processing_objects.Add(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() update_icon()
/obj/item/weapon/gun/energy/Destroy() /obj/item/weapon/gun/energy/Destroy()

View File

@@ -65,9 +65,8 @@
origin_tech = null origin_tech = null
fire_delay = 10 //Old pistol fire_delay = 10 //Old pistol
charge_cost = 480 //to compensate a bit for self-recharging charge_cost = 480 //to compensate a bit for self-recharging
self_recharge = 1 cell_type = /obj/item/weapon/cell/device/weapon/recharge/captain
recharge_time = 3 //Recharges a bit more quickly... battery_lock = 1
charge_delay = 100 //... but it takes a while to get started
/obj/item/weapon/gun/energy/lasercannon /obj/item/weapon/gun/energy/lasercannon
name = "laser cannon" name = "laser cannon"
@@ -87,7 +86,6 @@
accuracy = 3 accuracy = 3
charge_cost = 600 charge_cost = 600
/obj/item/weapon/gun/energy/lasercannon/mounted /obj/item/weapon/gun/energy/lasercannon/mounted
name = "mounted laser cannon" name = "mounted laser cannon"
self_recharge = 1 self_recharge = 1
@@ -145,10 +143,11 @@
item_state = "laser" item_state = "laser"
desc = "Standard issue weapon of the Imperial Guard" desc = "Standard issue weapon of the Imperial Guard"
origin_tech = list(TECH_COMBAT = 1, TECH_MAGNET = 2) origin_tech = list(TECH_COMBAT = 1, TECH_MAGNET = 2)
self_recharge = 1
matter = list(DEFAULT_WALL_MATERIAL = 2000) matter = list(DEFAULT_WALL_MATERIAL = 2000)
fire_sound = 'sound/weapons/Laser.ogg' fire_sound = 'sound/weapons/Laser.ogg'
projectile_type = /obj/item/projectile/beam/lastertag/blue projectile_type = /obj/item/projectile/beam/lastertag/blue
cell_type = /obj/item/weapon/cell/device/weapon/recharge
battery_lock = 1
var/required_vest var/required_vest
/obj/item/weapon/gun/energy/lasertag/special_check(var/mob/living/carbon/human/M) /obj/item/weapon/gun/energy/lasertag/special_check(var/mob/living/carbon/human/M)

View File

@@ -56,7 +56,8 @@
force = 8 //looks heavier than a pistol force = 8 //looks heavier than a pistol
w_class = ITEMSIZE_LARGE //Looks bigger than a pistol, too. 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 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 modifystate = null
// requires_two_hands = 1 // requires_two_hands = 1

View File

@@ -43,7 +43,8 @@
projectile_type = /obj/item/projectile/energy/floramut projectile_type = /obj/item/projectile/energy/floramut
origin_tech = list(TECH_MATERIAL = 2, TECH_BIO = 3, TECH_POWER = 3) origin_tech = list(TECH_MATERIAL = 2, TECH_BIO = 3, TECH_POWER = 3)
modifystate = "floramut" modifystate = "floramut"
self_recharge = 1 cell_type = /obj/item/weapon/cell/device/weapon/recharge
battery_lock = 1
var/decl/plantgene/gene = null var/decl/plantgene/gene = null
firemodes = list( firemodes = list(
@@ -137,7 +138,8 @@
charge_cost = 480 charge_cost = 480
projectile_type = /obj/item/projectile/change projectile_type = /obj/item/projectile/change
origin_tech = null origin_tech = null
self_recharge = 1 cell_type = /obj/item/weapon/cell/device/weapon/recharge
battery_lock = 1
charge_meter = 0 charge_meter = 0
/obj/item/weapon/gun/energy/staff/special_check(var/mob/user) /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 w_class = ITEMSIZE_HUGE
charge_cost = 24 // 100 shots, it's a spray and pray (to RNGesus) weapon. charge_cost = 24 // 100 shots, it's a spray and pray (to RNGesus) weapon.
projectile_type = /obj/item/projectile/energy/blue_pellet 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. accuracy = 5 // Suppressive weapons don't work too well if there's no risk of being hit.
burst_delay = 1 // Burst faster than average. burst_delay = 1 // Burst faster than average.
origin_tech = list(TECH_COMBAT = 6, TECH_MAGNET = 6, TECH_ILLEGAL = 6) origin_tech = list(TECH_COMBAT = 6, TECH_MAGNET = 6, TECH_ILLEGAL = 6)

View File

@@ -41,7 +41,8 @@
fire_sound = 'sound/weapons/Genhit.ogg' fire_sound = 'sound/weapons/Genhit.ogg'
projectile_type = /obj/item/projectile/energy/bolt projectile_type = /obj/item/projectile/energy/bolt
charge_cost = 480 charge_cost = 480
self_recharge = 1 cell_type = /obj/item/weapon/cell/device/weapon/recharge
battery_lock = 1
charge_meter = 0 charge_meter = 0
/obj/item/weapon/gun/energy/crossbow/ninja /obj/item/weapon/gun/energy/crossbow/ninja

View File

@@ -60,7 +60,8 @@
w_class = ITEMSIZE_HUGE w_class = ITEMSIZE_HUGE
charge_cost = 300 charge_cost = 300
projectile_type = /obj/item/projectile/beam/stun/darkmatter 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 accuracy = 2
firemodes = list( firemodes = list(
@@ -118,7 +119,8 @@
item_state = "noise" item_state = "noise"
fire_sound = 'sound/effects/basscannon.ogg' fire_sound = 'sound/effects/basscannon.ogg'
w_class = ITEMSIZE_HUGE w_class = ITEMSIZE_HUGE
self_recharge = 1 cell_type = /obj/item/weapon/cell/device/weapon/recharge
battery_lock = 1
charge_cost = 600 charge_cost = 600
projectile_type=/obj/item/projectile/sonic/weak projectile_type=/obj/item/projectile/sonic/weak

View File

@@ -885,7 +885,6 @@
#include "code\game\objects\items\weapons\paint.dm" #include "code\game\objects\items\weapons\paint.dm"
#include "code\game\objects\items\weapons\paiwire.dm" #include "code\game\objects\items\weapons\paiwire.dm"
#include "code\game\objects\items\weapons\policetape.dm" #include "code\game\objects\items\weapons\policetape.dm"
#include "code\game\objects\items\weapons\power_cells.dm"
#include "code\game\objects\items\weapons\RCD.dm" #include "code\game\objects\items\weapons\RCD.dm"
#include "code\game\objects\items\weapons\RSF.dm" #include "code\game\objects\items\weapons\RSF.dm"
#include "code\game\objects\items\weapons\scrolls.dm" #include "code\game\objects\items\weapons\scrolls.dm"
@@ -1958,6 +1957,8 @@
#include "code\modules\power\antimatter\containment_jar.dm" #include "code\modules\power\antimatter\containment_jar.dm"
#include "code\modules\power\antimatter\control.dm" #include "code\modules\power\antimatter\control.dm"
#include "code\modules\power\antimatter\shielding.dm" #include "code\modules\power\antimatter\shielding.dm"
#include "code\modules\power\cells\device_cells.dm"
#include "code\modules\power\cells\power_cells.dm"
#include "code\modules\power\fusion\_setup.dm" #include "code\modules\power\fusion\_setup.dm"
#include "code\modules\power\fusion\fusion_circuits.dm" #include "code\modules\power\fusion\fusion_circuits.dm"
#include "code\modules\power\fusion\fusion_particle_catcher.dm" #include "code\modules\power\fusion\fusion_particle_catcher.dm"