From d5e4fd0f33cd5ae10d0f355a2f8cca55ce540493 Mon Sep 17 00:00:00 2001 From: d3athrow Date: Sun, 23 Mar 2014 18:11:35 -0500 Subject: [PATCH] Muh pod equipment Conflicts: code/modules/projectiles/projectile/beams.dm --- baystation12.dme | 3 +- .../pomf/spacepods/equipment.dm | 50 +++++++ .../pomf/{ => spacepods}/spacepods.dm | 135 ++++++++++++++++++ code/modules/projectiles/projectile.dm | 16 +++ code/modules/projectiles/projectile/beams.dm | 107 ++++++++++++++ icons/pods/ship.dmi | Bin 0 -> 546 bytes 6 files changed, 310 insertions(+), 1 deletion(-) create mode 100644 code/WorkInProgress/pomf/spacepods/equipment.dm rename code/WorkInProgress/pomf/{ => spacepods}/spacepods.dm (64%) create mode 100644 icons/pods/ship.dmi diff --git a/baystation12.dme b/baystation12.dme index ccde9d75914..86afe73e4db 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -1471,7 +1471,8 @@ #include "code\WorkInProgress\computer3\computers\robot.dm" #include "code\WorkInProgress\kilakk\fax.dm" #include "code\WorkInProgress\Mini\atmos_control.dm" -#include "code\WorkInProgress\pomf\spacepods.dm" +#include "code\WorkInProgress\pomf\spacepods\equipment.dm" +#include "code\WorkInProgress\pomf\spacepods\spacepods.dm" #include "code\WorkInProgress\Ported\policetape.dm" #include "code\WorkInProgress\Sayu\belt.dm" #include "code\WorkInProgress\Sayu\cargoprofile.dm" diff --git a/code/WorkInProgress/pomf/spacepods/equipment.dm b/code/WorkInProgress/pomf/spacepods/equipment.dm new file mode 100644 index 00000000000..2c3a673c703 --- /dev/null +++ b/code/WorkInProgress/pomf/spacepods/equipment.dm @@ -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 \ No newline at end of file diff --git a/code/WorkInProgress/pomf/spacepods.dm b/code/WorkInProgress/pomf/spacepods/spacepods.dm similarity index 64% rename from code/WorkInProgress/pomf/spacepods.dm rename to code/WorkInProgress/pomf/spacepods/spacepods.dm index c3b58e4deaa..aa84a437016 100644 --- a/code/WorkInProgress/pomf/spacepods.dm +++ b/code/WorkInProgress/pomf/spacepods/spacepods.dm @@ -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 << "You [hatch_open ? "open" : "close"] the maintenance hatch." + if(istype(W, /obj/item/weapon/cell)) + if(!hatch_open) + return ..() + if(battery) + user << "The pod already has a battery." + 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 << "The pod has no equipment datum, yell at pomf" + return + if(istype(W, /obj/item/device/spacepod_equipment/weaponry)) + if(equipment_system.weapon_system) + user << "The pod already has a weapon system, remove it first." + return + else + user << "You insert \the [W] into the equipment system." + 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 << "The pod has no equpment datum, or is the wrong type, yell at pomf." + 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 << "You remove \the [battery] from the space pod" + battery = null + if("Weapon System") + SPE = equipment_system.weapon_system + if(user.put_in_any_hand_if_possible(SPE)) + user << "You remove \the [SPE] from the equipment system." + equipment_system.weapon_system = null + else + user << "You need an open hand to do that." + /* + if("engine system") + SPE = equipment_system.engine_system + if(user.put_in_any_hand_if_possible(SPE)) + user << "You remove \the [SPE] from the equipment system." + equipment_system.engine_system = null + else + user << "You need an open hand to do that." + if("shield system") + SPE = equipment_system.shield_system + if(user.put_in_any_hand_if_possible(SPE)) + user << "You remove \the [SPE] from the equipment system." + equipment_system.shield_system = null + else + user << "You need an open hand to do that." + */ + + 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 << "Your weapons are recharging." + return + var/turf/firstloc + var/turf/secondloc + if(!equipment_system || !equipment_system.weapon_system) + usr << "Missing equipment or weapons." + 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" diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index cea43310b8c..8686f92d901 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -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. diff --git a/code/modules/projectiles/projectile/beams.dm b/code/modules/projectiles/projectile/beams.dm index ca45ca43907..1ae59e249b6 100644 --- a/code/modules/projectiles/projectile/beams.dm +++ b/code/modules/projectiles/projectile/beams.dm @@ -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" diff --git a/icons/pods/ship.dmi b/icons/pods/ship.dmi new file mode 100644 index 0000000000000000000000000000000000000000..e31477ce63d289e0c88a0608a523cc78143c6e06 GIT binary patch literal 546 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0J3?w7mbKU|etpJ}8*8>L*7#bS(_4S2?h1uEJ zrKF^Y=>N>k%@yb7W|;ZkOiC(3OY1*_aoT@lLG4e?KwXR_L4Lsu4$p3+0XfxGArU1m zsl~}fnFS@8`FRWs6?1~a3W`dMky>F0TGQDel(ypv=pG0X5z~>;C;wG5N{3 zFU_X&aT>=ji+z*#9u!e8*(jD4C^D7z{TkLYIjwqZn$1s(6qmkF$lu|(a5LZQ$Tw}; zB2A?$isWQ@cJe;YlQ;|cK!Zk;8u!1lXzq<-eJ|20{4 zi{y`mf1Z?gg@1DUL-p^6e