Merge remote-tracking branch 'upstream/master'

This commit is contained in:
DZD
2014-12-06 13:09:13 -05:00
63 changed files with 2360 additions and 2405 deletions
+110 -189
View File
@@ -1,227 +1,148 @@
/obj/item/device/flash
name = "flash"
desc = "Used for blinding and being an asshole."
desc = "A powerful and versatile flashbulb device, with applications ranging from disorienting attackers to acting as visual receptors in robot production."
icon_state = "flash"
item_state = "flashbang" //looks exactly like a flash (and nothing like a flashbang)
throwforce = 5
w_class = 1.0
throw_speed = 4
throw_range = 10
flags = FPRINT | TABLEPASS| CONDUCT
throwforce = 0
w_class = 1
throw_speed = 3
throw_range = 7
flags = FPRINT | TABLEPASS | CONDUCT
origin_tech = "magnets=2;combat=1"
var/times_used = 0 //Number of times it's been used.
var/broken = 0 //Is the flash burnt out?
var/last_used = 0 //last world.time it was used.
/obj/item/device/flash/proc/clown_check(var/mob/user)
/obj/item/device/flash/proc/clown_check(mob/user)
if(user && (M_CLUMSY in user.mutations) && prob(50))
user << "\red \The [src] slips out of your hand."
user.drop_item()
flash_carbon(user, user, 15, 0)
user.visible_message("<span class='disarm'>[user] blinds [user] with the flash!</span>")
return 0
return 1
/obj/item/device/flash/proc/flash_recharge()
//capacitor recharges over time
for(var/i=0, i<3, i++)
if(last_used+600 > world.time)
break
last_used += 600
times_used -= 2
/obj/item/device/flash/proc/burn_out() //Made so you can override it if you want to have an invincible flash from R&D or something.
broken = 1
icon_state = "[initial(icon_state)]burnt"
visible_message("<span class='notice'>The [src.name] burns out!</span>")
/obj/item/device/flash/proc/flash_recharge(var/mob/user)
if(prob(times_used * 2)) //if you use it 5 times in a minute it has a 10% chance to break!
burn_out()
return 0
var/deciseconds_passed = world.time - last_used
for(var/seconds = deciseconds_passed/10, seconds>=10, seconds-=10) //get 1 charge every 10 seconds
times_used--
last_used = world.time
times_used = max(0,round(times_used)) //sanity
times_used = max(0, times_used) //sanity
/obj/item/device/flash/attack(mob/living/M as mob, mob/user as mob)
if(!user || !M) return //sanity
/obj/item/device/flash/proc/try_use_flash(var/mob/user)
flash_recharge(user)
M.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has been flashed (attempt) with [src.name] by [user.name] ([user.ckey])</font>")
user.attack_log += text("\[[time_stamp()]\] <font color='red'>Used the [src.name] to flash [M.name] ([M.ckey])</font>")
if(M.ckey)
msg_admin_attack("[user.name] ([user.ckey]) Used the [src.name] to flash [M.name] ([M.ckey]) (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[user.x];Y=[user.y];Z=[user.z]'>JMP</a>)")
if(!iscarbon(user))
M.LAssailant = null
else
M.LAssailant = user
if(!clown_check(user)) return
if(broken)
user << "<span class='warning'>\The [src] is broken.</span>"
return
return 0
flash_recharge()
//spamming the flash before it's fully charged (60seconds) increases the chance of it breaking
//It will never break on the first use.
switch(times_used)
if(0 to 5)
last_used = world.time
if(prob(times_used)) //if you use it 5 times in a minute it has a 10% chance to break!
broken = 1
user << "<span class='warning'>The bulb has burnt out!</span>"
icon_state = "flashburnt"
return
times_used++
else //can only use it 5 times a minute
user << "<span class='warning'>*click* *click*</span>"
return
playsound(src.loc, 'sound/weapons/flash.ogg', 100, 1)
var/flashfail = 0
flick("[initial(icon_state)]2", src)
times_used++
if(user && !clown_check(user))
return 0
return 1
/obj/item/device/flash/proc/flash_carbon(var/mob/living/carbon/M, var/mob/user = null, var/power = 5, convert = 1)
add_logs(M, user, "flashed", object="the flash")
var/safety = M:eyecheck()
if(safety <= 0)
M.confused += power
flick("e_flash", M.flash)
if(user && convert)
terrible_conversion_proc(M, user)
M.Stun(1)
/obj/item/device/flash/attack(mob/living/M, mob/user)
if(!try_use_flash(user))
return 0
if(iscarbon(M))
var/safety = M:eyecheck()
if(safety <= 0)
M.Weaken(5)
flick("e_flash", M.flash)
if(ishuman(M) && ishuman(user) && M.stat!=DEAD)
if(user.mind && user.mind in ticker.mode.head_revolutionaries)
var/revsafe = 0
for(var/obj/item/weapon/implant/loyalty/L in M)
if(L && L.implanted)
revsafe = 1
break
M.mind_initialize() //give them a mind datum if they don't have one.
if(M.mind.has_been_rev)
revsafe = 2
if(!revsafe)
M.mind.has_been_rev = 1
ticker.mode.add_revolutionary(M.mind)
else if(revsafe == 1)
user << "<span class='warning'>Something seems to be blocking the flash!</span>"
else
user << "<span class='warning'>This mind seems resistant to the flash!</span>"
user << "<span class='warning'>This mind is so vacant that it is not susceptible to influence!</span>"
else
flashfail = 1
flash_carbon(M, user, 5, 1)
user.visible_message("<span class='disarm'>[user] blinds [M] with the flash!</span>")
return 1
else if(issilicon(M))
M.Weaken(rand(5,10))
else
flashfail = 1
add_logs(M, user, "flashed", object="[src.name]")
user.visible_message("<span class='disarm'>[user] overloads [M]'s sensors with the flash!</span>")
return 1
if(isrobot(user))
spawn(0)
var/atom/movable/overlay/animation = new(user.loc)
animation.layer = user.layer + 1
animation.icon_state = "blank"
animation.icon = 'icons/mob/mob.dmi'
animation.master = user
flick("blspell", animation)
sleep(5)
del(animation)
if(!flashfail)
flick("flash2", src)
if(!issilicon(M))
user.visible_message("<span class='disarm'>[user] blinds [M] with the flash!</span>")
else
user.visible_message("<span class='notice'>[user] overloads [M]'s sensors with the flash!</span>")
else
user.visible_message("<span class='notice'>[user] fails to blind [M] with the flash!</span>")
return
user.visible_message("<span class='notice'>[user] fails to blind [M] with the flash!</span>")
/obj/item/device/flash/attack_self(mob/living/carbon/user as mob, flag = 0, emp = 0)
if(!user || !clown_check(user)) return
if(broken)
user.show_message("<span class='warning'>The [src.name] is broken</span>", 2)
return
flash_recharge()
//spamming the flash before it's fully charged (60seconds) increases the chance of it breaking
//It will never break on the first use.
switch(times_used)
if(0 to 5)
if(prob(2*times_used)) //if you use it 5 times in a minute it has a 10% chance to break!
broken = 1
user << "<span class='warning'>The bulb has burnt out!</span>"
icon_state = "flashburnt"
return
times_used++
else //can only use it 5 times a minute
user.show_message("<span class='warning'>*click* *click*</span>", 2)
return
playsound(src.loc, 'sound/weapons/flash.ogg', 100, 1)
flick("flash2", src)
if(user && isrobot(user))
spawn(0)
var/atom/movable/overlay/animation = new(user.loc)
animation.layer = user.layer + 1
animation.icon_state = "blank"
animation.icon = 'icons/mob/mob.dmi'
animation.master = user
flick("blspell", animation)
sleep(5)
del(animation)
/obj/item/device/flash/attack_self(mob/living/carbon/user, flag = 0, emp = 0)
if(!try_use_flash(user))
return 0
for(var/mob/living/carbon/M in oviewers(3, null))
if(prob(50))
if (locate(/obj/item/weapon/cloaking_device, M))
for(var/obj/item/weapon/cloaking_device/S in M)
S.active = 0
S.icon_state = "shield0"
if(M.alpha < 255)
var/oldalpha = M.alpha
if(prob(80))
M.alpha = 255
M.visible_message("<span class='warning'>[M] suddenly becomes fully visible!</span>",\
"<span class='warning'>You see a bright flash of light and are suddenly fully visible again.</span>")
spawn(50)
M.alpha = oldalpha
var/safety = M:eyecheck()
if(!safety)
if(!M.blinded)
flick("flash", M.flash)
flash_carbon(M, user, 3, 0)
return
/obj/item/device/flash/emp_act(severity)
if(broken) return
flash_recharge()
switch(times_used)
if(0 to 5)
if(prob(2*times_used))
broken = 1
icon_state = "flashburnt"
return
times_used++
if(istype(loc, /mob/living/carbon))
var/mob/living/carbon/M = loc
var/safety = M.eyecheck()
if(safety <= 0)
M.Weaken(5)
flick("e_flash", M.flash)
for(var/mob/O in viewers(M, null))
O.show_message("<span class='disarm'>[M] is blinded by the flash!</span>")
if(!try_use_flash())
return 0
for(var/mob/living/carbon/M in viewers(3, null))
flash_carbon(M, null, 10, 0)
burn_out()
..()
/obj/item/device/flash/synthetic
name = "synthetic flash"
desc = "When a problem arises, SCIENCE is the solution."
icon_state = "sflash"
origin_tech = "magnets=2;combat=1"
var/construction_cost = list("metal"=750,"glass"=750)
var/construction_time=100
/obj/item/device/flash/synthetic/attack(mob/living/M as mob, mob/user as mob)
..()
if(!broken)
broken = 1
user << "\red The bulb has burnt out!"
icon_state = "flashburnt"
/obj/item/device/flash/proc/terrible_conversion_proc(var/mob/M, var/mob/user)
if(ishuman(M) && ishuman(user) && M.stat != DEAD)
if(user.mind && ((user.mind in ticker.mode.head_revolutionaries)))
if(M.client)
if(M.stat == CONSCIOUS)
M.mind_initialize() //give them a mind datum if they don't have one.
var/resisted
if(!isloyal(M))
if(user.mind in ticker.mode.head_revolutionaries)
if(!ticker.mode.add_revolutionary(M.mind))
resisted = 1
else
resisted = 1
/obj/item/device/flash/synthetic/attack_self(mob/living/carbon/user as mob, flag = 0, emp = 0)
if(resisted)
user << "<span class='warning'>This mind seems resistant to the flash!</span>"
else
user << "<span class='warning'>They must be conscious before you can convert them!</span>"
else
user << "<span class='warning'>This mind is so vacant that it is not susceptible to influence!</span>"
/obj/item/device/flash/cyborg
origin_tech = null
/obj/item/device/flash/cyborg/attack(mob/living/M, mob/user)
..()
if(!broken)
broken = 1
user << "\red The bulb has burnt out!"
icon_state = "flashburnt"
cyborg_flash_animation(user)
/obj/item/device/flash/cyborg/attack_self(mob/user)
..()
cyborg_flash_animation(user)
/obj/item/device/flash/cyborg/proc/cyborg_flash_animation(var/mob/living/user)
var/atom/movable/overlay/animation = new(user.loc)
animation.layer = user.layer + 1
animation.icon_state = "blank"
animation.icon = 'icons/mob/mob.dmi'
animation.master = user
flick("blspell", animation)
sleep(5)
del(animation)
/obj/item/device/flash/synthetic //just a regular flash now
@@ -56,7 +56,7 @@
//SKREEEEEEEEEEEE tool
/obj/item/device/flash/alien
/obj/item/device/flash/cyborg/alien
name = "eye flash"
desc = "Useful for taking pictures, making friends and flash-frying chips."
icon = 'icons/mob/alien.dmi'
+78 -140
View File
@@ -3,29 +3,24 @@
desc = "A stun baton for incapacitating people with."
icon_state = "stunbaton"
item_state = "baton"
flags = FPRINT | TABLEPASS
slot_flags = SLOT_BELT
flags = FPRINT | TABLEPASS
force = 10
throwforce = 7
w_class = 3
origin_tech = "combat=2"
attack_verb = list("beaten")
var/stunforce = 0
var/agonyforce = 60
var/status = 0 //whether the thing is on or not
var/stunforce = 7
var/status = 0
var/obj/item/weapon/cell/high/bcell = null
var/mob/foundmob = "" //Used in throwing proc.
var/hitcost = 1500 //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/allowharm = 1 // Allow or disallow harming with the stunbaton
var/hitcost = 1500
/obj/item/weapon/melee/baton/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] is putting the live [name] in \his mouth! It looks like \he's trying to commit suicide.</span>")
return (FIRELOSS)
/obj/item/weapon/melee/baton/loaded/New() //this one starts with a cell pre-installed.
/obj/item/weapon/melee/baton/New()
..()
bcell = new/obj/item/weapon/cell/high(src)
update_icon()
return
@@ -33,25 +28,22 @@
bcell = locate(/obj/item/weapon/cell) in contents
update_icon()
/obj/item/weapon/melee/baton/loaded/New() //this one starts with a cell pre-installed.
..()
bcell = new(src)
update_icon()
return
/obj/item/weapon/melee/baton/proc/deductcharge(var/chrgdeductamt)
if(bcell)
if(bcell.rigged)
bcell.explode()//exploding baton of justice
if(bcell.charge < (hitcost+chrgdeductamt)) // If after the deduction the baton doesn't have enough charge for a stun hit it turns off.
status = 0
update_icon()
return
playsound(loc, "sparks", 75, 1, -1)
if(bcell.use(chrgdeductamt))
return 1
else
bcell.charge -= max(chrgdeductamt,0)
if(bcell.charge < hitcost)
status = 0
update_icon()
/obj/item/weapon/melee/baton/examine()
set src in view(1)
..()
if(bcell)
usr <<"<span class='notice'>The baton is [round(bcell.percent())]% charged.</span>"
if(!bcell)
usr <<"<span class='warning'>The baton does not have a power source installed.</span>"
return 0
/obj/item/weapon/melee/baton/update_icon()
if(status)
@@ -61,16 +53,27 @@
else
icon_state = "[initial(icon_state)]"
/obj/item/weapon/melee/baton/examine(mob/user)
..()
if(bcell)
user <<"<span class='notice'>The baton is [round(bcell.percent())]% charged.</span>"
if(!bcell)
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)
if(istype(W, /obj/item/weapon/cell))
if(!bcell)
var/obj/item/weapon/cell/C = W
if(bcell)
user << "<span class='notice'>[src] already has a cell.</span>"
else
if(C.maxcharge < hitcost)
user << "<span class='notice'>[src] requires a higher capacity cell.</span>"
return
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 if(istype(W, /obj/item/weapon/screwdriver))
if(bcell)
@@ -85,143 +88,88 @@
return
/obj/item/weapon/melee/baton/attack_self(mob/user)
if(status && (M_CLUMSY in user.mutations) && prob(50))
user << "\red You grab the [src] on the wrong side."
user.Weaken(stunforce*3)
deductcharge(hitcost)
return
if(bcell && bcell.charge)
if(bcell.charge < hitcost)
status = 0
user << "<span class='warning'>[src] is out of charge.</span>"
else
status = !status
user << "<span class='notice'>[src] is now [status ? "on" : "off"].</span>"
playsound(loc, "sparks", 75, 1, -1)
update_icon()
if(bcell && bcell.charge > hitcost)
status = !status
user << "<span class='notice'>[src] is now [status ? "on" : "off"].</span>"
playsound(loc, "sparks", 75, 1, -1)
else
status = 0
if(!bcell)
user << "<span class='warning'>[src] does not have a power source!</span>"
else
user << "<span class='warning'>[src] is out of charge.</span>"
update_icon()
add_fingerprint(user)
/obj/item/weapon/melee/baton/attack(mob/M, mob/user)
/obj/item/weapon/melee/baton/attack(mob/M, mob/living/user)
if(status && (M_CLUMSY in user.mutations) && prob(50))
user << "span class='danger'>You accidentally hit yourself with the [src]!</span>"
user.Weaken(30)
user.visible_message("<span class='danger'>[user] accidentally hits themself with [src]!</span>", \
"<span class='userdanger'>You accidentally hit yourself with [src]!</span>")
user.Weaken(stunforce*3)
deductcharge(hitcost)
return
if(isrobot(M))
..()
return
if(!isliving(M))
return
var/agony = agonyforce
var/stun = stunforce
var/mob/living/L = M
var/target_zone = check_zone(user.zone_sel.selecting)
if(user.a_intent == "harm" && allowharm == 1)
if (!..()) //item/attack() does it's own messaging and logs
return 0 // item/attack() will return 1 if they hit, 0 if they missed.
agony *= 0.5 //whacking someone causes a much poorer contact than prodding them.
stun *= 0.5
//we can't really extract the actual hit zone from ..(), unfortunately. Just act like they attacked the area they intended to.
else
//copied from human_defense.dm - human defence code should really be refactored some time.
if (ishuman(L))
user.lastattacked = L //are these used at all, if we have logs?
L.lastattacker = user
if (user != L) // Attacking yourself can't miss
target_zone = get_zone_with_miss_chance(user.zone_sel.selecting, L)
if(!target_zone)
L.visible_message("\red <B>[user] misses [L] with \the [src]!")
return 0
var/mob/living/carbon/human/H = L
var/datum/organ/external/affecting = H.get_organ(target_zone)
if (affecting)
if(!status)
L.visible_message("<span class='warning'>[L] has been prodded in the [affecting.display_name] with [src] by [user]. Luckily it was off.</span>")
return 1
else
H.visible_message("<span class='danger'>[L] has been prodded in the [affecting.display_name] with [src] by [user]!</span>")
if(user.a_intent != "harm")
if(status)
baton_stun(L, user)
else
if(!status)
L.visible_message("<span class='warning'>[L] has been prodded with [src] by [user]. Luckily it was off.</span>")
return 1
else
L.visible_message("<span class='danger'>[L] has been prodded with [src] by [user]!</span>")
L.visible_message("<span class='warning'>[L] has been prodded with [src] by [user]. Luckily it was off.</span>", \
"<span class='warning'>You've been prodded with [src] by [user]. Luckily it was off</span>")
return
else
..()
if(status)
baton_stun(L, user)
//stun effects
L.stun_effect_act(stun, agony, target_zone, src)
/obj/item/weapon/melee/baton/proc/baton_stun(mob/living/L, mob/user)
user.lastattacked = L
L.lastattacker = user
L.Stun(stunforce)
L.Weaken(stunforce)
L.apply_effect(STUTTER, stunforce)
L.visible_message("<span class='danger'>[L] has been stunned with [src] by [user]!</span>", \
"<span class='userdanger'>You've been stunned with [src] by [user]!</span>")
playsound(loc, 'sound/weapons/Egloves.ogg', 50, 1, -1)
msg_admin_attack("[key_name(user)] stunned [key_name(L)] with the [src].")
deductcharge(hitcost)
if(isrobot(loc))
var/mob/living/silicon/robot/R = loc
if(R && R.cell)
R.cell.use(hitcost)
else
deductcharge(hitcost)
if(ishuman(L))
var/mob/living/carbon/human/H = L
H.forcesay(hit_appends)
return 1
/obj/item/weapon/melee/baton/throw_impact(atom/hit_atom)
. = ..()
if (prob(50))
if(istype(hit_atom, /mob/living))
var/mob/living/carbon/human/H = hit_atom
if(status)
//stun effects
if (stunforce)
H.Stun(stunforce)
H.Weaken(stunforce)
H.apply_effect(STUTTER, stunforce)
if (agonyforce)
//Siemens coefficient?
//TODO: Merge this with taser effects
H.apply_effect(agonyforce,AGONY,0)
H.apply_effect(STUTTER, agonyforce/10)
H.apply_effect(EYE_BLUR, agonyforce/10)
H.flash_pain()
deductcharge(hitcost)
if(bcell.charge < hitcost)
status = 0
update_icon()
for(var/mob/M in player_list) if(M.key == src.fingerprintslast)
foundmob = M
break
H.visible_message("<span class='danger'>[src], thrown by [foundmob.name], strikes [H] and stuns them!</span>")
H.attack_log += "\[[time_stamp()]\]<font color='orange'> Stunned by thrown [src.name] last touched by ([src.fingerprintslast])</font>"
log_attack("Flying [src.name], last touched by ([src.fingerprintslast]) stunned [H.name] ([H.ckey])" )
if(!iscarbon(foundmob))
H.LAssailant = null
else
H.LAssailant = foundmob
add_logs(L, user, "stunned", object="stunbaton")
/obj/item/weapon/melee/baton/emp_act(severity)
if(bcell)
bcell.emp_act(severity) //let's not duplicate code everywhere if we don't have to please.
deductcharge(1000 / severity)
if(bcell.reliability != 100 && prob(50/severity))
bcell.reliability -= 10 / severity
..()
//secborg stun baton module
/obj/item/weapon/melee/baton/robot
hitcost = 500
/obj/item/weapon/melee/baton/robot/New()
..()
return
/obj/item/weapon/melee/baton/robot/attack_self(mob/user)
//try to find our power cell
var/mob/living/silicon/robot/R = loc
@@ -246,16 +194,6 @@
item_state = "prod"
force = 3
throwforce = 5
stunforce = 0
agonyforce = 42 //less than a stunbaton and uses way more charge.
stunforce = 5
hitcost = 3750
attack_verb = list("poked")
slot_flags = null
/obj/item/weapon/melee/baton/cattleprod/update_icon()
if(status)
icon_state = "stunprod_active"
else if(!bcell)
icon_state = "stunprod_nocell"
else
icon_state = "stunprod"
slot_flags = null
+19 -7
View File
@@ -463,7 +463,6 @@
item_state = "crowbar_red"
/obj/item/weapon/weldingtool/attack(mob/M as mob, mob/user as mob)
if(hasorgans(M))
var/datum/organ/external/S = M:organs_by_name[user.zone_sel.selecting]
@@ -480,14 +479,27 @@
return
if(S.brute_dam)
S.heal_damage(15,0,0,1)
user.visible_message("\red \The [user] patches some dents on \the [M]'s [S.display_name] with \the [src].")
if(istype(M,/mob/living/carbon/human))
var/mob/living/carbon/human/H = M
H.updatehealth()
return
var/obj/item/weapon/weldingtool/WT = src
if (WT.remove_fuel(0,user))
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
S.heal_damage(15,0,0,1)
user.visible_message("\red \The [user] patches some dents on \the [M]'s [S.display_name] with \the [src].")
if(istype(M,/mob/living/carbon/human))
var/mob/living/carbon/human/H = M
H.updatehealth()
if(istype(M,/mob/living/carbon/human/machine) && M.stat == 0) // If an IPC is brought back to life by welding it, which is possible, update the mob list
if(M in dead_mob_list)
dead_mob_list -= M
respawnable_list -= M
living_mob_list += M
mob_list += M
return
else
user << "\red You need more welding fuel to complete this task."
return
else
user << "Nothing to fix!"
return
else
return ..()