Merge pull request #1534 from Citadel-Station-13/SelectiveMirrorSync

Selective mirror sync
This commit is contained in:
LetterJay
2017-06-14 06:41:01 -05:00
committed by GitHub
104 changed files with 2272 additions and 1039 deletions
+25 -22
View File
@@ -19,7 +19,7 @@
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/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/grab_ghost = FALSE // Do we pull the ghost back into their body?
@@ -29,10 +29,13 @@
update_icon()
return
/obj/item/weapon/defibrillator/get_cell()
return cell
/obj/item/weapon/defibrillator/loaded/Initialize() //starts with hicap
. = ..()
paddles = make_paddles()
bcell = new(src)
cell = new(src)
update_icon()
return
@@ -42,8 +45,8 @@
update_charge()
/obj/item/weapon/defibrillator/proc/update_power()
if(bcell)
if(bcell.charge < paddles.revivecost)
if(cell)
if(cell.charge < paddles.revivecost)
powered = 0
else
powered = 1
@@ -56,21 +59,21 @@
add_overlay("[initial(icon_state)]-paddles")
if(powered)
add_overlay("[initial(icon_state)]-powered")
if(!bcell)
if(!cell)
add_overlay("[initial(icon_state)]-nocell")
if(!safety)
add_overlay("[initial(icon_state)]-emagged")
/obj/item/weapon/defibrillator/proc/update_charge()
if(powered) //so it doesn't show charge if it's unpowered
if(bcell)
var/ratio = bcell.charge / bcell.maxcharge
if(cell)
var/ratio = cell.charge / cell.maxcharge
ratio = Ceiling(ratio*4) * 25
add_overlay("[initial(icon_state)]-charge[ratio]")
/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()
/obj/item/weapon/defibrillator/ui_action_click()
@@ -105,7 +108,7 @@
toggle_paddles()
else if(istype(W, /obj/item/weapon/stock_parts/cell))
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>")
else
if(C.maxcharge < paddles.revivecost)
@@ -113,15 +116,15 @@
return
if(!user.transferItemToLoc(W, src))
return
bcell = W
cell = W
to_chat(user, "<span class='notice'>You install a cell in [src].</span>")
update_icon()
else if(istype(W, /obj/item/weapon/screwdriver))
if(bcell)
bcell.updateicon()
bcell.loc = get_turf(src.loc)
bcell = null
if(cell)
cell.update_icon()
cell.loc = get_turf(src.loc)
cell = null
to_chat(user, "<span class='notice'>You remove the cell from [src].</span>")
update_icon()
else
@@ -136,7 +139,7 @@
to_chat(user, "<span class='notice'>You silently enable [src]'s safety protocols with the cryptographic sequencer.")
/obj/item/weapon/defibrillator/emp_act(severity)
if(bcell)
if(cell)
deductcharge(1000 / severity)
if(safety)
safety = 0
@@ -200,11 +203,11 @@
update_icon()
/obj/item/weapon/defibrillator/proc/deductcharge(chrgdeductamt)
if(bcell)
if(bcell.charge < (paddles.revivecost+chrgdeductamt))
if(cell)
if(cell.charge < (paddles.revivecost+chrgdeductamt))
powered = 0
update_icon()
if(bcell.use(chrgdeductamt))
if(cell.use(chrgdeductamt))
update_icon()
return 1
else
@@ -213,8 +216,8 @@
/obj/item/weapon/defibrillator/proc/cooldowncheck(mob/user)
spawn(50)
if(bcell)
if(bcell.charge >= paddles.revivecost)
if(cell)
if(cell.charge >= paddles.revivecost)
user.visible_message("<span class='notice'>[src] beeps: Unit ready.</span>")
playsound(get_turf(src), 'sound/machines/defib_ready.ogg', 50, 0)
else
@@ -240,7 +243,7 @@
/obj/item/weapon/defibrillator/compact/loaded/Initialize()
. = ..()
paddles = make_paddles()
bcell = new(src)
cell = new(src)
update_icon()
/obj/item/weapon/defibrillator/compact/combat
@@ -252,7 +255,7 @@
/obj/item/weapon/defibrillator/compact/combat/loaded/Initialize()
. = ..()
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()
/obj/item/weapon/defibrillator/compact/combat/loaded/attackby(obj/item/weapon/W, mob/user, params)
+183
View File
@@ -0,0 +1,183 @@
/obj/item/weapon/inducer
name = "inducer"
desc = "A tool for inductively charging internal power cells."
icon = 'icons/obj/tools.dmi'
icon_state = "inducer-engi"
item_state = "inducer-engi"
origin_tech = "engineering=4;magnets=4;powerstorage=4"
force = 7
var/powertransfer = 1000
var/opened = FALSE
var/cell_type = /obj/item/weapon/stock_parts/cell/high
var/obj/item/weapon/stock_parts/cell/cell
var/recharging = FALSE
/obj/item/weapon/inducer/Initialize()
. = ..()
if(!cell && cell_type)
cell = new cell_type
/obj/item/weapon/inducer/proc/induce(obj/item/weapon/stock_parts/cell/target, coefficient)
var/totransfer = min(cell.charge,(powertransfer * coefficient))
var/transferred = target.give(totransfer)
cell.use(transferred)
cell.update_icon()
target.update_icon()
/obj/item/weapon/inducer/get_cell()
return cell
/obj/item/weapon/inducer/emp_act(severity)
..()
if(cell)
cell.emp_act()
/obj/item/weapon/inducer/attack_obj(obj/O, mob/living/carbon/user)
if(user.a_intent == INTENT_HARM)
return ..()
if(cantbeused(user))
return
if(recharge(O, user))
return
return ..()
/obj/item/weapon/inducer/proc/cantbeused(mob/user)
if(!user.IsAdvancedToolUser())
to_chat(user, "<span class='warning'>You don't have the dexterity to use \the [src]!</span>")
return TRUE
if(!cell)
to_chat(user, "<span class='warning'>\The [src] doesn't have a power cell installed!</span>")
return TRUE
if(!cell.charge)
to_chat(user, "<span class='warning'>\The [src]'s battery is dead!</span>")
return TRUE
return FALSE
/obj/item/weapon/inducer/attackby(obj/item/weapon/W, mob/user)
if(istype(W,/obj/item/weapon/screwdriver))
playsound(src, W.usesound, 50, 1)
if(!opened)
to_chat(user, "<span class='notice'>You unscrew the battery compartment.</span>")
opened = TRUE
update_icon()
return
else
to_chat(user, "<span class='notice'>You close the battery compartment.</span>")
opened = FALSE
update_icon()
return
if(istype(W,/obj/item/weapon/stock_parts/cell))
if(opened)
if(!cell)
if(!user.transferItemToLoc(W, src))
return
to_chat(user, "<span class='notice'>You insert \the [W] into \the [src].</span>")
cell = W
update_icon()
return
else
to_chat(user, "<span class='notice'>\The [src] already has \a [cell] installed!</span>")
return
if(cantbeused(user))
return
if(recharge(W, user))
return
return ..()
/obj/item/weapon/inducer/proc/recharge(atom/movable/A, mob/user)
if(recharging)
return TRUE
else
recharging = TRUE
var/obj/item/weapon/stock_parts/cell/C = A.get_cell()
var/obj/item/weapon/gun/energy/E
var/obj/O
var/coefficient = 1
if(istype(A, /obj/item/weapon/gun/energy))
coefficient = 0.075 // 14 loops to recharge an egun from 0-1000
E = A
if(istype(A, /obj))
O = A
if(C)
if(C.charge >= C.maxcharge)
to_chat(user, "<span class='notice'>\The [A] is fully charged!</span>")
recharging = FALSE
return TRUE
user.visible_message("[user] starts recharging \the [A] with \the [src]","<span class='notice'>You start recharging [A] with \the [src]</span>")
while(C.charge < C.maxcharge)
if(E)
E.chambered = null // Prevents someone from firing continuously while recharging the gun.
if(do_after(user, 10, target = user) && cell.charge)
induce(C, coefficient)
do_sparks(1, FALSE, A)
if(O)
O.update_icon()
else
break
if(E)
E.recharge_newshot() //We're done charging, so we'll let someone fire it now.
user.visible_message("[user] recharged \the [A]!","<span class='notice'>You recharged \the [A]!</span>")
recharging = FALSE
return TRUE
/obj/item/weapon/inducer/attack(mob/M, mob/user)
if(user.a_intent == INTENT_HARM)
return ..()
if(cantbeused(user))
return
if(recharge(M, user))
return
return ..()
/obj/item/weapon/inducer/attack_self(mob/user)
if(opened && cell)
user.visible_message("[user] removes \the [cell] from \the [src]!","<span class='notice'>You remove \the [cell].</span>")
cell.update_icon()
user.put_in_hands(cell)
cell = null
update_icon()
/obj/item/weapon/inducer/examine(mob/living/M)
..()
if(cell)
to_chat(M, "<span class='notice'>It's display shows: [cell.charge]W</span>")
else
to_chat(M,"<span class='notice'>It's display is dark.</span>")
if(opened)
to_chat(M,"<span class='notice'>It's battery compartment is open.</span>")
/obj/item/weapon/inducer/update_icon()
cut_overlays()
if(opened)
if(!cell)
add_overlay("inducer-nobat")
else
add_overlay("inducer-bat")
/obj/item/weapon/inducer/sci
icon_state = "inducer-sci"
item_state = "inducer-sci"
desc = "A tool for inductively charging internal power cells. This one has a science color scheme, and is less potent than it's engineering counterpart."
cell_type = null
powertransfer = 500
opened = TRUE
/obj/item/weapon/inducer/sci/Initialize()
. = ..()
update_icon()
@@ -21,15 +21,15 @@
if(has_latches)
if(prob(10))
latches = "double_latch"
if(prob(1))
latches = "triple_latch"
if(prob(1))
latches = "triple_latch"
update_icon()
/obj/item/weapon/storage/toolbox/update_icon()
..()
cut_overlays()
if(has_latches)
add_overlay(latches)
add_overlay(latches)
/obj/item/weapon/storage/toolbox/suicide_act(mob/user)
@@ -140,10 +140,10 @@
max_combined_w_class = 28
storage_slots = 28
attack_verb = list("robusted", "crushed", "smashed")
var/proselytizer_type = /obj/item/clockwork/clockwork_proselytizer/scarab
var/fabricator_type = /obj/item/clockwork/replica_fabricator/scarab
/obj/item/weapon/storage/toolbox/brass/prefilled/PopulateContents()
new proselytizer_type(src)
new fabricator_type(src)
new /obj/item/weapon/screwdriver/brass(src)
new /obj/item/weapon/wirecutters/brass(src)
new /obj/item/weapon/wrench/brass(src)
@@ -151,7 +151,7 @@
new /obj/item/weapon/weldingtool/experimental/brass(src)
/obj/item/weapon/storage/toolbox/brass/prefilled/ratvar
var/slab_type = /obj/item/clockwork/slab
var/slab_type = /obj/item/clockwork/slab
/obj/item/weapon/storage/toolbox/brass/prefilled/ratvar/PopulateContents()
..()
@@ -159,7 +159,7 @@
/obj/item/weapon/storage/toolbox/brass/prefilled/ratvar/admin
slab_type = /obj/item/clockwork/slab/debug
proselytizer_type = /obj/item/clockwork/clockwork_proselytizer/scarab/debug
fabricator_type = /obj/item/clockwork/replica_fabricator/scarab/debug
/obj/item/weapon/storage/toolbox/artistic
+23 -23
View File
@@ -13,7 +13,7 @@
var/stunforce = 7
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/throw_hit_chance = 35
@@ -21,8 +21,8 @@
user.visible_message("<span class='suicide'>[user] is putting the live [name] in [user.p_their()] mouth! It looks like [user.p_theyre()] trying to commit suicide!</span>")
return (FIRELOSS)
/obj/item/weapon/melee/baton/Initialize()
. = ..()
/obj/item/weapon/melee/baton/Initialize()
. = ..()
update_icon()
/obj/item/weapon/melee/baton/throw_impact(atom/hit_atom)
@@ -31,16 +31,16 @@
if(status && prob(throw_hit_chance) && iscarbon(hit_atom))
baton_stun(hit_atom)
/obj/item/weapon/melee/baton/loaded/Initialize() //this one starts with a cell pre-installed.
bcell = new(src)
. = ..()
/obj/item/weapon/melee/baton/loaded/Initialize() //this one starts with a cell pre-installed.
cell = new(src)
. = ..()
/obj/item/weapon/melee/baton/proc/deductcharge(chrgdeductamt)
if(bcell)
if(cell)
//Note this value returned is significant, as it will determine
//if a stun is applied or not
. = bcell.use(chrgdeductamt)
if(status && bcell.charge < hitcost)
. = cell.use(chrgdeductamt)
if(status && cell.charge < hitcost)
//we're below minimum, turn off
status = 0
update_icon()
@@ -50,22 +50,22 @@
/obj/item/weapon/melee/baton/update_icon()
if(status)
icon_state = "[initial(name)]_active"
else if(!bcell)
else if(!cell)
icon_state = "[initial(name)]_nocell"
else
icon_state = "[initial(name)]"
/obj/item/weapon/melee/baton/examine(mob/user)
..()
if(bcell)
to_chat(user, "<span class='notice'>The baton is [round(bcell.percent())]% charged.</span>")
if(cell)
to_chat(user, "<span class='notice'>The baton is [round(cell.percent())]% charged.</span>")
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)
if(istype(W, /obj/item/weapon/stock_parts/cell))
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>")
else
if(C.maxcharge < hitcost)
@@ -73,15 +73,15 @@
return
if(!user.transferItemToLoc(W, src))
return
bcell = W
cell = W
to_chat(user, "<span class='notice'>You install a cell in [src].</span>")
update_icon()
else if(istype(W, /obj/item/weapon/screwdriver))
if(bcell)
bcell.updateicon()
bcell.loc = get_turf(src.loc)
bcell = null
if(cell)
cell.update_icon()
cell.forceMove(get_turf(src))
cell = null
to_chat(user, "<span class='notice'>You remove the cell from [src].</span>")
status = 0
update_icon()
@@ -89,13 +89,13 @@
return ..()
/obj/item/weapon/melee/baton/attack_self(mob/user)
if(bcell && bcell.charge > hitcost)
if(cell && cell.charge > hitcost)
status = !status
to_chat(user, "<span class='notice'>[src] is now [status ? "on" : "off"].</span>")
playsound(loc, "sparks", 75, 1, -1)
else
status = 0
if(!bcell)
if(!cell)
to_chat(user, "<span class='warning'>[src] does not have a power source!</span>")
else
to_chat(user, "<span class='warning'>[src] is out of charge.</span>")
@@ -186,8 +186,8 @@
slot_flags = SLOT_BACK
var/obj/item/device/assembly/igniter/sparkler = 0
/obj/item/weapon/melee/baton/cattleprod/Initialize()
. = ..()
/obj/item/weapon/melee/baton/cattleprod/Initialize()
. = ..()
sparkler = new (src)
/obj/item/weapon/melee/baton/cattleprod/baton_stun()
+1 -1
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
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
remove_item_from_storage(user)
qdel(src)