Energy weapons can be reloaded

This commit is contained in:
Anewbe
2016-10-06 21:30:52 -05:00
parent 62b02e8e05
commit 0f51fda83a
22 changed files with 218 additions and 141 deletions
@@ -24,19 +24,15 @@
/obj/item/weapon/cell/device
name = "device power cell"
desc = "A small power cell designed to power handheld devices."
icon_state = "cell" //placeholder
icon_state = "dcell"
item_state = "egg6"
w_class = ITEMSIZE_SMALL
force = 0
throw_speed = 5
throw_range = 7
maxcharge = 1000
maxcharge = 2400
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 rechargable AA battery"
desc = "You can't top the plasma top." //TOTALLY TRADEMARK INFRINGEMENT
@@ -126,6 +126,7 @@
/obj/item/clothing/glasses,
/obj/item/ammo_casing/shotgun,
/obj/item/ammo_magazine,
/obj/item/weapon/cell/device,
/obj/item/weapon/reagent_containers/food/snacks/donut/,
/obj/item/weapon/melee/baton,
/obj/item/weapon/gun/energy/taser,
+39 -15
View File
@@ -17,7 +17,7 @@
var/agonyforce = 60
var/status = 0 //whether the thing is on or not
var/obj/item/weapon/cell/bcell = null
var/hitcost = 1000 //oh god why do power cells carry so much charge? We probably need to make a distinction between "industrial" sized power cells for APCs and power cells for everything else.
var/hitcost = 240
/obj/item/weapon/melee/baton/suicide_act(mob/user)
user.visible_message("<span class='suicide'>\The [user] is putting the live [name] in \his mouth! It looks like \he's trying to commit suicide.</span>")
@@ -30,7 +30,7 @@
/obj/item/weapon/melee/baton/loaded/New() //this one starts with a cell pre-installed.
..()
bcell = new/obj/item/weapon/cell/high(src)
bcell = new/obj/item/weapon/cell/device(src)
update_icon()
return
@@ -40,11 +40,15 @@
if(bcell.checked_use(chrgdeductamt))
return 1
else
status = 0
update_icon()
return 0
return null
/obj/item/weapon/melee/baton/proc/powercheck(var/chrgdeductamt)
if(bcell)
if(bcell.charge < chrgdeductamt)
status = 0
update_icon()
/obj/item/weapon/melee/baton/update_icon()
if(status)
icon_state = "[initial(name)]_active"
@@ -69,26 +73,31 @@
/obj/item/weapon/melee/baton/attackby(obj/item/weapon/W, mob/user)
if(istype(W, /obj/item/weapon/cell))
if(!bcell)
user.drop_item()
W.loc = src
bcell = W
user << "<span class='notice'>You install a cell in [src].</span>"
update_icon()
if(istype(W, /obj/item/weapon/cell/device))
if(!bcell)
user.drop_item()
W.loc = src
bcell = W
user << "<span class='notice'>You install a cell in [src].</span>"
update_icon()
else
user << "<span class='notice'>[src] already has a cell.</span>"
else
user << "<span class='notice'>[src] already has a cell.</span>"
user << "<span class='notice'>This cell is not fitted for [src].</span>"
else if(istype(W, /obj/item/weapon/screwdriver))
/obj/item/weapon/melee/baton/attack_hand(mob/user as mob)
if(user.get_inactive_hand() == src)
if(bcell)
bcell.update_icon()
bcell.loc = get_turf(src.loc)
user.put_in_hands(bcell)
bcell = null
user << "<span class='notice'>You remove the cell from the [src].</span>"
status = 0
update_icon()
return
..()
return
else
return ..()
/obj/item/weapon/melee/baton/attack_self(mob/user)
if(bcell && bcell.charge > hitcost)
@@ -149,6 +158,7 @@
if(ishuman(target))
var/mob/living/carbon/human/H = target
H.forcesay(hit_appends)
powercheck(hitcost)
/obj/item/weapon/melee/baton/emp_act(severity)
if(bcell)
@@ -157,7 +167,7 @@
//secborg stun baton module
/obj/item/weapon/melee/baton/robot
hitcost = 500
hitcost = 120
/obj/item/weapon/melee/baton/robot/attack_self(mob/user)
//try to find our power cell
@@ -182,3 +192,17 @@
hitcost = 2500
attack_verb = list("poked")
slot_flags = null
/obj/item/weapon/melee/baton/cattleprod/attackby(obj/item/weapon/W, mob/user)
if(istype(W, /obj/item/weapon/cell))
if(!istype(W, /obj/item/weapon/cell/device))
if(!bcell)
user.drop_item()
W.loc = src
bcell = W
user << "<span class='notice'>You install a cell in [src].</span>"
update_icon()
else
user << "<span class='notice'>[src] already has a cell.</span>"
else
user << "<span class='notice'>This cell is not fitted for [src].</span>"