up to upstream-merge-27868

This commit is contained in:
LetterJay
2017-06-11 00:04:00 -05:00
parent 4c8cf31f73
commit b80a184d97
39 changed files with 333 additions and 411 deletions

View File

@@ -1,5 +1,10 @@
/client /client
var/list/atom/selected_target[2] var/list/atom/selected_target[2]
var/obj/item/active_mousedown_item = null
var/mouseParams = ""
var/mouseLocation = null
var/mouseObject = null
var/mouseControlObject = null
/client/MouseDown(object, location, control, params) /client/MouseDown(object, location, control, params)
var/delay = mob.CanMobAutoclick(object, location, params) var/delay = mob.CanMobAutoclick(object, location, params)
@@ -9,14 +14,26 @@
while(selected_target[1]) while(selected_target[1])
Click(selected_target[1], location, control, selected_target[2]) Click(selected_target[1], location, control, selected_target[2])
sleep(delay) sleep(delay)
active_mousedown_item = mob.canMobMousedown(object, location, params)
if(active_mousedown_item)
active_mousedown_item.onMouseDown(object, location, params, mob)
/client/MouseUp(object, location, control, params) /client/MouseUp(object, location, control, params)
selected_target[1] = null selected_target[1] = null
if(active_mousedown_item)
active_mousedown_item.onMouseUp(object, location, params, mob)
active_mousedown_item = null
/client/MouseDrag(src_object,atom/over_object,src_location,over_location,src_control,over_control,params) /client/MouseDrag(src_object,atom/over_object,src_location,over_location,src_control,over_control,params)
mouseParams = params
mouseLocation = over_location
mouseObject = over_object
mouseControlObject = over_control
if(selected_target[1] && over_object && over_object.IsAutoclickable()) if(selected_target[1] && over_object && over_object.IsAutoclickable())
selected_target[1] = over_object selected_target[1] = over_object
selected_target[2] = params selected_target[2] = params
if(active_mousedown_item)
active_mousedown_item.onMouseDrag(src_object, over_object, src_location, over_location, params, mob)
/mob/proc/CanMobAutoclick(object, location, params) /mob/proc/CanMobAutoclick(object, location, params)
@@ -27,8 +44,31 @@
if(h) if(h)
. = h.CanItemAutoclick(object, location, params) . = h.CanItemAutoclick(object, location, params)
/mob/proc/canMobMousedown(object, location, params)
/mob/living/carbon/canMobMousedown(atom/object, location, params)
var/obj/item/H = get_active_held_item()
if(H)
. = H.canItemMouseDown(object, location, params)
/obj/item/proc/CanItemAutoclick(object, location, params) /obj/item/proc/CanItemAutoclick(object, location, params)
/obj/item/proc/canItemMouseDown(object, location, params)
if(canMouseDown)
return src
/obj/item/proc/onMouseDown(object, location, params, mob)
return
/obj/item/proc/onMouseUp(object, location, params, mob)
return
/obj/item/proc/onMouseDrag(src_object, over_object, src_location, over_location, params, mob)
return
/obj/item
var/canMouseDown = FALSE
/obj/item/weapon/gun /obj/item/weapon/gun
var/automatic = 0 //can gun use it, 0 is no, anything above 0 is the delay between clicks in ds var/automatic = 0 //can gun use it, 0 is no, anything above 0 is the delay between clicks in ds
@@ -43,3 +83,10 @@
/obj/screen/click_catcher/IsAutoclickable() /obj/screen/click_catcher/IsAutoclickable()
. = 1 . = 1
//Please don't roast me too hard
/client/MouseMove(object,location,control,params)
mouseParams = params
mouseLocation = location
mouseObject = object
mouseControlObject = control

View File

@@ -679,3 +679,7 @@
set waitfor = FALSE set waitfor = FALSE
if(!anchored && has_gravity()) if(!anchored && has_gravity())
step(src, movedir) step(src, movedir)
//Returns an atom's power cell, if it has one. Overload for individual items.
/atom/movable/proc/get_cell()
return

View File

@@ -29,7 +29,7 @@
if(charge) if(charge)
. = min(charge, 250) . = min(charge, 250)
charge = use(.) charge = use(.)
updateicon() update_icon()
/obj/machinery/light/power_drain(clockcult_user) /obj/machinery/light/power_drain(clockcult_user)
if(on) if(on)

View File

@@ -9,7 +9,7 @@
S.update_icon() S.update_icon()
S.power_change() S.power_change()
var/list/skipped_areas = list(/area/engine/engineering, /area/ai_monitored/turret_protected/ai) var/list/skipped_areas = list(/area/engine/engineering, /area/engine/supermatter, /area/engine/atmospherics_engine, /area/ai_monitored/turret_protected/ai)
for(var/area/A in world) for(var/area/A in world)
if( !A.requires_power || A.always_unpowered ) if( !A.requires_power || A.always_unpowered )

View File

@@ -71,7 +71,7 @@
/obj/machinery/cell_charger/proc/removecell() /obj/machinery/cell_charger/proc/removecell()
charging.updateicon() charging.update_icon()
charging = null charging = null
chargelevel = -1 chargelevel = -1
updateicon() updateicon()

View File

@@ -925,181 +925,3 @@
on = 0 on = 0
spawn(100) spawn(100)
on = 1 on = 1
/////// MANNED TURRET ////////
/obj/machinery/manned_turret
name = "machine gun turret"
desc = "While the trigger is held down, this gun will redistribute recoil to allow its user to easily shift targets."
icon = 'icons/obj/turrets.dmi'
icon_state = "machinegun"
can_buckle = TRUE
density = TRUE
max_integrity = 100
obj_integrity = 100
buckle_lying = 0
layer = ABOVE_MOB_LAYER
var/view_range = 10
var/cooldown = 0
var/projectile_type = /obj/item/projectile/bullet/weakbullet3
var/rate_of_fire = 1
var/number_of_shots = 40
var/cooldown_duration = 90
var/atom/target
var/turf/target_turf
var/warned = FALSE
var/mouseparams
//BUCKLE HOOKS
/obj/machinery/manned_turret/unbuckle_mob(mob/living/buckled_mob,force = 0)
playsound(src,'sound/mecha/mechmove01.ogg', 50, 1)
for(var/obj/item/I in buckled_mob.held_items)
if(istype(I, /obj/item/gun_control))
qdel(I)
if(istype(buckled_mob))
buckled_mob.pixel_x = 0
buckled_mob.pixel_y = 0
if(buckled_mob.client)
buckled_mob.client.change_view(world.view)
anchored = FALSE
. = ..()
/obj/machinery/manned_turret/user_buckle_mob(mob/living/M, mob/living/carbon/user)
if(user.incapacitated() || !istype(user))
return
M.forceMove(get_turf(src))
..()
for(var/V in M.held_items)
var/obj/item/I = V
if(istype(I))
if(M.dropItemToGround(I))
var/obj/item/gun_control/TC = new /obj/item/gun_control(src)
M.put_in_hands(TC)
else //Entries in the list should only ever be items or null, so if it's not an item, we can assume it's an empty hand
var/obj/item/gun_control/TC = new /obj/item/gun_control(src)
M.put_in_hands(TC)
M.pixel_y = 14
layer = ABOVE_MOB_LAYER
setDir(SOUTH)
playsound(src,'sound/mecha/mechmove01.ogg', 50, 1)
anchored = TRUE
if(user.client)
user.client.change_view(view_range)
/obj/item/gun_control
name = "turret controls"
icon = 'icons/obj/weapons.dmi'
icon_state = "offhand"
w_class = WEIGHT_CLASS_HUGE
flags = ABSTRACT | NODROP | NOBLUDGEON
resistance_flags = FIRE_PROOF | UNACIDABLE | ACID_PROOF
var/obj/machinery/manned_turret/turret
/obj/item/gun_control/New(obj/machinery/manned_turret/MT)
if(MT)
turret = MT
else
qdel(src)
/obj/item/gun_control/CanItemAutoclick()
return 1
/obj/item/gun_control/attack_obj(obj/O, mob/living/user)
user.changeNext_move(CLICK_CD_MELEE)
O.attacked_by(src, user)
/obj/item/gun_control/attack(mob/living/M, mob/living/user)
user.lastattacked = M
M.lastattacker = user
M.attacked_by(src, user)
add_fingerprint(user)
/obj/item/gun_control/afterattack(atom/targeted_atom, mob/user, flag, params)
..()
var/obj/machinery/manned_turret/E = user.buckled
E.setDir(get_dir(E,targeted_atom))
user.setDir(E.dir)
E.mouseparams = params
switch(E.dir)
if(NORTH)
E.layer = BELOW_MOB_LAYER
user.pixel_x = 0
user.pixel_y = -14
if(NORTHEAST)
E.layer = BELOW_MOB_LAYER
user.pixel_x = -8
user.pixel_y = -4
if(EAST)
E.layer = ABOVE_MOB_LAYER
user.pixel_x = -14
user.pixel_y = 0
if(SOUTHEAST)
E.layer = BELOW_MOB_LAYER
user.pixel_x = -8
user.pixel_y = 4
if(SOUTH)
E.layer = ABOVE_MOB_LAYER
user.pixel_x = 0
user.pixel_y = 14
if(SOUTHWEST)
E.layer = BELOW_MOB_LAYER
user.pixel_x = 8
user.pixel_y = 4
if(WEST)
E.layer = ABOVE_MOB_LAYER
user.pixel_x = 14
user.pixel_y = 0
if(NORTHWEST)
E.layer = BELOW_MOB_LAYER
user.pixel_x = 8
user.pixel_y = -4
E.checkfire(targeted_atom, user)
/obj/machinery/manned_turret/proc/checkfire(atom/targeted_atom, mob/user)
target = targeted_atom
if(target == user || target == get_turf(src))
return
if(world.time < cooldown)
if(!warned && world.time > (cooldown - cooldown_duration + rate_of_fire*number_of_shots)) // To capture the window where one is done firing
warned = TRUE
playsound(src, 'sound/weapons/sear.ogg', 100, 1)
return
else
cooldown = world.time + cooldown_duration
warned = FALSE
volley(user)
/obj/machinery/manned_turret/proc/volley(mob/user)
target_turf = get_turf(target)
for(var/i in 1 to number_of_shots)
addtimer(CALLBACK(src, /obj/machinery/manned_turret/.proc/fire_helper, user), i*rate_of_fire)
/obj/machinery/manned_turret/proc/fire_helper(mob/user)
if(!src)
return
var/turf/targets_from = get_turf(src)
if(QDELETED(target))
target = target_turf
var/obj/item/projectile/P = new projectile_type(targets_from)
P.current = targets_from
P.starting = targets_from
P.firer = user
P.original = target
playsound(src, 'sound/weapons/Gunshot_smg.ogg', 75, 1)
P.preparePixelProjectile(target, target_turf, user, mouseparams, rand(-9, 9))
P.fire()
/obj/machinery/manned_turret/ultimate // Admin-only proof of concept for autoclicker automatics
name = "Infinity Gun"
view_range = 12
projectile_type = /obj/item/projectile/bullet/weakbullet3
/obj/machinery/manned_turret/ultimate/checkfire(atom/targeted_atom, mob/user)
target = targeted_atom
if(target == user || target == get_turf(src))
return
target_turf = get_turf(target)
fire_helper(user)

