Merge pull request #3175 from Anewbe/hands_things

Device Cell QOL
This commit is contained in:
MagmaRam
2017-03-30 20:49:24 -05:00
committed by GitHub
6 changed files with 180 additions and 9 deletions
+15 -9
View File
@@ -8,7 +8,7 @@ obj/machinery/recharger
idle_power_usage = 4
active_power_usage = 40000 //40 kW
var/obj/item/charging = null
var/list/allowed_devices = list(/obj/item/weapon/gun/energy, /obj/item/weapon/melee/baton, /obj/item/device/laptop, /obj/item/weapon/cell, /obj/item/device/flashlight, /obj/item/device/electronic_assembly)
var/list/allowed_devices = list(/obj/item/weapon/gun/energy, /obj/item/weapon/melee/baton, /obj/item/device/laptop, /obj/item/weapon/cell, /obj/item/device/flashlight, /obj/item/device/electronic_assembly, /obj/item/weapon/weldingtool/electric)
var/icon_state_charged = "recharger2"
var/icon_state_charging = "recharger1"
var/icon_state_idle = "recharger0" //also when unpowered
@@ -33,19 +33,19 @@ obj/machinery/recharger
if(allowed)
if(charging)
user << "<span class='warning'>\A [charging] is already charging here.</span>"
to_chat(user, "<span class='warning'>\A [charging] is already charging here.</span>")
return
// Checks to make sure he's not in space doing it, and that the area got proper power.
if(!powered())
user << "<span class='warning'>The [name] blinks red as you try to insert the item!</span>"
to_chat(user, "<span class='warning'>The [name] blinks red as you try to insert the item!</span>")
return
if(istype(G, /obj/item/weapon/gun/energy))
var/obj/item/weapon/gun/energy/E = G
if(!E.power_supply)
user << "<span class='notice'>Your gun has no power cell.</span>"
to_chat(user, "<span class='notice'>Your gun has no power cell.</span>")
return
if(E.self_recharge)
user << "<span class='notice'>Your gun has no recharge port.</span>"
to_chat(user, "<span class='notice'>Your gun has no recharge port.</span>")
return
if(istype(G, /obj/item/weapon/gun/energy/staff))
return
@@ -65,16 +65,22 @@ obj/machinery/recharger
if(!assembly.battery)
to_chat(user, "<span class='warning'>The assembly doesn't have a power cell.</span>")
return
if(istype(G, /obj/item/weapon/weldingtool/electric))
var/obj/item/weapon/weldingtool/electric/welder = G
if(!welder.power_supply)
to_chat(user, "<span class='notice'>Your welder has no power cell.</span>")
return
user.drop_item()
G.loc = src
charging = G
update_icon()
else if(portable && istype(G, /obj/item/weapon/wrench))
if(charging)
user << "<span class='warning'>Remove [charging] first!</span>"
to_chat(user, "<span class='warning'>Remove [charging] first!</span>")
return
anchored = !anchored
user << "You [anchored ? "attached" : "detached"] the recharger."
to_chat(user, "You [anchored ? "attached" : "detached"] the recharger.")
playsound(loc, 'sound/items/Ratchet.ogg', 75, 1)
else if(default_deconstruction_screwdriver(user, G))
return
@@ -208,8 +214,8 @@ obj/machinery/recharger
name = "wall recharger"
icon = 'icons/obj/stationobjs.dmi'
icon_state = "wrecharger0"
active_power_usage = 25000 //25 kW , It's more specialized than the standalone recharger (guns and batons only) so make it more powerful
allowed_devices = list(/obj/item/weapon/gun/energy, /obj/item/weapon/melee/baton, /obj/item/weapon/cell/device)
active_power_usage = 25000 //25 kW , It's more specialized than the standalone recharger (guns, batons, and flashlights only) so make it more powerful
allowed_devices = list(/obj/item/weapon/gun/energy, /obj/item/weapon/melee/baton, /obj/item/device/flashlight, /obj/item/weapon/cell/device)
icon_state_charged = "wrecharger2"
icon_state_charging = "wrecharger1"
icon_state_idle = "wrecharger0"
@@ -181,6 +181,38 @@
else
return ..()
/obj/item/device/flashlight/MouseDrop(obj/over_object as obj)
if(!canremove)
return
if (ishuman(usr) || issmall(usr)) //so monkeys can take off their backpacks -- Urist
if (istype(usr.loc,/obj/mecha)) // stops inventory actions in a mech. why?
return
if (!( istype(over_object, /obj/screen) ))
return ..()
//makes sure that the thing is equipped, so that we can't drag it into our hand from miles away.
//there's got to be a better way of doing this.
if (!(src.loc == usr) || (src.loc && src.loc.loc == usr))
return
if (( usr.restrained() ) || ( usr.stat ))
return
if ((src.loc == usr) && !(istype(over_object, /obj/screen)) && !usr.unEquip(src))
return
switch(over_object.name)
if("r_hand")
usr.u_equip(src)
usr.put_in_r_hand(src)
if("l_hand")
usr.u_equip(src)
usr.put_in_l_hand(src)
src.add_fingerprint(usr)
/obj/item/device/flashlight/attackby(obj/item/weapon/W, mob/user as mob)
if(power_use)
if(istype(W, /obj/item/weapon/cell))
@@ -28,6 +28,38 @@
update_icon()
return
/obj/item/weapon/melee/baton/MouseDrop(obj/over_object as obj)
if(!canremove)
return
if (ishuman(usr) || issmall(usr)) //so monkeys can take off their backpacks -- Urist
if (istype(usr.loc,/obj/mecha)) // stops inventory actions in a mech. why?
return
if (!( istype(over_object, /obj/screen) ))
return ..()
//makes sure that the thing is equipped, so that we can't drag it into our hand from miles away.
//there's got to be a better way of doing this.
if (!(src.loc == usr) || (src.loc && src.loc.loc == usr))
return
if (( usr.restrained() ) || ( usr.stat ))
return
if ((src.loc == usr) && !(istype(over_object, /obj/screen)) && !usr.unEquip(src))
return
switch(over_object.name)
if("r_hand")
usr.u_equip(src)
usr.put_in_r_hand(src)
if("l_hand")
usr.u_equip(src)
usr.put_in_l_hand(src)
src.add_fingerprint(usr)
/obj/item/weapon/melee/baton/loaded/New() //this one starts with a cell pre-installed.
..()
bcell = new/obj/item/weapon/cell/device/weapon(src)
+32
View File
@@ -297,6 +297,38 @@
M.update_inv_l_hand()
M.update_inv_r_hand()
/obj/item/weapon/weldingtool/MouseDrop(obj/over_object as obj)
if(!canremove)
return
if (ishuman(usr) || issmall(usr)) //so monkeys can take off their backpacks -- Urist
if (istype(usr.loc,/obj/mecha)) // stops inventory actions in a mech. why?
return
if (!( istype(over_object, /obj/screen) ))
return ..()
//makes sure that the thing is equipped, so that we can't drag it into our hand from miles away.
//there's got to be a better way of doing this.
if (!(src.loc == usr) || (src.loc && src.loc.loc == usr))
return
if (( usr.restrained() ) || ( usr.stat ))
return
if ((src.loc == usr) && !(istype(over_object, /obj/screen)) && !usr.unEquip(src))
return
switch(over_object.name)
if("r_hand")
usr.u_equip(src)
usr.put_in_r_hand(src)
if("l_hand")
usr.u_equip(src)
usr.put_in_l_hand(src)
src.add_fingerprint(usr)
//Sets the welding state of the welding tool. If you see W.welding = 1 anywhere, please change it to W.setWelding(1)
//so that the welding tool updates accordingly
/obj/item/weapon/weldingtool/proc/setWelding(var/set_welding, var/mob/M)
+32
View File
@@ -223,6 +223,38 @@
attached_lock.stored_dna = list()
return 1
/obj/item/weapon/gun/MouseDrop(obj/over_object as obj)
if(!canremove)
return
if (ishuman(usr) || issmall(usr)) //so monkeys can take off their backpacks -- Urist
if (istype(usr.loc,/obj/mecha)) // stops inventory actions in a mech. why?
return
if (!( istype(over_object, /obj/screen) ))
return ..()
//makes sure that the thing is equipped, so that we can't drag it into our hand from miles away.
//there's got to be a better way of doing this.
if (!(src.loc == usr) || (src.loc && src.loc.loc == usr))
return
if (( usr.restrained() ) || ( usr.stat ))
return
if ((src.loc == usr) && !(istype(over_object, /obj/screen)) && !usr.unEquip(src))
return
switch(over_object.name)
if("r_hand")
usr.u_equip(src)
usr.put_in_r_hand(src)
if("l_hand")
usr.u_equip(src)
usr.put_in_l_hand(src)
src.add_fingerprint(usr)
/obj/item/weapon/gun/proc/Fire(atom/target, mob/living/user, clickparams, pointblank=0, reflex=0)
if(!user || !target) return
@@ -0,0 +1,37 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
#################################
# Your name.
author: Anewbe
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- rscadd: "Energy weapons, flashlights, stunbatons, and welders can now be moved from hand to hand by click+dragging."
- rscadd: "Flashlights can now be placed in wall rechargers."