Muh pod equipment

Conflicts:
	code/modules/projectiles/projectile/beams.dm
This commit is contained in:
d3athrow
2014-03-23 18:11:35 -05:00
committed by ZomgPonies
parent ce7bb71ff7
commit d5e4fd0f33
6 changed files with 310 additions and 1 deletions
@@ -0,0 +1,50 @@
/datum/spacepod/equipment
var/obj/spacepod/my_atom
var/obj/item/device/spacepod_equipment/weaponry/weapon_system // weapons system
//var/obj/item/device/spacepod_equipment/engine/engine_system // engine system
//var/obj/item/device/spacepod_equipment/shield/shield_system // shielding system
/datum/spacepod/equipment/New(var/obj/spacepod/SP)
..()
if(istype(SP))
my_atom = SP
/obj/item/device/spacepod_equipment
name = "equipment"
// base item for spacepod weapons
/obj/item/device/spacepod_equipment/weaponry
name = "pod weapon"
desc = "You shouldn't be seeing this"
icon = 'icons/pods/ship.dmi'
icon_state = "blank"
var/projectile_type
var/shot_cost = 0
var/shots_per = 1
var/fire_sound
var/fire_delay = 10
/obj/item/device/spacepod_equipment/weaponry/taser
name = "\improper taser system"
desc = "A weak taser system for space pods, fires electrodes that shock upon impact."
icon_state = "pod_taser"
projectile_type = "/obj/item/projectile/energy/electrode"
shot_cost = 10
fire_sound = "sound/weapons/Taser.ogg"
/obj/item/device/spacepod_equipment/weaponry/taser/burst
name = "\improper taser system"
desc = "A weak taser system for space pods, this one fires 3 at a time."
icon_state = "pod_b_taser"
shot_cost = 20
shots_per = 3
/obj/item/device/spacepod_equipment/weaponry/laser
name = "\improper laser system"
desc = "A weak laser system for space pods, fires concentrated bursts of energy"
icon_state = "pod_w_laser"
projectile_type = "/obj/item/projectile/beam"
shot_cost = 15
fire_sound = 'sound/weapons/Laser.ogg'
fire_delay = 25
@@ -10,6 +10,7 @@
layer = 3.9
infra_luminosity = 15
var/mob/living/carbon/occupant
var/datum/spacepod/equipment/equipment_system
var/obj/item/weapon/cell/high/battery
var/datum/gas_mixture/cabin_air
var/obj/machinery/portable_atmospherics/canister/internal_tank
@@ -18,6 +19,8 @@
var/datum/global_iterator/pr_int_temp_processor //normalizes internal air mixture temperature
var/datum/global_iterator/pr_give_air //moves air from tank to cabin
var/inertia_dir = 0
var/hatch_open = 0
var/next_firetime = 0
/obj/spacepod/New()
bound_width = 64
@@ -32,6 +35,88 @@
src.use_internal_tank = 1
pr_int_temp_processor = new /datum/global_iterator/pod_preserve_temp(list(src))
pr_give_air = new /datum/global_iterator/pod_tank_give_air(list(src))
equipment_system = new(src)
/obj/spacepod/attackby(obj/item/W as obj, mob/user as mob)
if(iscrowbar(W))
hatch_open = !hatch_open
user << "<span class='notice'>You [hatch_open ? "open" : "close"] the maintenance hatch.</span>"
if(istype(W, /obj/item/weapon/cell))
if(!hatch_open)
return ..()
if(battery)
user << "<span class='notice'>The pod already has a battery.</span>"
return
user.drop_item(W)
battery = W
W.loc = src
return
if(istype(W, /obj/item/device/spacepod_equipment))
if(!hatch_open)
return ..()
if(!equipment_system)
user << "<span class='warning'>The pod has no equipment datum, yell at pomf</span>"
return
if(istype(W, /obj/item/device/spacepod_equipment/weaponry))
if(equipment_system.weapon_system)
user << "<span class='notice'>The pod already has a weapon system, remove it first.</span>"
return
else
user << "<span class='notice'>You insert \the [W] into the equipment system.</span>"
user.drop_item(W)
W.loc = equipment_system
equipment_system.weapon_system = W
verbs += /obj/spacepod/proc/fire_weapons
return
/obj/spacepod/attack_hand(mob/user as mob)
if(!hatch_open)
return ..()
if(!equipment_system || !istype(equipment_system))
user << "<span class='warning'>The pod has no equpment datum, or is the wrong type, yell at pomf.</span>"
return
var/list/possible = list()
if(battery)
possible.Add("Energy Cell")
if(equipment_system.weapon_system)
possible.Add("Weapon System")
/* Not yet implemented
if(equipment_system.engine_system)
possible.Add("Engine System")
if(equipment_system.shield_system)
possible.Add("Shield System")
*/
var/obj/item/device/spacepod_equipment/SPE
switch(input(user, "Remove which equipment?", null, null) as null|anything in possible)
if("Energy Cell")
if(user.put_in_any_hand_if_possible(battery))
user << "<span class='notice'>You remove \the [battery] from the space pod</span>"
battery = null
if("Weapon System")
SPE = equipment_system.weapon_system
if(user.put_in_any_hand_if_possible(SPE))
user << "<span class='notice'>You remove \the [SPE] from the equipment system.</span>"
equipment_system.weapon_system = null
else
user << "<span class='warning'>You need an open hand to do that.</span>"
/*
if("engine system")
SPE = equipment_system.engine_system
if(user.put_in_any_hand_if_possible(SPE))
user << "<span class='notice'>You remove \the [SPE] from the equipment system.</span>"
equipment_system.engine_system = null
else
user << "<span class='warning'>You need an open hand to do that.</span>"
if("shield system")
SPE = equipment_system.shield_system
if(user.put_in_any_hand_if_possible(SPE))
user << "<span class='notice'>You remove \the [SPE] from the equipment system.</span>"
equipment_system.shield_system = null
else
user << "<span class='warning'>You need an open hand to do that.</span>"
*/
return
/obj/spacepod/civilian
icon_state = "pod_civ"
@@ -142,6 +227,56 @@
return
move_inside(M, user)
/obj/spacepod/proc/fire_weapons()
set category = "Spacepod"
set name = "Fire Weapon System"
set desc = "Fire ze missiles(or lasers)"
set src = usr.loc
if(next_firetime > world.time)
usr << "<span class='warning'>Your weapons are recharging.</span>"
return
var/turf/firstloc
var/turf/secondloc
if(!equipment_system || !equipment_system.weapon_system)
usr << "<span class='warning'>Missing equipment or weapons.</span>"
src.verbs -= /obj/spacepod/proc/fire_weapons
return
battery.use(equipment_system.weapon_system.shot_cost)
var/olddir
for(var/i = 0; i < equipment_system.weapon_system.shots_per; i++)
if(olddir != dir)
switch(dir)
if(NORTH)
firstloc = get_step(src, NORTH)
secondloc = get_step(firstloc,EAST)
if(SOUTH)
firstloc = get_turf(src)
secondloc = get_step(firstloc,EAST)
if(EAST)
firstloc = get_turf(src)
firstloc = get_step(firstloc, EAST)
secondloc = get_step(firstloc,NORTH)
if(WEST)
firstloc = get_turf(src)
secondloc = get_step(firstloc,NORTH)
olddir = dir
var/obj/item/projectile/projone = new equipment_system.weapon_system.projectile_type(firstloc)
var/obj/item/projectile/projtwo = new equipment_system.weapon_system.projectile_type(secondloc)
projone.starting = get_turf(src)
projone.shot_from = src
projone.firer = usr
projone.def_zone = "chest"
projtwo.starting = get_turf(src)
projtwo.shot_from = src
projtwo.firer = usr
projtwo.def_zone = "chest"
spawn()
playsound(src, equipment_system.weapon_system.fire_sound, 50, 1)
projone.dumbfire(dir)
projtwo.dumbfire(dir)
sleep(1)
next_firetime = world.time + equipment_system.weapon_system.fire_delay
/obj/spacepod/verb/move_inside()
set category = "Object"
set name = "Enter Pod"
+16
View File
@@ -181,6 +181,22 @@
sleep(1)
Range()
return
proc/dumbfire(var/dir) // for spacepods, go snowflake go
if(!dir)
del(src)
if(kill_count < 1)
del(src)
kill_count--
spawn while(src)
var/turf/T = get_step(src, dir)
step_towards(src, T)
sleep(1)
if(!bumped && !isturf(original))
if(loc == get_turf(original))
if(!(original in permutated))
Bump(original)
sleep(1)
return
/obj/item/projectile/test //Used to see if you can hit them.
@@ -179,6 +179,113 @@ var/list/beam_master = list()
eyeblur = 4
var/frequency = 1
process()
var/reference = "\ref[src]" //So we do not have to recalculate it a ton
var/first = 1 //So we don't make the overlay in the same tile as the firer
spawn while(src) //Move until we hit something
if((!( current ) || loc == current)) //If we pass our target
current = locate(min(max(x + xo, 1), world.maxx), min(max(y + yo, 1), world.maxy), z)
if((x == 1 || x == world.maxx || y == 1 || y == world.maxy))
del(src) //Delete if it passes the world edge
return
step_towards(src, current) //Move~
if(kill_count < 1)
del(src)
kill_count--
if(!bumped && !isturf(original))
if(loc == get_turf(original))
if(!(original in permutated))
Bump(original)
if(!first) //Add the overlay as we pass over tiles
var/target_dir = get_dir(src, current) //So we don't call this too much
//If the icon has not been added yet
if( !("[icon_state][target_dir]" in beam_master) )
var/image/I = image(icon,icon_state,10,target_dir) //Generate it.
beam_master["[icon_state][target_dir]"] = I //And cache it!
//Finally add the overlay
src.loc.overlays += beam_master["[icon_state][target_dir]"]
//Add the turf to a list in the beam master so they can be cleaned up easily.
if(reference in beam_master)
var/list/turf_master = beam_master[reference]
if("[icon_state][target_dir]" in turf_master)
var/list/turfs = turf_master["[icon_state][target_dir]"]
turfs += loc
else
turf_master["[icon_state][target_dir]"] = list(loc)
else
var/list/turfs = list()
turfs["[icon_state][target_dir]"] = list(loc)
beam_master[reference] = turfs
else
first = 0
cleanup(reference)
return
dumbfire(var/dir)
var/reference = "\ref[src]" //So we do not have to recalculate it a ton
var/first = 1 //So we don't make the overlay in the same tile as the firer
if(!dir)
del(src)
spawn while(src) //Move until we hit something
if((x == 1 || x == world.maxx || y == 1 || y == world.maxy))
del(src) //Delete if it passes the world edge
return
var/turf/T = get_step(src, dir)
step_towards(src, T) //Move~
if(kill_count < 1)
del(src)
kill_count--
if(!bumped && !isturf(original))
if(loc == get_turf(original))
if(!(original in permutated))
Bump(original)
if(!first) //Add the overlay as we pass over tiles
var/target_dir = dir //So we don't call this too much
//If the icon has not been added yet
if( !("[icon_state][target_dir]" in beam_master) )
var/image/I = image(icon,icon_state,10,target_dir) //Generate it.
beam_master["[icon_state][target_dir]"] = I //And cache it!
//Finally add the overlay
src.loc.overlays += beam_master["[icon_state][target_dir]"]
//Add the turf to a list in the beam master so they can be cleaned up easily.
if(reference in beam_master)
var/list/turf_master = beam_master[reference]
if("[icon_state][target_dir]" in turf_master)
var/list/turfs = turf_master["[icon_state][target_dir]"]
turfs += loc
else
turf_master["[icon_state][target_dir]"] = list(loc)
else
var/list/turfs = list()
turfs["[icon_state][target_dir]"] = list(loc)
beam_master[reference] = turfs
else
first = 0
cleanup(reference)
return
proc/cleanup(reference) //Waits .3 seconds then removes the overlay.
src = null // Redundant.
spawn(3)
var/list/turf_master = beam_master[reference]
for(var/laser_state in turf_master)
var/list/turfs = turf_master[laser_state]
for(var/turf/T in turfs)
T.overlays -= beam_master[laser_state]
return
/obj/item/projectile/beam/practice
name = "laser"