View File

@@ -108,41 +108,25 @@
var/using_power = 0 var/using_power = 0
if(charging) if(charging)
if(istype(charging, /obj/item/weapon/gun/energy)) var/obj/item/weapon/stock_parts/cell/C = charging.get_cell()
var/obj/item/weapon/gun/energy/E = charging if(C)
if(E.power_supply.charge < E.power_supply.maxcharge) if(C.charge < C.maxcharge)
E.power_supply.give(E.power_supply.chargerate * recharge_coeff) C.give(C.chargerate * recharge_coeff)
E.recharge_newshot()
use_power(250 * recharge_coeff) use_power(250 * recharge_coeff)
using_power = 1 using_power = 1
update_icon(using_power)
if(istype(charging, /obj/item/weapon/gun/energy))
if(istype(charging, /obj/item/weapon/melee/baton)) var/obj/item/weapon/gun/energy/E = charging
var/obj/item/weapon/melee/baton/B = charging E.recharge_newshot()
if(B.bcell) return
if(B.bcell.give(B.bcell.chargerate * recharge_coeff))
use_power(200 * recharge_coeff)
using_power = 1
if(istype(charging, /obj/item/ammo_box/magazine/recharge)) if(istype(charging, /obj/item/ammo_box/magazine/recharge))
var/obj/item/ammo_box/magazine/recharge/R = charging var/obj/item/ammo_box/magazine/recharge/R = charging
if(R.stored_ammo.len < R.max_ammo) if(R.stored_ammo.len < R.max_ammo)
R.stored_ammo += new R.ammo_type(R) R.stored_ammo += new R.ammo_type(R)
use_power(200 * recharge_coeff) use_power(200 * recharge_coeff)
using_power = 1 using_power = 1
update_icon(using_power)
if(istype(charging, /obj/item/device/modular_computer)) return
var/obj/item/device/modular_computer/C = charging
var/obj/item/weapon/computer_hardware/battery/battery_module = C.all_components[MC_CELL]
if(battery_module)
var/obj/item/weapon/computer_hardware/battery/B = battery_module
if(B.battery)
if(B.battery.charge < B.battery.maxcharge)
B.battery.give(B.battery.chargerate * recharge_coeff)
use_power(200 * recharge_coeff)
using_power = 1
update_icon(using_power)
/obj/machinery/recharger/power_change() /obj/machinery/recharger/power_change()
..() ..()
@@ -152,13 +136,13 @@
if(!(stat & (NOPOWER|BROKEN)) && anchored) if(!(stat & (NOPOWER|BROKEN)) && anchored)
if(istype(charging, /obj/item/weapon/gun/energy)) if(istype(charging, /obj/item/weapon/gun/energy))
var/obj/item/weapon/gun/energy/E = charging var/obj/item/weapon/gun/energy/E = charging
if(E.power_supply) if(E.cell)
E.power_supply.emp_act(severity) E.cell.emp_act(severity)
else if(istype(charging, /obj/item/weapon/melee/baton)) else if(istype(charging, /obj/item/weapon/melee/baton))
var/obj/item/weapon/melee/baton/B = charging var/obj/item/weapon/melee/baton/B = charging
if(B.bcell) if(B.cell)
B.bcell.charge = 0 B.cell.charge = 0
..() ..()

View File

@@ -24,6 +24,9 @@
var/settableTemperatureMedian = 30 + T0C var/settableTemperatureMedian = 30 + T0C
var/settableTemperatureRange = 30 var/settableTemperatureRange = 30
/obj/machinery/space_heater/get_cell()
return cell
/obj/machinery/space_heater/New() /obj/machinery/space_heater/New()
..() ..()
cell = new(src) cell = new(src)

View File

@@ -142,6 +142,9 @@
diag_hud_set_mechstat() diag_hud_set_mechstat()
diag_hud_set_mechtracking() diag_hud_set_mechtracking()
/obj/mecha/get_cell()
return cell
/obj/mecha/Destroy() /obj/mecha/Destroy()
go_out() go_out()

View File

