mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Added Russian Revolvers. See changelog for more details.
Added the ability to shoot yourself in the head. See changelog. Added a isnull check on sortRecord proc. Changed the align to left. Added Two Russian Revolvers onto the map, on the Derelict Z-Level. Added a single .357 ammo box in a secure crate on the Derelict. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4063 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -247,7 +247,7 @@
|
||||
return uppertext(copytext(t, 1, 2)) + copytext(t, 2)
|
||||
|
||||
/proc/sortRecord(var/list/datum/data/record/L, var/field = "name", var/order = 1)
|
||||
if(L.len < 2)
|
||||
if(isnull(L) || L.len < 2)
|
||||
return L
|
||||
var/middle = L.len / 2 + 1
|
||||
return mergeRecordLists(sortRecord(L.Copy(0, middle), field, order), sortRecord(L.Copy(middle), field, order), field, order)
|
||||
@@ -796,6 +796,7 @@ Turf and target are seperate in case you want to teleport some distance from a t
|
||||
|
||||
else
|
||||
var/badname = 0
|
||||
newname = trim_right(trim_left(newname)) // " Abe Butts " becomes "Abe Butts"
|
||||
switch(newname)
|
||||
if("Unknown") badname = 1
|
||||
if("floor") badname = 1
|
||||
|
||||
@@ -14,71 +14,99 @@
|
||||
var/obj/item/ammo_magazine/empty_mag = null
|
||||
|
||||
|
||||
New()
|
||||
..()
|
||||
for(var/i = 1, i <= max_shells, i++)
|
||||
loaded += new ammo_type(src)
|
||||
update_icon()
|
||||
return
|
||||
/obj/item/weapon/gun/projectile/New()
|
||||
..()
|
||||
for(var/i = 1, i <= max_shells, i++)
|
||||
loaded += new ammo_type(src)
|
||||
update_icon()
|
||||
return
|
||||
|
||||
|
||||
load_into_chamber()
|
||||
// if(in_chamber)
|
||||
// return 1 {R}
|
||||
/obj/item/weapon/gun/projectile/load_into_chamber()
|
||||
// if(in_chamber)
|
||||
// return 1 {R}
|
||||
|
||||
if(!loaded.len)
|
||||
return 0
|
||||
|
||||
var/obj/item/ammo_casing/AC = loaded[1] //load next casing.
|
||||
loaded -= AC //Remove casing from loaded list.
|
||||
AC.loc = get_turf(src) //Eject casing onto ground.
|
||||
AC.desc += " This one is spent." //descriptions are magic
|
||||
|
||||
if(AC.BB)
|
||||
in_chamber = AC.BB //Load projectile into chamber.
|
||||
AC.BB.loc = src //Set projectile loc to gun.
|
||||
return 1
|
||||
if(!loaded.len)
|
||||
return 0
|
||||
var/obj/item/ammo_casing/AC = loaded[1] //load next casing.
|
||||
loaded -= AC //Remove casing from loaded list.
|
||||
if(isnull(AC) || !istype(AC))
|
||||
return 0
|
||||
AC.loc = get_turf(src) //Eject casing onto ground.
|
||||
AC.desc += " This one is spent." //descriptions are magic
|
||||
if(AC.BB)
|
||||
in_chamber = AC.BB //Load projectile into chamber.
|
||||
AC.BB.loc = src //Set projectile loc to gun.
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
attackby(var/obj/item/A as obj, mob/user as mob)
|
||||
/obj/item/weapon/gun/projectile/attackby(var/obj/item/A as obj, mob/user as mob)
|
||||
|
||||
var/num_loaded = 0
|
||||
if(istype(A, /obj/item/ammo_magazine))
|
||||
if((load_method == 2) && loaded.len) return
|
||||
var/obj/item/ammo_magazine/AM = A
|
||||
for(var/obj/item/ammo_casing/AC in AM.stored_ammo)
|
||||
if(loaded.len >= max_shells)
|
||||
break
|
||||
if(AC.caliber == caliber && loaded.len < max_shells)
|
||||
AC.loc = src
|
||||
AM.stored_ammo -= AC
|
||||
loaded += AC
|
||||
num_loaded++
|
||||
if(load_method == 2)
|
||||
user.remove_from_mob(AM)
|
||||
empty_mag = AM
|
||||
empty_mag.loc = src
|
||||
if(istype(A, /obj/item/ammo_casing) && !load_method)
|
||||
var/obj/item/ammo_casing/AC = A
|
||||
var/num_loaded = 0
|
||||
if(istype(A, /obj/item/ammo_magazine))
|
||||
if((load_method == 2) && loaded.len) return
|
||||
var/obj/item/ammo_magazine/AM = A
|
||||
for(var/obj/item/ammo_casing/AC in AM.stored_ammo)
|
||||
if(loaded.len >= max_shells)
|
||||
break
|
||||
if(AC.caliber == caliber && loaded.len < max_shells)
|
||||
user.drop_item()
|
||||
AC.loc = src
|
||||
AM.stored_ammo -= AC
|
||||
loaded += AC
|
||||
num_loaded++
|
||||
if(num_loaded)
|
||||
user << "\blue You load [num_loaded] shell\s into the gun!"
|
||||
A.update_icon()
|
||||
update_icon()
|
||||
return
|
||||
if(load_method == 2)
|
||||
user.remove_from_mob(AM)
|
||||
empty_mag = AM
|
||||
empty_mag.loc = src
|
||||
if(istype(A, /obj/item/ammo_casing) && !load_method)
|
||||
var/obj/item/ammo_casing/AC = A
|
||||
if(AC.caliber == caliber && loaded.len < max_shells)
|
||||
user.drop_item()
|
||||
AC.loc = src
|
||||
loaded += AC
|
||||
num_loaded++
|
||||
if(num_loaded)
|
||||
user << "\blue You load [num_loaded] shell\s into the gun!"
|
||||
A.update_icon()
|
||||
update_icon()
|
||||
return
|
||||
|
||||
/obj/item/weapon/gun/projectile/attack(atom/target as mob|obj|turf|area, mob/living/user as mob|obj)
|
||||
|
||||
if(isliving(target) && isliving(user))
|
||||
if(target == user)
|
||||
var/datum/organ/external/affecting = user.zone_sel.selecting
|
||||
if(affecting == "head")
|
||||
|
||||
var/obj/item/ammo_casing/AC = loaded[1]
|
||||
if(!load_into_chamber())
|
||||
user.visible_message("\red *click*", "\red *click*")
|
||||
return
|
||||
if(!in_chamber)
|
||||
return
|
||||
var/obj/item/projectile/P = new AC.projectile_type
|
||||
playsound(user, fire_sound, 50, 1)
|
||||
user.visible_message("\red [user.name] fires the [src.name] at his head!", "\red You fire the [src.name] at your head!", "\blue You hear a [istype(in_chamber, /obj/item/projectile/beam) ? "laser blast" : "gunshot"]!")
|
||||
if(!P.nodamage)
|
||||
user.apply_damage(300, BRUTE, affecting) // You are dead, dead, dead.
|
||||
return
|
||||
..()
|
||||
|
||||
|
||||
examine()
|
||||
..()
|
||||
usr << "Has [loaded.len] round\s remaining."
|
||||
/obj/item/weapon/gun/projectile/examine()
|
||||
..()
|
||||
usr << "Has [getAmmo()] round\s remaining."
|
||||
// if(in_chamber && !loaded.len)
|
||||
// usr << "However, it has a chambered round."
|
||||
// if(in_chamber && loaded.len)
|
||||
// usr << "It also has a chambered round." {R}
|
||||
return
|
||||
return
|
||||
|
||||
/obj/item/weapon/gun/projectile/proc/getAmmo()
|
||||
var/bullets = 0
|
||||
for(var/obj/item/ammo_casing/AC in loaded)
|
||||
if(istype(AC))
|
||||
bullets += 1
|
||||
return bullets
|
||||
|
||||
|
||||
@@ -35,9 +35,77 @@
|
||||
|
||||
|
||||
|
||||
|
||||
/obj/item/weapon/gun/projectile/mateba
|
||||
name = "mateba"
|
||||
desc = "When you absolutely, positively need a 10mm hole in the other guy. Uses .357 ammo."
|
||||
icon_state = "mateba"
|
||||
origin_tech = "combat=2;materials=2"
|
||||
|
||||
// A gun to play Russian Roulette!
|
||||
// You can spin the chamber to randomize the position of the bullet.
|
||||
|
||||
/obj/item/weapon/gun/projectile/russian
|
||||
name = "Russian Revolver"
|
||||
desc = "A Russian made revolver. Uses 357 ammo. It has a single slot in it's chamber for a bullet."
|
||||
max_shells = 6
|
||||
origin_tech = "combat=2;materials=2"
|
||||
|
||||
/obj/item/weapon/gun/projectile/russian/New()
|
||||
Spin()
|
||||
update_icon()
|
||||
|
||||
/obj/item/weapon/gun/projectile/russian/proc/Spin()
|
||||
|
||||
for(var/obj/item/ammo_casing/AC in loaded)
|
||||
del(AC)
|
||||
loaded = list()
|
||||
var/random = rand(1, max_shells)
|
||||
for(var/i = 1; i <= max_shells; i++)
|
||||
if(i != random)
|
||||
loaded += i // Basically null
|
||||
else
|
||||
loaded += new ammo_type(src)
|
||||
|
||||
|
||||
/obj/item/weapon/gun/projectile/russian/attackby(var/obj/item/A as obj, mob/user as mob)
|
||||
|
||||
var/num_loaded = 0
|
||||
if(istype(A, /obj/item/ammo_magazine))
|
||||
if((load_method == 2) && loaded.len) return
|
||||
var/obj/item/ammo_magazine/AM = A
|
||||
for(var/obj/item/ammo_casing/AC in AM.stored_ammo)
|
||||
if(getAmmo() > 0 || loaded.len >= max_shells)
|
||||
break
|
||||
if(AC.caliber == caliber && loaded.len < max_shells)
|
||||
AC.loc = src
|
||||
AM.stored_ammo -= AC
|
||||
loaded += AC
|
||||
num_loaded++
|
||||
break
|
||||
if(load_method == 2)
|
||||
..()
|
||||
return
|
||||
if(istype(A, /obj/item/ammo_casing) && !load_method)
|
||||
var/obj/item/ammo_casing/AC = A
|
||||
if(AC.caliber == caliber && loaded.len < max_shells && getAmmo() == 0)
|
||||
user.drop_item()
|
||||
AC.loc = src
|
||||
loaded += AC
|
||||
num_loaded++
|
||||
|
||||
if(num_loaded)
|
||||
user.visible_message("[user] loads a single bullet into the revolver and spins the chamber.", "You load a single bullet into the chamber and spin it.")
|
||||
else
|
||||
user.visible_message("[user] spins the chamber of the revolver.", "You spin the revolver's chamber.")
|
||||
if(getAmmo() > 0)
|
||||
Spin()
|
||||
A.update_icon()
|
||||
update_icon()
|
||||
return
|
||||
|
||||
/obj/item/weapon/gun/projectile/russian/attack_self(mob/user as mob)
|
||||
|
||||
user.visible_message("[user] spins the chamber of the revolver.", "You spin the revolver's chamber.")
|
||||
if(getAmmo() > 0)
|
||||
Spin()
|
||||
|
||||
|
||||
@@ -47,7 +47,16 @@ should be listed in the changelog upon commit tho. Thanks. -->
|
||||
|
||||
<!-- To take advantage of the pretty new format (well it was new when I wrote this anyway), open the "add-to-changelog.html" file in any browser and add the stuff and then generate the html code and paste it here -->
|
||||
<div class="commit sansserif">
|
||||
<h2 class="date">13 July 2012</h2>
|
||||
<h2 class="date">Saturday July 14th 2012</h2>
|
||||
<h3 class="author">Giacom updated:</h3>
|
||||
<ul class="changes bgimages16">
|
||||
<li class="tweak">You can now shoot yourself in the head with a projectile gun. To do this: Equip your gun, change your target zone to the head and click on yourself. The beanbag shotgun would also kill you since it's point-blank in the head.</li>
|
||||
<li class="rscadd">Added Russian Revolvers. This is a special Revolver that can only hold a single bullet randomly in it's chamber. This will allow you to play Russian Roulette with your fellow crew members! You can use it like a normal gun but you will need to cycle through the chamber slots until you hit the bullet. To find one, look on the Derelict.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="commit sansserif">
|
||||
<h2 class="date">Friday July 13th 2012</h2>
|
||||
<h3 class="author">Carn updated:</h3>
|
||||
<ul class="changes bgimages16">
|
||||
<li class="imageadd">Added FLOORLENGTH HAIR. YEESSSSSSSS!!!! :3 If you like it say thanks to Ausops for fixing it up. Credits to Powerfulstation for the original sprite.</li>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user