diff --git a/code/WorkInProgress/pomf/spacepods/spacepods.dm b/code/WorkInProgress/pomf/spacepods/spacepods.dm index aa84a437016..ac3cf438f83 100644 --- a/code/WorkInProgress/pomf/spacepods/spacepods.dm +++ b/code/WorkInProgress/pomf/spacepods/spacepods.dm @@ -1,4 +1,7 @@ // honk +#define DAMAGE 1 +#define FIRE 2 + /obj/spacepod name = "\improper space pod" desc = "A space pod meant for space travel." @@ -21,8 +24,15 @@ var/inertia_dir = 0 var/hatch_open = 0 var/next_firetime = 0 + var/list/pod_overlays + var/health = 400 /obj/spacepod/New() + . = ..() + if(!pod_overlays) + pod_overlays = new/list(2) + pod_overlays[DAMAGE] = image(icon, icon_state="pod_damage") + pod_overlays[FIRE] = image(icon, icon_state="pod_fire") bound_width = 64 bound_height = 64 dir = EAST @@ -37,6 +47,70 @@ pr_give_air = new /datum/global_iterator/pod_tank_give_air(list(src)) equipment_system = new(src) +/obj/spacepod/proc/update_icons() + if(!pod_overlays) + pod_overlays = new/list(2) + pod_overlays[DAMAGE] = image(icon, icon_state="pod_damage") + pod_overlays[FIRE] = image(icon, icon_state="pod_fire") + + if(health <= round(initial(health)/2)) + overlays += pod_overlays[DAMAGE] + if(health <= round(initial(health)/4)) + overlays += pod_overlays[FIRE] + else + overlays -= pod_overlays[FIRE] + else + overlays -= pod_overlays[DAMAGE] + +/obj/spacepod/bullet_act(var/obj/item/projectile/P) + if(P.damage && !P.nodamage) + deal_damage(P.damage) + +/obj/spacepod/proc/deal_damage(var/damage) + var/oldhealth = health + health = max(0, health - damage) + var/percentage = (health / initial(health)) * 100 + if(occupant && oldhealth > health && percentage <= 25 && percentage > 0) + var/sound/S = sound('sound/effects/engine_alert2.ogg') + S.wait = 0 //No queue + S.channel = 0 //Any channel + S.volume = 50 + occupant << S + if(occupant && oldhealth > health && !health) + var/sound/S = sound('sound/effects/engine_alert1.ogg') + S.wait = 0 + S.channel = 0 + S.volume = 50 + occupant << S + if(!health) + spawn(0) + if(occupant) + occupant << "Critical damage to the vessel detected, core explosion imminent!" + for(var/i = 10, i >= 0; --i) + if(occupant) + occupant << "[i]" + if(i == 0) + explosion(loc, 2, 4, 8) + sleep(10) + + update_icons() + +/obj/spacepod/ex_act(severity) + switch(severity) + if(1) + var/mob/living/carbon/human/H = occupant + if(H) + H.loc = get_turf(src) + H.ex_act(severity + 1) + H << "You are forcefully thrown from \the [src]!" + del(ion_trail) + del(src) + if(2) + deal_damage(100) + if(3) + if(prob(40)) + deal_damage(50) + /obj/spacepod/attackby(obj/item/W as obj, mob/user as mob) if(iscrowbar(W)) hatch_open = !hatch_open @@ -66,9 +140,13 @@ user.drop_item(W) W.loc = equipment_system equipment_system.weapon_system = W - verbs += /obj/spacepod/proc/fire_weapons + equipment_system.weapon_system.my_atom = src + var/path = text2path("[W.type]/proc/fire_weapon_system") + if(path) + verbs += path//obj/spacepod/proc/fire_weapons return + /obj/spacepod/attack_hand(mob/user as mob) if(!hatch_open) return ..() @@ -96,6 +174,7 @@ SPE = equipment_system.weapon_system if(user.put_in_any_hand_if_possible(SPE)) user << "You remove \the [SPE] from the equipment system." + SPE.my_atom = null equipment_system.weapon_system = null else user << "You need an open hand to do that." @@ -227,56 +306,6 @@ 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" @@ -397,7 +426,7 @@ return 1 /obj/spacepod/relaymove(mob/user, direction) - if(battery && battery.charge) + if(battery && battery.charge && health) src.dir = direction switch(direction) if(1) @@ -420,7 +449,14 @@ if(istype(src.loc, /turf/space)) inertia_dir = direction else - user << "She's dead, Jim" + if(!battery) + user << "No energy cell detected." + else if(battery.charge < 3) + user << "Not enough charge left." + else if(!health) + user << "She's dead, Jim" + else + user << "Unknown error has occurred, yell at pomf." return 0 battery.use(3) @@ -432,4 +468,7 @@ anchored = 1 /obj/effect/landmark/spacepod/random/New() - ..() \ No newline at end of file + ..() + +#undef DAMAGE +#undef FIRE diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 497a7243ebd..bcd646bc9e2 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -217,6 +217,7 @@ if(istype(loc, /obj/spacepod)) // Spacdpods! var/obj/spacepod/S = loc stat("Spacepod Charge", "[istype(S.battery) ? "[(S.battery.charge / S.battery.maxcharge) * 100]" : "No cell detected"]") + stat("Spacepod Integrity", "[!S.health ? "0" : "[(S.health / initial(S.health)) * 100]"]%") /mob/living/carbon/human/ex_act(severity) if(!blinded) diff --git a/icons/48x48/pods.dmi b/icons/48x48/pods.dmi index 61c6103d550..5ab7211f47b 100644 Binary files a/icons/48x48/pods.dmi and b/icons/48x48/pods.dmi differ diff --git a/sound/effects/engine_alert1.ogg b/sound/effects/engine_alert1.ogg new file mode 100644 index 00000000000..2ee395b2d72 Binary files /dev/null and b/sound/effects/engine_alert1.ogg differ diff --git a/sound/effects/engine_alert2.ogg b/sound/effects/engine_alert2.ogg new file mode 100644 index 00000000000..6d925686836 Binary files /dev/null and b/sound/effects/engine_alert2.ogg differ