@@ -19,7 +19,7 @@
var/safety = 1 //if you can zap people with the defibs on harm mode var/safety = 1 //if you can zap people with the defibs on harm mode
var/powered = 0 //if there's a cell in the defib with enough power for a revive, blocks paddles from reviving otherwise var/powered = 0 //if there's a cell in the defib with enough power for a revive, blocks paddles from reviving otherwise
var/obj/item/weapon/twohanded/shockpaddles/paddles var/obj/item/weapon/twohanded/shockpaddles/paddles
var/obj/item/weapon/stock_parts/cell/high/bcell = null var/obj/item/weapon/stock_parts/cell/high/cell
var/combat = 0 //can we revive through space suits? var/combat = 0 //can we revive through space suits?
var/grab_ghost = FALSE // Do we pull the ghost back into their body? var/grab_ghost = FALSE // Do we pull the ghost back into their body?
@@ -29,10 +29,13 @@
update_icon() update_icon()
return return
/obj/item/weapon/defibrillator/get_cell()
return cell
/obj/item/weapon/defibrillator/loaded/Initialize() //starts with hicap /obj/item/weapon/defibrillator/loaded/Initialize() //starts with hicap
. = ..() . = ..()
paddles = make_paddles() paddles = make_paddles()
bcell = new(src) cell = new(src)
update_icon() update_icon()
return return
@@ -42,8 +45,8 @@
update_charge() update_charge()
/obj/item/weapon/defibrillator/proc/update_power() /obj/item/weapon/defibrillator/proc/update_power()
if(bcell) if(cell)
if(bcell.charge < paddles.revivecost) if(cell.charge < paddles.revivecost)
powered = 0 powered = 0
else else
powered = 1 powered = 1
@@ -56,21 +59,21 @@
add_overlay("[initial(icon_state)]-paddles") add_overlay("[initial(icon_state)]-paddles")
if(powered) if(powered)
add_overlay("[initial(icon_state)]-powered") add_overlay("[initial(icon_state)]-powered")
if(!bcell) if(!cell)
add_overlay("[initial(icon_state)]-nocell") add_overlay("[initial(icon_state)]-nocell")
if(!safety) if(!safety)
add_overlay("[initial(icon_state)]-emagged") add_overlay("[initial(icon_state)]-emagged")
/obj/item/weapon/defibrillator/proc/update_charge() /obj/item/weapon/defibrillator/proc/update_charge()
if(powered) //so it doesn't show charge if it's unpowered if(powered) //so it doesn't show charge if it's unpowered
if(bcell) if(cell)
var/ratio = bcell.charge / bcell.maxcharge var/ratio = cell.charge / cell.maxcharge
ratio = Ceiling(ratio*4) * 25 ratio = Ceiling(ratio*4) * 25
add_overlay("[initial(icon_state)]-charge[ratio]") add_overlay("[initial(icon_state)]-charge[ratio]")
/obj/item/weapon/defibrillator/CheckParts(list/parts_list) /obj/item/weapon/defibrillator/CheckParts(list/parts_list)
..() ..()
bcell = locate(/obj/item/weapon/stock_parts/cell) in contents cell = locate(/obj/item/weapon/stock_parts/cell) in contents
update_icon() update_icon()
/obj/item/weapon/defibrillator/ui_action_click() /obj/item/weapon/defibrillator/ui_action_click()
@@ -105,7 +108,7 @@
toggle_paddles() toggle_paddles()
else if(istype(W, /obj/item/weapon/stock_parts/cell)) else if(istype(W, /obj/item/weapon/stock_parts/cell))
var/obj/item/weapon/stock_parts/cell/C = W var/obj/item/weapon/stock_parts/cell/C = W
if(bcell) if(cell)
to_chat(user, "<span class='notice'>[src] already has a cell.</span>") to_chat(user, "<span class='notice'>[src] already has a cell.</span>")
else else
if(C.maxcharge < paddles.revivecost) if(C.maxcharge < paddles.revivecost)
@@ -113,15 +116,15 @@
return return
if(!user.transferItemToLoc(W, src)) if(!user.transferItemToLoc(W, src))
return return
bcell = W cell = W
to_chat(user, "<span class='notice'>You install a cell in [src].</span>") to_chat(user, "<span class='notice'>You install a cell in [src].</span>")
update_icon() update_icon()
else if(istype(W, /obj/item/weapon/screwdriver)) else if(istype(W, /obj/item/weapon/screwdriver))
if(bcell) if(cell)
bcell.updateicon() cell.update_icon()
bcell.loc = get_turf(src.loc) cell.loc = get_turf(src.loc)
bcell = null cell = null
to_chat(user, "<span class='notice'>You remove the cell from [src].</span>") to_chat(user, "<span class='notice'>You remove the cell from [src].</span>")
update_icon() update_icon()
else else
@@ -136,7 +139,7 @@
to_chat(user, "<span class='notice'>You silently enable [src]'s safety protocols with the cryptographic sequencer.") to_chat(user, "<span class='notice'>You silently enable [src]'s safety protocols with the cryptographic sequencer.")
/obj/item/weapon/defibrillator/emp_act(severity) /obj/item/weapon/defibrillator/emp_act(severity)
if(bcell) if(cell)
deductcharge(1000 / severity) deductcharge(1000 / severity)
if(safety) if(safety)
safety = 0 safety = 0
@@ -200,11 +203,11 @@
update_icon() update_icon()
/obj/item/weapon/defibrillator/proc/deductcharge(chrgdeductamt) /obj/item/weapon/defibrillator/proc/deductcharge(chrgdeductamt)
if(bcell) if(cell)
if(bcell.charge < (paddles.revivecost+chrgdeductamt)) if(cell.charge < (paddles.revivecost+chrgdeductamt))
powered = 0 powered = 0
update_icon() update_icon()
if(bcell.use(chrgdeductamt)) if(cell.use(chrgdeductamt))
update_icon() update_icon()
return 1 return 1
else else
@@ -213,8 +216,8 @@
/obj/item/weapon/defibrillator/proc/cooldowncheck(mob/user) /obj/item/weapon/defibrillator/proc/cooldowncheck(mob/user)
spawn(50) spawn(50)
if(bcell) if(cell)
if(bcell.charge >= paddles.revivecost) if(cell.charge >= paddles.revivecost)
user.visible_message("<span class='notice'>[src] beeps: Unit ready.</span>") user.visible_message("<span class='notice'>[src] beeps: Unit ready.</span>")
playsound(get_turf(src), 'sound/machines/defib_ready.ogg', 50, 0) playsound(get_turf(src), 'sound/machines/defib_ready.ogg', 50, 0)
else else
@@ -240,7 +243,7 @@
/obj/item/weapon/defibrillator/compact/loaded/Initialize() /obj/item/weapon/defibrillator/compact/loaded/Initialize()
. = ..() . = ..()
paddles = make_paddles() paddles = make_paddles()
bcell = new(src) cell = new(src)
update_icon() update_icon()
/obj/item/weapon/defibrillator/compact/combat /obj/item/weapon/defibrillator/compact/combat
@@ -252,7 +255,7 @@
/obj/item/weapon/defibrillator/compact/combat/loaded/Initialize() /obj/item/weapon/defibrillator/compact/combat/loaded/Initialize()
. = ..() . = ..()
paddles = make_paddles() paddles = make_paddles()
bcell = new /obj/item/weapon/stock_parts/cell/infinite(src) cell = new /obj/item/weapon/stock_parts/cell/infinite(src)
update_icon() update_icon()
/obj/item/weapon/defibrillator/compact/combat/loaded/attackby(obj/item/weapon/W, mob/user, params) /obj/item/weapon/defibrillator/compact/combat/loaded/attackby(obj/item/weapon/W, mob/user, params)

View File

