diff --git a/code/game/objects/items/weapons/power_cells.dm b/code/game/objects/items/weapons/power_cells.dm
index 5cab6b24cb..25f88f0270 100644
--- a/code/game/objects/items/weapons/power_cells.dm
+++ b/code/game/objects/items/weapons/power_cells.dm
@@ -22,6 +22,23 @@
viewers(user) << "\red [user] is licking the electrodes of the [src.name]! It looks like \he's trying to commit suicide."
return (FIRELOSS)
+//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 = "cell" //placeholder
+ w_class = 2
+ force = 0
+ throw_speed = 5
+ throw_range = 7
+ maxcharge = 1000
+ matter = list("metal" = 350, "glass" = 50)
+
+/obj/item/weapon/cell/device/variable/New(newloc, charge_amount)
+ ..(newloc)
+ maxcharge = charge_amount
+ charge = maxcharge
+
/obj/item/weapon/cell/crap
name = "\improper Nanotrasen brand rechargable AA battery"
desc = "You can't top the plasma top." //TOTALLY TRADEMARK INFRINGEMENT
diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm
index 8cc67772b5..875c13aa34 100644
--- a/code/modules/mob/living/silicon/robot/robot.dm
+++ b/code/modules/mob/living/silicon/robot/robot.dm
@@ -594,6 +594,8 @@
user << "Close the panel first."
else if(cell)
user << "There is a power cell already installed."
+ else if(W.w_class != 3)
+ user << "\The [W] is too [W.w_class < 3? "small" : "large"] to fit here."
else
user.drop_item()
W.loc = src
diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm
index 26ab2b2e98..fe33eef4fd 100644
--- a/code/modules/power/apc.dm
+++ b/code/modules/power/apc.dm
@@ -442,18 +442,21 @@
if(cell)
user << "There is a power cell already installed."
return
- else
- if (stat & MAINT)
- user << "There is no connector for your power cell."
- return
- user.drop_item()
- W.loc = src
- cell = W
- user.visible_message(\
- "[user.name] has inserted the power cell to [src.name]!",\
- "You insert the power cell.")
- chargecount = 0
- update_icon()
+ if (stat & MAINT)
+ user << "There is no connector for your power cell."
+ return
+ if(W.w_class != 3)
+ user << "\The [W] is too [W.w_class < 3? "small" : "large"] to fit here."
+ return
+
+ user.drop_item()
+ W.loc = src
+ cell = W
+ user.visible_message(\
+ "[user.name] has inserted the power cell to [src.name]!",\
+ "You insert the power cell.")
+ chargecount = 0
+ update_icon()
else if (istype(W, /obj/item/weapon/screwdriver)) // haxing
if(opened)
if (cell)
diff --git a/code/modules/projectiles/guns/energy.dm b/code/modules/projectiles/guns/energy.dm
index 161dd23e15..68cf5ad91d 100644
--- a/code/modules/projectiles/guns/energy.dm
+++ b/code/modules/projectiles/guns/energy.dm
@@ -14,7 +14,8 @@
var/obj/item/weapon/cell/power_supply //What type of power cell this uses
var/charge_cost = 100 //How much energy is needed to fire.
- var/cell_type = /obj/item/weapon/cell
+ var/maxcharge = 1000 //the capacity of the weapon's power cell. Specifying a cell_type overrides this value.
+ var/cell_type = null
var/projectile_type = /obj/item/projectile/beam/practice
var/modifystate
var/charge_meter = 1 //if set, the icon state will be chosen based on the current charge
@@ -45,7 +46,8 @@
..()
if(cell_type)
power_supply = new cell_type(src)
- power_supply.give(power_supply.maxcharge)
+ else
+ power_supply = new /obj/item/weapon/cell/device/variable(src, maxcharge)
if(self_recharge)
processing_objects.Add(src)
update_icon()