@@ -13,7 +13,7 @@
var/stunforce = 7 var/stunforce = 7
var/status = 0 var/status = 0
var/obj/item/weapon/stock_parts/cell/high/bcell = null var/obj/item/weapon/stock_parts/cell/high/cell = null
var/hitcost = 1000 var/hitcost = 1000
var/throw_hit_chance = 35 var/throw_hit_chance = 35
@@ -32,15 +32,15 @@
baton_stun(hit_atom) baton_stun(hit_atom)
/obj/item/weapon/melee/baton/loaded/Initialize() //this one starts with a cell pre-installed. /obj/item/weapon/melee/baton/loaded/Initialize() //this one starts with a cell pre-installed.
bcell = new(src) cell = new(src)
. = ..() . = ..()
/obj/item/weapon/melee/baton/proc/deductcharge(chrgdeductamt) /obj/item/weapon/melee/baton/proc/deductcharge(chrgdeductamt)
if(bcell) if(cell)
//Note this value returned is significant, as it will determine //Note this value returned is significant, as it will determine
//if a stun is applied or not //if a stun is applied or not
. = bcell.use(chrgdeductamt) . = cell.use(chrgdeductamt)
if(status && bcell.charge < hitcost) if(status && cell.charge < hitcost)
//we're below minimum, turn off //we're below minimum, turn off
status = 0 status = 0
update_icon() update_icon()
@@ -50,22 +50,22 @@
/obj/item/weapon/melee/baton/update_icon() /obj/item/weapon/melee/baton/update_icon()
if(status) if(status)
icon_state = "[initial(name)]_active" icon_state = "[initial(name)]_active"
else if(!bcell) else if(!cell)
icon_state = "[initial(name)]_nocell" icon_state = "[initial(name)]_nocell"
else else
icon_state = "[initial(name)]" icon_state = "[initial(name)]"
/obj/item/weapon/melee/baton/examine(mob/user) /obj/item/weapon/melee/baton/examine(mob/user)
..() ..()
if(bcell) if(cell)
to_chat(user, "<span class='notice'>The baton is [round(bcell.percent())]% charged.</span>") to_chat(user, "<span class='notice'>The baton is [round(cell.percent())]% charged.</span>")
else else
to_chat(user, "<span class='warning'>The baton does not have a power source installed.</span>") to_chat(user, "<span class='warning'>The baton does not have a power source installed.</span>")
/obj/item/weapon/melee/baton/attackby(obj/item/weapon/W, mob/user, params) /obj/item/weapon/melee/baton/attackby(obj/item/weapon/W, mob/user, params)
if(istype(W, /obj/item/weapon/stock_parts/cell)) if(istype(W, /obj/item/weapon/stock_parts/cell))
var/obj/item/weapon/stock_parts/cell/C = W var/obj/item/weapon/stock_parts/cell/C = W
if(bcell) if(cell)
to_chat(user, "<span class='notice'>[src] already has a cell.</span>") to_chat(user, "<span class='notice'>[src] already has a cell.</span>")
else else
if(C.maxcharge < hitcost) if(C.maxcharge < hitcost)
@@ -73,15 +73,15 @@
return return
if(!user.transferItemToLoc(W, src)) if(!user.transferItemToLoc(W, src))
return return
bcell = W cell = W
to_chat(user, "<span class='notice'>You install a cell in [src].</span>") to_chat(user, "<span class='notice'>You install a cell in [src].</span>")
update_icon() update_icon()
else if(istype(W, /obj/item/weapon/screwdriver)) else if(istype(W, /obj/item/weapon/screwdriver))
if(bcell) if(cell)
bcell.updateicon() cell.update_icon()
bcell.loc = get_turf(src.loc) cell.forceMove(get_turf(src))
bcell = null cell = null
to_chat(user, "<span class='notice'>You remove the cell from [src].</span>") to_chat(user, "<span class='notice'>You remove the cell from [src].</span>")
status = 0 status = 0
update_icon() update_icon()
@@ -89,13 +89,13 @@
return ..() return ..()
/obj/item/weapon/melee/baton/attack_self(mob/user) /obj/item/weapon/melee/baton/attack_self(mob/user)
if(bcell && bcell.charge > hitcost) if(cell && cell.charge > hitcost)
status = !status status = !status
to_chat(user, "<span class='notice'>[src] is now [status ? "on" : "off"].</span>") to_chat(user, "<span class='notice'>[src] is now [status ? "on" : "off"].</span>")
playsound(loc, "sparks", 75, 1, -1) playsound(loc, "sparks", 75, 1, -1)
else else
status = 0 status = 0
if(!bcell) if(!cell)
to_chat(user, "<span class='warning'>[src] does not have a power source!</span>") to_chat(user, "<span class='warning'>[src] does not have a power source!</span>")
else else
to_chat(user, "<span class='warning'>[src] is out of charge.</span>") to_chat(user, "<span class='warning'>[src] is out of charge.</span>")

View File

@@ -28,7 +28,7 @@
/obj/item/weapon/melee/baton/cattleprod/attackby(obj/item/I, mob/user, params)//handles sticking a crystal onto a stunprod to make a teleprod /obj/item/weapon/melee/baton/cattleprod/attackby(obj/item/I, mob/user, params)//handles sticking a crystal onto a stunprod to make a teleprod
if(istype(I, /obj/item/weapon/ore/bluespace_crystal)) if(istype(I, /obj/item/weapon/ore/bluespace_crystal))
if(!bcell) if(!cell)
var/obj/item/weapon/melee/baton/cattleprod/teleprod/S = new /obj/item/weapon/melee/baton/cattleprod/teleprod var/obj/item/weapon/melee/baton/cattleprod/teleprod/S = new /obj/item/weapon/melee/baton/cattleprod/teleprod
remove_item_from_storage(user) remove_item_from_storage(user)
qdel(src) qdel(src)

View File

@@ -26,6 +26,7 @@
new /obj/item/clothing/glasses/meson/engine(src) new /obj/item/clothing/glasses/meson/engine(src)
new /obj/item/weapon/door_remote/chief_engineer(src) new /obj/item/weapon/door_remote/chief_engineer(src)
new /obj/item/weapon/pipe_dispenser(src) new /obj/item/weapon/pipe_dispenser(src)
new /obj/item/weapon/inducer(src)
/obj/structure/closet/secure_closet/engineering_electrical /obj/structure/closet/secure_closet/engineering_electrical
name = "electrical supplies locker" name = "electrical supplies locker"
@@ -37,6 +38,8 @@
..() ..()
new /obj/item/clothing/gloves/color/yellow(src) new /obj/item/clothing/gloves/color/yellow(src)
new /obj/item/clothing/gloves/color/yellow(src) new /obj/item/clothing/gloves/color/yellow(src)
new /obj/item/weapon/inducer(src)
new /obj/item/weapon/inducer(src)
for(var/i in 1 to 3) for(var/i in 1 to 3)
new /obj/item/weapon/storage/toolbox/electrical(src) new /obj/item/weapon/storage/toolbox/electrical(src)
for(var/i in 1 to 3) for(var/i in 1 to 3)

View File

@@ -480,8 +480,8 @@
if(istype(O, /obj/item/weapon/melee/baton)) if(istype(O, /obj/item/weapon/melee/baton))
var/obj/item/weapon/melee/baton/B = O var/obj/item/weapon/melee/baton/B = O
if(B.bcell) if(B.cell)
if(B.bcell.charge > 0 && B.status == 1) if(B.cell.charge > 0 && B.status == 1)
flick("baton_active", src) flick("baton_active", src)
var/stunforce = B.stunforce var/stunforce = B.stunforce
user.Stun(stunforce) user.Stun(stunforce)

View File

@@ -14,11 +14,12 @@
if(type == INDIVIDUAL_SHOW_ALL_LOG) if(type == INDIVIDUAL_SHOW_ALL_LOG)
dat += "<center>Displaying all logs of [key_name(M)]</center><br><hr>" dat += "<center>Displaying all logs of [key_name(M)]</center><br><hr>"
for(var/log_type in M.logging) for(var/log_type in M.logging)
var/list/reversed = M.logging[log_type]
reversed = reverseRange(reversed.Copy())
dat += "<center><b>[log_type]</b></center><br>" dat += "<center><b>[log_type]</b></center><br>"
for(var/entry in reversed) var/list/reversed = M.logging[log_type]
dat += "<font size=2px>[entry]: [reversed[entry]]</font><br>" if(islist(reversed))
reversed = reverseRange(reversed.Copy())
for(var/entry in reversed)
dat += "<font size=2px>[entry]: [reversed[entry]]</font><br>"
dat += "<hr>" dat += "<hr>"
else else
dat += "<center>[type] of [key_name(M)]</center><br>" dat += "<center>[type] of [key_name(M)]</center><br>"
@@ -26,6 +27,6 @@
if(reversed) if(reversed)
reversed = reverseRange(reversed.Copy()) reversed = reverseRange(reversed.Copy())
for(var/entry in reversed) for(var/entry in reversed)
dat += "<font size=2px>[entry]: [reversed[entry]]</font><br>" dat += "<font size=2px>[entry]: [reversed[entry]]</font><hr>"
usr << browse(dat, "window=invidual_logging;size=600x480") usr << browse(dat, "window=invidual_logging_[M];size=600x480")

View File

@@ -13,6 +13,14 @@
icon_state = "filter_off_f" icon_state = "filter_off_f"
flipped = 1 flipped = 1
// These two filter types have critical_machine flagged to on and thus causes the area they are in to be exempt from the Grid Check event.
/obj/machinery/atmospherics/components/trinary/filter/critical
critical_machine = TRUE
/obj/machinery/atmospherics/components/trinary/filter/flipped/critical
critical_machine = TRUE
/obj/machinery/atmospherics/components/trinary/filter/proc/set_frequency(new_frequency) /obj/machinery/atmospherics/components/trinary/filter/proc/set_frequency(new_frequency)
SSradio.remove_object(src, frequency) SSradio.remove_object(src, frequency)
frequency = new_frequency frequency = new_frequency

View File

@@ -543,6 +543,13 @@
crate_name = "electrical maintenance crate" crate_name = "electrical maintenance crate"
crate_type = /obj/structure/closet/crate/engineering/electrical crate_type = /obj/structure/closet/crate/engineering/electrical
/datum/supply_pack/engineering/inducers
name = "NT-75 Electromagnetic Power Inducers Crate"
cost = 2000
contains = list(/obj/item/weapon/inducer/sci {cell_type = /obj/item/weapon/stock_parts/cell/{maxcharge = 5000; charge = 5000};opened = 0},/obj/item/weapon/inducer/sci {cell_type = /obj/item/weapon/stock_parts/cell/{maxcharge = 5000; charge = 5000};opened = 0}) //FALSE doesn't work in modified type paths apparently.
crate_name = "inducer crate"
crate_type = /obj/structure/closet/crate/engineering/electrical
/datum/supply_pack/engineering/engiequipment /datum/supply_pack/engineering/engiequipment
name = "Engineering Gear Crate" name = "Engineering Gear Crate"
cost = 1300 cost = 1300

View File

@@ -1540,7 +1540,7 @@
if(stunning && stunCheck.stunned) if(stunning && stunCheck.stunned)
shouldFire = 0 shouldFire = 0
if(shouldFire) if(shouldFire)
if(P.power_supply.charge <= 10) // can shoot seems to bug out for tasers, using this hacky method instead if(P.cell.charge <= 10) // can shoot seems to bug out for tasers, using this hacky method instead
P.update_icon() P.update_icon()
npcDrop(P,1) npcDrop(P,1)
else else

View File

@@ -97,6 +97,9 @@
buckle_lying = FALSE buckle_lying = FALSE
can_ride_typecache = list(/mob/living/carbon/human) can_ride_typecache = list(/mob/living/carbon/human)
/mob/living/silicon/robot/get_cell()
return cell
/mob/living/silicon/robot/Initialize(mapload) /mob/living/silicon/robot/Initialize(mapload)
spark_system = new /datum/effect_system/spark_spread() spark_system = new /datum/effect_system/spark_spread()
spark_system.set_up(5, 0, src) spark_system.set_up(5, 0, src)

View File

@@ -56,7 +56,7 @@
add_fingerprint(user) add_fingerprint(user)
if(opened && !wiresexposed && !issilicon(user)) if(opened && !wiresexposed && !issilicon(user))
if(cell) if(cell)
cell.updateicon() cell.update_icon()
cell.add_fingerprint(user) cell.add_fingerprint(user)
user.put_in_active_hand(cell) user.put_in_active_hand(cell)
to_chat(user, "<span class='notice'>You remove \the [cell].</span>") to_chat(user, "<span class='notice'>You remove \the [cell].</span>")

View File

@@ -149,8 +149,8 @@
F.update_icon() F.update_icon()
else if(istype(I, /obj/item/weapon/melee/baton)) else if(istype(I, /obj/item/weapon/melee/baton))
var/obj/item/weapon/melee/baton/B = I var/obj/item/weapon/melee/baton/B = I
if(B.bcell) if(B.cell)
B.bcell.charge = B.bcell.maxcharge B.cell.charge = B.cell.maxcharge
else if(istype(I, /obj/item/weapon/gun/energy)) else if(istype(I, /obj/item/weapon/gun/energy))
var/obj/item/weapon/gun/energy/EG = I var/obj/item/weapon/gun/energy/EG = I
if(!EG.chambered) if(!EG.chambered)
@@ -395,9 +395,9 @@
..() ..()
var/obj/item/weapon/gun/energy/e_gun/advtaser/cyborg/T = locate(/obj/item/weapon/gun/energy/e_gun/advtaser/cyborg) in basic_modules var/obj/item/weapon/gun/energy/e_gun/advtaser/cyborg/T = locate(/obj/item/weapon/gun/energy/e_gun/advtaser/cyborg) in basic_modules
if(T) if(T)
if(T.power_supply.charge < T.power_supply.maxcharge) if(T.cell.charge < T.cell.maxcharge)
var/obj/item/ammo_casing/energy/S = T.ammo_type[T.select] var/obj/item/ammo_casing/energy/S = T.ammo_type[T.select]
T.power_supply.give(S.e_cost * coeff) T.cell.give(S.e_cost * coeff)
T.update_icon() T.update_icon()
else else
T.charge_tick = 0 T.charge_tick = 0

View File

@@ -364,15 +364,15 @@ Auto Patrol[]"},
if(!lasercolor) if(!lasercolor)
var/obj/item/weapon/gun/energy/e_gun/advtaser/G = new /obj/item/weapon/gun/energy/e_gun/advtaser(Tsec) var/obj/item/weapon/gun/energy/e_gun/advtaser/G = new /obj/item/weapon/gun/energy/e_gun/advtaser(Tsec)
G.power_supply.charge = 0 G.cell.charge = 0
G.update_icon() G.update_icon()
else if(lasercolor == "b") else if(lasercolor == "b")
var/obj/item/weapon/gun/energy/laser/bluetag/G = new /obj/item/weapon/gun/energy/laser/bluetag(Tsec) var/obj/item/weapon/gun/energy/laser/bluetag/G = new /obj/item/weapon/gun/energy/laser/bluetag(Tsec)
G.power_supply.charge = 0 G.cell.charge = 0
G.update_icon() G.update_icon()
else if(lasercolor == "r") else if(lasercolor == "r")
var/obj/item/weapon/gun/energy/laser/redtag/G = new /obj/item/weapon/gun/energy/laser/redtag(Tsec) var/obj/item/weapon/gun/energy/laser/redtag/G = new /obj/item/weapon/gun/energy/laser/redtag(Tsec)
G.power_supply.charge = 0 G.cell.charge = 0
G.update_icon() G.update_icon()
if(prob(50)) if(prob(50))

View File

@@ -229,10 +229,10 @@ GLOBAL_LIST_INIT(protected_objects, list(/obj/structure/table, /obj/structure/ca
/mob/living/simple_animal/hostile/mimic/copy/ranged/OpenFire(the_target) /mob/living/simple_animal/hostile/mimic/copy/ranged/OpenFire(the_target)
if(Zapgun) if(Zapgun)
if(Zapgun.power_supply) if(Zapgun.cell)
var/obj/item/ammo_casing/energy/shot = Zapgun.ammo_type[Zapgun.select] var/obj/item/ammo_casing/energy/shot = Zapgun.ammo_type[Zapgun.select]
if(Zapgun.power_supply.charge >= shot.e_cost) if(Zapgun.cell.charge >= shot.e_cost)
Zapgun.power_supply.use(shot.e_cost) Zapgun.cell.use(shot.e_cost)
Zapgun.update_icon() Zapgun.update_icon()
..() ..()
else if(Zapstick) else if(Zapstick)

View File

@@ -26,6 +26,11 @@
return battery_module.battery.give(amount) return battery_module.battery.give(amount)
return 0 return 0
/obj/item/device/modular_computer/get_cell()
var/obj/item/weapon/computer_hardware/battery/battery_module = all_components[MC_CELL]
if(battery_module && battery_module.battery)
return battery_module.battery
// Used in following function to reduce copypaste // Used in following function to reduce copypaste
/obj/item/device/modular_computer/proc/power_failure() /obj/item/device/modular_computer/proc/power_failure()

View File

@@ -111,7 +111,7 @@ They *could* go in their appropriate files, but this is supposed to be modular
S.cell.charge += charge S.cell.charge += charge
charge = 0 charge = 0
corrupt() corrupt()
updateicon() update_icon()
//RDCONSOLE// //RDCONSOLE//

View File

@@ -56,6 +56,8 @@ Contents:
var/s_bombs = 10//Number of starting ninja smoke bombs. var/s_bombs = 10//Number of starting ninja smoke bombs.
var/a_boost = 3//Number of adrenaline boosters. var/a_boost = 3//Number of adrenaline boosters.
/obj/item/clothing/suit/space/space_ninja/get_cell()
return cell
/obj/item/clothing/suit/space/space_ninja/New() /obj/item/clothing/suit/space/space_ninja/New()
..() ..()

View File

@@ -32,7 +32,7 @@
U.put_in_hands(old_cell) U.put_in_hands(old_cell)
old_cell.add_fingerprint(U) old_cell.add_fingerprint(U)
old_cell.corrupt() old_cell.corrupt()
old_cell.updateicon() old_cell.update_icon()
cell = CELL cell = CELL
to_chat(U, "<span class='notice'>Upgrade complete. Maximum capacity: <b>[round(cell.maxcharge/100)]</b>%</span>") to_chat(U, "<span class='notice'>Upgrade complete. Maximum capacity: <b>[round(cell.maxcharge/100)]</b>%</span>")
else else

View File

@@ -93,6 +93,10 @@
var/update_overlay = -1 var/update_overlay = -1
var/icon_update_needed = FALSE var/icon_update_needed = FALSE
/obj/machinery/power/apc/get_cell()
return cell
/obj/machinery/power/apc/connect_to_network() /obj/machinery/power/apc/connect_to_network()
//Override because the APC does not directly connect to the network; it goes through a terminal. //Override because the APC does not directly connect to the network; it goes through a terminal.
//The terminal is what the power computer looks for anyway. //The terminal is what the power computer looks for anyway.
@@ -622,14 +626,10 @@
return return
if(usr == user && opened && (!issilicon(user))) if(usr == user && opened && (!issilicon(user)))
if(cell) if(cell)
user.visible_message("[user] removes \the [cell] from [src]!","<span class='notice'>You remove \the [cell].</span>")
user.put_in_hands(cell) user.put_in_hands(cell)
cell.add_fingerprint(user) cell.update_icon()
cell.updateicon()
src.cell = null src.cell = null
user.visible_message("[user.name] removes the power cell from [src.name]!",\
"<span class='notice'>You remove the power cell.</span>")
//to_chat(user, "You remove the power cell.")
charging = 0 charging = 0
src.update_icon() src.update_icon()
return return

View File

@@ -19,13 +19,16 @@
var/ratingdesc = TRUE var/ratingdesc = TRUE
var/grown_battery = FALSE // If it's a grown that acts as a battery, add a wire overlay to it. var/grown_battery = FALSE // If it's a grown that acts as a battery, add a wire overlay to it.
/obj/item/weapon/stock_parts/cell/get_cell()
return src
/obj/item/weapon/stock_parts/cell/New() /obj/item/weapon/stock_parts/cell/New()
..() ..()
START_PROCESSING(SSobj, src) START_PROCESSING(SSobj, src)
charge = maxcharge charge = maxcharge
if(ratingdesc) if(ratingdesc)
desc += " This one has a power rating of [maxcharge], and you should not swallow it." desc += " This one has a power rating of [maxcharge], and you should not swallow it."
updateicon() update_icon()
/obj/item/weapon/stock_parts/cell/Destroy() /obj/item/weapon/stock_parts/cell/Destroy()
STOP_PROCESSING(SSobj, src) STOP_PROCESSING(SSobj, src)
@@ -46,7 +49,7 @@
else else
return PROCESS_KILL return PROCESS_KILL
/obj/item/weapon/stock_parts/cell/proc/updateicon() /obj/item/weapon/stock_parts/cell/update_icon()
cut_overlays() cut_overlays()
if(grown_battery) if(grown_battery)
add_overlay("grown_wires") add_overlay("grown_wires")

View File

@@ -4,7 +4,7 @@
desc = "A basic energy-based gun." desc = "A basic energy-based gun."
icon = 'icons/obj/guns/energy.dmi' icon = 'icons/obj/guns/energy.dmi'
var/obj/item/weapon/stock_parts/cell/power_supply //What type of power cell this uses var/obj/item/weapon/stock_parts/cell/cell //What type of power cell this uses
var/cell_type = /obj/item/weapon/stock_parts/cell var/cell_type = /obj/item/weapon/stock_parts/cell
var/modifystate = 0 var/modifystate = 0
var/list/ammo_type = list(/obj/item/ammo_casing/energy) var/list/ammo_type = list(/obj/item/ammo_casing/energy)
@@ -20,19 +20,22 @@
var/use_cyborg_cell = 0 //whether the gun's cell drains the cyborg user's cell to recharge var/use_cyborg_cell = 0 //whether the gun's cell drains the cyborg user's cell to recharge
/obj/item/weapon/gun/energy/emp_act(severity) /obj/item/weapon/gun/energy/emp_act(severity)
power_supply.use(round(power_supply.charge / severity)) cell.use(round(cell.charge / severity))
chambered = null //we empty the chamber chambered = null //we empty the chamber
recharge_newshot() //and try to charge a new shot recharge_newshot() //and try to charge a new shot
update_icon() update_icon()
/obj/item/weapon/gun/energy/get_cell()
return cell
/obj/item/weapon/gun/energy/Initialize() /obj/item/weapon/gun/energy/Initialize()
. = ..() . = ..()
if(cell_type) if(cell_type)
power_supply = new cell_type(src) cell = new cell_type(src)
else else
power_supply = new(src) cell = new(src)
power_supply.give(power_supply.maxcharge) cell.give(cell.maxcharge)
update_ammo_types() update_ammo_types()
recharge_newshot(1) recharge_newshot(1)
if(selfcharge) if(selfcharge)
@@ -50,9 +53,7 @@
fire_delay = shot.delay fire_delay = shot.delay
/obj/item/weapon/gun/energy/Destroy() /obj/item/weapon/gun/energy/Destroy()
if(power_supply) QDEL_NULL(cell)
qdel(power_supply)
power_supply = null
STOP_PROCESSING(SSobj, src) STOP_PROCESSING(SSobj, src)
return ..() return ..()
@@ -62,9 +63,9 @@
if(charge_tick < charge_delay) if(charge_tick < charge_delay)
return return
charge_tick = 0 charge_tick = 0
if(!power_supply) if(!cell)
return return
power_supply.give(100) cell.give(100)
if(!chambered) //if empty chamber we try to charge a new shot if(!chambered) //if empty chamber we try to charge a new shot
recharge_newshot(1) recharge_newshot(1)
update_icon() update_icon()
@@ -76,10 +77,10 @@
/obj/item/weapon/gun/energy/can_shoot() /obj/item/weapon/gun/energy/can_shoot()
var/obj/item/ammo_casing/energy/shot = ammo_type[select] var/obj/item/ammo_casing/energy/shot = ammo_type[select]
return power_supply.charge >= shot.e_cost return cell.charge >= shot.e_cost
/obj/item/weapon/gun/energy/recharge_newshot(no_cyborg_drain) /obj/item/weapon/gun/energy/recharge_newshot(no_cyborg_drain)
if (!ammo_type || !power_supply) if (!ammo_type || !cell)
return return
if(use_cyborg_cell && !no_cyborg_drain) if(use_cyborg_cell && !no_cyborg_drain)
if(iscyborg(loc)) if(iscyborg(loc))
@@ -87,10 +88,10 @@
if(R.cell) if(R.cell)
var/obj/item/ammo_casing/energy/shot = ammo_type[select] //Necessary to find cost of shot var/obj/item/ammo_casing/energy/shot = ammo_type[select] //Necessary to find cost of shot
if(R.cell.use(shot.e_cost)) //Take power from the borg... if(R.cell.use(shot.e_cost)) //Take power from the borg...
power_supply.give(shot.e_cost) //... to recharge the shot cell.give(shot.e_cost) //... to recharge the shot
if(!chambered) if(!chambered)
var/obj/item/ammo_casing/energy/AC = ammo_type[select] var/obj/item/ammo_casing/energy/AC = ammo_type[select]
if(power_supply.charge >= AC.e_cost) //if there's enough power in the power_supply cell... if(cell.charge >= AC.e_cost) //if there's enough power in the cell cell...
chambered = AC //...prepare a new shot based on the current ammo type selected chambered = AC //...prepare a new shot based on the current ammo type selected
if(!chambered.BB) if(!chambered.BB)
chambered.newshot() chambered.newshot()
@@ -98,7 +99,7 @@
/obj/item/weapon/gun/energy/process_chamber() /obj/item/weapon/gun/energy/process_chamber()
if(chambered && !chambered.BB) //if BB is null, i.e the shot has been fired... if(chambered && !chambered.BB) //if BB is null, i.e the shot has been fired...
var/obj/item/ammo_casing/energy/shot = chambered var/obj/item/ammo_casing/energy/shot = chambered
power_supply.use(shot.e_cost)//... drain the power_supply cell cell.use(shot.e_cost)//... drain the cell cell
chambered = null //either way, released the prepared shot chambered = null //either way, released the prepared shot
recharge_newshot() //try to charge a new shot recharge_newshot() //try to charge a new shot
@@ -120,7 +121,7 @@
..() ..()
if(!automatic_charge_overlays) if(!automatic_charge_overlays)
return return
var/ratio = Ceiling((power_supply.charge / power_supply.maxcharge) * charge_sections) var/ratio = Ceiling((cell.charge / cell.maxcharge) * charge_sections)
var/obj/item/ammo_casing/energy/shot = ammo_type[select] var/obj/item/ammo_casing/energy/shot = ammo_type[select]
var/iconState = "[icon_state]_charge" var/iconState = "[icon_state]_charge"
var/itemState = null var/itemState = null
@@ -131,7 +132,7 @@
iconState += "_[shot.select_name]" iconState += "_[shot.select_name]"
if(itemState) if(itemState)
itemState += "[shot.select_name]" itemState += "[shot.select_name]"
if(power_supply.charge < shot.e_cost) if(cell.charge < shot.e_cost)
add_overlay("[icon_state]_empty") add_overlay("[icon_state]_empty")
else else
if(!shaded_charge) if(!shaded_charge)
@@ -156,7 +157,7 @@
user.visible_message("<span class='suicide'>[user] melts [user.p_their()] face off with [src]!</span>") user.visible_message("<span class='suicide'>[user] melts [user.p_their()] face off with [src]!</span>")
playsound(loc, fire_sound, 50, 1, -1) playsound(loc, fire_sound, 50, 1, -1)
var/obj/item/ammo_casing/energy/shot = ammo_type[select] var/obj/item/ammo_casing/energy/shot = ammo_type[select]
power_supply.use(shot.e_cost) cell.use(shot.e_cost)
update_icon() update_icon()
return(FIRELOSS) return(FIRELOSS)
else else
@@ -191,17 +192,17 @@
user.visible_message("<span class='danger'>[user] tries to light their [A.name] with [src], but it doesn't do anything. Dumbass.</span>") user.visible_message("<span class='danger'>[user] tries to light their [A.name] with [src], but it doesn't do anything. Dumbass.</span>")
playsound(user, E.fire_sound, 50, 1) playsound(user, E.fire_sound, 50, 1)
playsound(user, BB.hitsound, 50, 1) playsound(user, BB.hitsound, 50, 1)
power_supply.use(E.e_cost) cell.use(E.e_cost)
. = "" . = ""
else if(BB.damage_type != BURN) else if(BB.damage_type != BURN)
user.visible_message("<span class='danger'>[user] tries to light their [A.name] with [src], but only succeeds in utterly destroying it. Dumbass.</span>") user.visible_message("<span class='danger'>[user] tries to light their [A.name] with [src], but only succeeds in utterly destroying it. Dumbass.</span>")
playsound(user, E.fire_sound, 50, 1) playsound(user, E.fire_sound, 50, 1)
playsound(user, BB.hitsound, 50, 1) playsound(user, BB.hitsound, 50, 1)
power_supply.use(E.e_cost) cell.use(E.e_cost)
qdel(A) qdel(A)
. = "" . = ""
else else
playsound(user, E.fire_sound, 50, 1) playsound(user, E.fire_sound, 50, 1)
playsound(user, BB.hitsound, 50, 1) playsound(user, BB.hitsound, 50, 1)
power_supply.use(E.e_cost) cell.use(E.e_cost)
. = "<span class='danger'>[user] casually lights their [A.name] with [src]. Damn.</span>" . = "<span class='danger'>[user] casually lights their [A.name] with [src]. Damn.</span>"

View File

@@ -98,7 +98,7 @@
empty() empty()
/obj/item/weapon/gun/energy/kinetic_accelerator/proc/empty() /obj/item/weapon/gun/energy/kinetic_accelerator/proc/empty()
power_supply.use(500) cell.use(500)
update_icon() update_icon()
/obj/item/weapon/gun/energy/kinetic_accelerator/proc/attempt_reload(recharge_time) /obj/item/weapon/gun/energy/kinetic_accelerator/proc/attempt_reload(recharge_time)
@@ -125,7 +125,7 @@
return return
/obj/item/weapon/gun/energy/kinetic_accelerator/proc/reload() /obj/item/weapon/gun/energy/kinetic_accelerator/proc/reload()
power_supply.give(500) cell.give(500)
recharge_newshot(1) recharge_newshot(1)
if(!suppressed) if(!suppressed)
playsound(src.loc, 'sound/weapons/kenetic_reload.ogg', 60, 1) playsound(src.loc, 'sound/weapons/kenetic_reload.ogg', 60, 1)

View File

@@ -39,7 +39,7 @@
/obj/item/weapon/gun/energy/decloner/update_icon() /obj/item/weapon/gun/energy/decloner/update_icon()
..() ..()
var/obj/item/ammo_casing/energy/shot = ammo_type[select] var/obj/item/ammo_casing/energy/shot = ammo_type[select]
if(power_supply.charge > shot.e_cost) if(cell.charge > shot.e_cost)
add_overlay("decloner_spin") add_overlay("decloner_spin")
/obj/item/weapon/gun/energy/floragun /obj/item/weapon/gun/energy/floragun
@@ -137,19 +137,19 @@
/obj/item/weapon/gun/energy/plasmacutter/examine(mob/user) /obj/item/weapon/gun/energy/plasmacutter/examine(mob/user)
..() ..()
if(power_supply) if(cell)
to_chat(user, "<span class='notice'>[src] is [round(power_supply.percent())]% charged.</span>") to_chat(user, "<span class='notice'>[src] is [round(cell.percent())]% charged.</span>")
/obj/item/weapon/gun/energy/plasmacutter/attackby(obj/item/A, mob/user) /obj/item/weapon/gun/energy/plasmacutter/attackby(obj/item/A, mob/user)
if(istype(A, /obj/item/stack/sheet/mineral/plasma)) if(istype(A, /obj/item/stack/sheet/mineral/plasma))
var/obj/item/stack/sheet/S = A var/obj/item/stack/sheet/S = A
S.use(1) S.use(1)
power_supply.give(1000) cell.give(1000)
recharge_newshot(1) recharge_newshot(1)
to_chat(user, "<span class='notice'>You insert [A] in [src], recharging it.</span>") to_chat(user, "<span class='notice'>You insert [A] in [src], recharging it.</span>")
else if(istype(A, /obj/item/weapon/ore/plasma)) else if(istype(A, /obj/item/weapon/ore/plasma))
qdel(A) qdel(A)
power_supply.give(500) cell.give(500)
recharge_newshot(1) recharge_newshot(1)
to_chat(user, "<span class='notice'>You insert [A] in [src], recharging it.</span>") to_chat(user, "<span class='notice'>You insert [A] in [src], recharging it.</span>")
else else

View File

@@ -78,7 +78,7 @@
return "chest" return "chest"
/obj/item/projectile/proc/prehit(atom/target) /obj/item/projectile/proc/prehit(atom/target)
return return TRUE
/obj/item/projectile/proc/on_hit(atom/target, blocked = 0) /obj/item/projectile/proc/on_hit(atom/target, blocked = 0)
var/turf/target_loca = get_turf(target) var/turf/target_loca = get_turf(target)
@@ -142,7 +142,7 @@
if(firer && !ricochets) if(firer && !ricochets)
if(A == firer || (A == firer.loc && istype(A, /obj/mecha))) //cannot shoot yourself or your mech if(A == firer || (A == firer.loc && istype(A, /obj/mecha))) //cannot shoot yourself or your mech
loc = A.loc loc = A.loc
return 0 return FALSE
var/distance = get_dist(get_turf(A), starting) // Get the distance between the turf shot from and the mob we hit and use that for the calculations. var/distance = get_dist(get_turf(A), starting) // Get the distance between the turf shot from and the mob we hit and use that for the calculations.
def_zone = ran_zone(def_zone, max(100-(7*distance), 5)) //Lower accurancy/longer range tradeoff. 7 is a balanced number to use. def_zone = ran_zone(def_zone, max(100-(7*distance), 5)) //Lower accurancy/longer range tradeoff. 7 is a balanced number to use.
@@ -155,13 +155,14 @@
var/turf/target_turf = get_turf(A) var/turf/target_turf = get_turf(A)
prehit(A) if(!prehit(A))
return FALSE
var/permutation = A.bullet_act(src, def_zone) // searches for return value, could be deleted after run so check A isn't null var/permutation = A.bullet_act(src, def_zone) // searches for return value, could be deleted after run so check A isn't null
if(permutation == -1 || forcedodge)// the bullet passes through a dense object! if(permutation == -1 || forcedodge)// the bullet passes through a dense object!
loc = target_turf loc = target_turf
if(A) if(A)
permutated.Add(A) permutated.Add(A)
return 0 return FALSE
else else
if(A && A.density && !ismob(A) && !(A.flags & ON_BORDER)) //if we hit a dense non-border obj or dense turf then we also hit one of the mobs on that tile. if(A && A.density && !ismob(A) && !(A.flags & ON_BORDER)) //if we hit a dense non-border obj or dense turf then we also hit one of the mobs on that tile.
var/list/mobs_list = list() var/list/mobs_list = list()
@@ -169,9 +170,11 @@
mobs_list += L mobs_list += L
if(mobs_list.len) if(mobs_list.len)
var/mob/living/picked_mob = pick(mobs_list) var/mob/living/picked_mob = pick(mobs_list)
prehit(picked_mob) if(!prehit(picked_mob))
return FALSE
picked_mob.bullet_act(src, def_zone) picked_mob.bullet_act(src, def_zone)
qdel(src) qdel(src)
return TRUE
/obj/item/projectile/proc/check_ricochet() /obj/item/projectile/proc/check_ricochet()
if(prob(ricochet_chance)) if(prob(ricochet_chance))
@@ -277,46 +280,53 @@
Range() Range()
sleep(config.run_speed * 0.9) sleep(config.run_speed * 0.9)
/obj/item/projectile/proc/preparePixelProjectile(atom/target, var/turf/targloc, mob/living/user, params, spread) /obj/item/projectile/proc/preparePixelProjectile(atom/target, var/turf/targloc, mob/living/user, params, spread)
var/turf/curloc = get_turf(user) var/turf/curloc = get_turf(user)
src.loc = get_turf(user) forceMove(get_turf(user))
src.starting = get_turf(user) starting = get_turf(user)
src.current = curloc current = curloc
src.yo = targloc.y - curloc.y yo = targloc.y - curloc.y
src.xo = targloc.x - curloc.x xo = targloc.x - curloc.x
if(params) var/list/calculated = calculate_projectile_angle_and_pixel_offsets(user, params)
var/list/mouse_control = params2list(params) Angle = calculated[1]
if(mouse_control["icon-x"]) p_x = calculated[2]
src.p_x = text2num(mouse_control["icon-x"]) p_y = calculated[3]
if(mouse_control["icon-y"])
src.p_y = text2num(mouse_control["icon-y"])
if(mouse_control["screen-loc"])
//Split screen-loc up into X+Pixel_X and Y+Pixel_Y
var/list/screen_loc_params = splittext(mouse_control["screen-loc"], ",")
//Split X+Pixel_X up into list(X, Pixel_X)
var/list/screen_loc_X = splittext(screen_loc_params[1],":")
//Split Y+Pixel_Y up into list(Y, Pixel_Y)
var/list/screen_loc_Y = splittext(screen_loc_params[2],":")
// to_chat(world, "X: [screen_loc_X[1]] PixelX: [screen_loc_X[2]] / Y: [screen_loc_Y[1]] PixelY: [screen_loc_Y[2]]")
var/x = text2num(screen_loc_X[1]) * 32 + text2num(screen_loc_X[2]) - 32
var/y = text2num(screen_loc_Y[1]) * 32 + text2num(screen_loc_Y[2]) - 32
//Calculate the "resolution" of screen based on client's view and world's icon size. This will work if the user can view more tiles than average.
var/screenview = (user.client.view * 2 + 1) * world.icon_size //Refer to http://www.byond.com/docs/ref/info.html#/client/var/view for mad maths
var/ox = round(screenview/2) //"origin" x
var/oy = round(screenview/2) //"origin" y
// to_chat(world, "Pixel position: [x] [y]")
var/angle = Atan2(y - oy, x - ox)
// to_chat(world, "Angle: [angle]")
src.Angle = angle
if(spread) if(spread)
src.Angle += spread src.Angle += spread
/proc/calculate_projectile_angle_and_pixel_offsets(mob/user, params)
var/list/mouse_control = params2list(params)
var/p_x = 0
var/p_y = 0
var/angle = 0
if(mouse_control["icon-x"])
p_x = text2num(mouse_control["icon-x"])
if(mouse_control["icon-y"])
p_y = text2num(mouse_control["icon-y"])
if(mouse_control["screen-loc"])
//Split screen-loc up into X+Pixel_X and Y+Pixel_Y
var/list/screen_loc_params = splittext(mouse_control["screen-loc"], ",")
//Split X+Pixel_X up into list(X, Pixel_X)
var/list/screen_loc_X = splittext(screen_loc_params[1],":")
//Split Y+Pixel_Y up into list(Y, Pixel_Y)
var/list/screen_loc_Y = splittext(screen_loc_params[2],":")
// to_chat(world, "X: [screen_loc_X[1]] PixelX: [screen_loc_X[2]] / Y: [screen_loc_Y[1]] PixelY: [screen_loc_Y[2]]")
var/x = text2num(screen_loc_X[1]) * 32 + text2num(screen_loc_X[2]) - 32
var/y = text2num(screen_loc_Y[1]) * 32 + text2num(screen_loc_Y[2]) - 32
//Calculate the "resolution" of screen based on client's view and world's icon size. This will work if the user can view more tiles than average.
var/screenview = (user.client.view * 2 + 1) * world.icon_size //Refer to http://www.byond.com/docs/ref/info.html#/client/var/view for mad maths
var/ox = round(screenview/2) - user.client.pixel_x //"origin" x
var/oy = round(screenview/2) - user.client.pixel_y //"origin" y
// to_chat(world, "Pixel position: [x] [y]")
angle = Atan2(y - oy, x - ox)
// to_chat(world, "Angle: [angle]")
return list(angle, p_x, p_y)
/obj/item/projectile/Crossed(atom/movable/AM) //A mob moving on a tile with a projectile is hit by it. /obj/item/projectile/Crossed(atom/movable/AM) //A mob moving on a tile with a projectile is hit by it.
..() ..()

View File

@@ -68,6 +68,17 @@
build_path = /obj/item/device/lightreplacer build_path = /obj/item/device/lightreplacer
category = list("Power Designs") category = list("Power Designs")
/datum/design/inducer
name = "Inducer"
desc = "The NT-75 Electromagnetic Power Inducer can wirelessly induce electric charge in an object, allowing you to recharge power cells without having to remove them."
id = "inducer"
req_tech = list("powerstorage" = 4, "engineering" = 4, "magnets" = 4)
build_type = PROTOLATHE
materials = list(MAT_METAL = 3000, MAT_GLASS = 1000)
build_path = /obj/item/weapon/inducer/sci
category = list("Power Designs")
/datum/design/board/pacman /datum/design/board/pacman
name = "Machine Design (PACMAN-type Generator Board)" name = "Machine Design (PACMAN-type Generator Board)"
desc = "The circuit board that for a PACMAN-type portable generator." desc = "The circuit board that for a PACMAN-type portable generator."

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 KiB

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 KiB

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -831,6 +831,7 @@
#include "code\game\objects\items\weapons\his_grace.dm" #include "code\game\objects\items\weapons\his_grace.dm"
#include "code\game\objects\items\weapons\holosign_creator.dm" #include "code\game\objects\items\weapons\holosign_creator.dm"
#include "code\game\objects\items\weapons\holy_weapons.dm" #include "code\game\objects\items\weapons\holy_weapons.dm"
#include "code\game\objects\items\weapons\inducer.dm"
#include "code\game\objects\items\weapons\kitchen.dm" #include "code\game\objects\items\weapons\kitchen.dm"
#include "code\game\objects\items\weapons\manuals.dm" #include "code\game\objects\items\weapons\manuals.dm"
#include "code\game\objects\items\weapons\miscellaneous.dm" #include "code\game\objects\items\weapons\miscellaneous.dm"
@@ -932,6 +933,7 @@
#include "code\game\objects\structures\ladders.dm" #include "code\game\objects\structures\ladders.dm"
#include "code\game\objects\structures\lattice.dm" #include "code\game\objects\structures\lattice.dm"
#include "code\game\objects\structures\life_candle.dm" #include "code\game\objects\structures\life_candle.dm"
#include "code\game\objects\structures\manned_turret.dm"
#include "code\game\objects\structures\memorial.dm" #include "code\game\objects\structures\memorial.dm"
#include "code\game\objects\structures\mineral_doors.dm" #include "code\game\objects\structures\mineral_doors.dm"
#include "code\game\objects\structures\mirror.dm" #include "code\game\objects\structures\mirror.dm"