diff --git a/code/defines/procs/helpers.dm b/code/defines/procs/helpers.dm index 8994b5d99f1..ef46b91e4e8 100644 --- a/code/defines/procs/helpers.dm +++ b/code/defines/procs/helpers.dm @@ -833,4 +833,18 @@ //Makes sure MIDDLE is between LOW and HIGH. If not, it adjusts it. Returns the adjusted value. /proc/between(var/low, var/middle, var/high) - return max(min(middle, high), low) \ No newline at end of file + return max(min(middle, high), low) + +//returns random gauss number +proc/GaussRand(var/sigma) + var/x,y,rsq + do + x=2*rand()-1 + y=2*rand()-1 + rsq=x*x+y*y + while(rsq>1 || !rsq) + return sigma*y*sqrt(-2*log(rsq)/rsq) + +//returns random gauss number, rounded to 'roundto' +proc/GaussRandRound(var/sigma,var/roundto) + return round(GaussRand(sigma),roundto) \ No newline at end of file diff --git a/code/game/asteroid/asteroid.dm b/code/game/asteroid/asteroid.dm index 3c7da2b95a1..62e2d97b8c5 100644 --- a/code/game/asteroid/asteroid.dm +++ b/code/game/asteroid/asteroid.dm @@ -144,16 +144,4 @@ proc/admin_spawn_room_at_pos() -var/global/max_secret_rooms = 3 - - -proc/GaussRand(var/sigma) - var/x,y,rsq - do - x=2*rand()-1 - y=2*rand()-1 - rsq=x*x+y*y - while(rsq>1 || !rsq) - return sigma*y*sqrt((-2*log(rsq))/rsq) - - +var/global/max_secret_rooms = 3 \ No newline at end of file diff --git a/code/game/mecha/combat/combat.dm b/code/game/mecha/combat/combat.dm index eaf54c2e476..b3e0256c78c 100644 --- a/code/game/mecha/combat/combat.dm +++ b/code/game/mecha/combat/combat.dm @@ -5,7 +5,7 @@ var/list/weapons = new var/datum/mecha_weapon/selected_weapon operation_req_access = list(access_security) - internals_req_access = list(access_engine) + internals_req_access = list(access_engine,access_robotics) var/force = 25 var/damtype = "brute" var/melee_cooldown = 10 @@ -177,9 +177,9 @@ return -/obj/mecha/combat/check_for_internal_damage(var/list/possible_int_damage) - ..(possible_int_damage) - if(prob(5) && (src.health*100/initial(src.health))The [destr_weapon] is destroyed!") src.log_append_to_last("[destr_weapon] is destoyed.",1) + src.occupant << sound('weapdestr.ogg',volume=50) return /obj/mecha/combat/get_stats_part() diff --git a/code/game/mecha/combat/durand.dm b/code/game/mecha/combat/durand.dm new file mode 100644 index 00000000000..8fd8611a484 --- /dev/null +++ b/code/game/mecha/combat/durand.dm @@ -0,0 +1,63 @@ +/obj/mecha/combat/durand + desc = "Combat exosuit." + name = "Durand" + icon_state = "durand" + step_in = 8 + health = 350 + deflect_chance = 12 + max_temperature = 3000 + infra_luminosity = 8 + operation_req_access = list(access_security) + force = 35 + var/defence = 0 + var/defence_deflect = 30 + wreckage = "/obj/decal/mecha_wreckage/durand" + + +/obj/mecha/combat/durand/New() + ..() + weapons += new /datum/mecha_weapon/ballistic/lmg(src) + weapons += new /datum/mecha_weapon/ballistic/scattershot(src) + selected_weapon = weapons[1] + return + +/obj/mecha/combat/durand/relaymove(mob/user,direction) + if(defence) + src.occupant_message("Unable to move while in defence mode") + return 0 + . = ..() + return + + +/obj/mecha/combat/durand/verb/defence_mode() + set category = "Exosuit Interface" + set name = "Toggle defence mode" + set src in view(0) + if(usr!=src.occupant) + return + defence = !defence + if(defence) + deflect_chance = defence_deflect + src.occupant_message("You enable [src] defence mode.") + else + deflect_chance = initial(deflect_chance) + src.occupant_message("You disable [src] defence mode.") + return + + +/obj/mecha/combat/durand/get_stats_part() + var/output = ..() + output += "Defence mode: [defence?"on":"off"]" + return output + +/obj/mecha/combat/durand/get_commands() + var/output = {"Toggle defence mode
+ "} + output += ..() + return output + +/obj/mecha/combat/durand/Topic(href, href_list) + ..() + if (href_list["toggle_defence_mode"]) + src.defence_mode() + return \ No newline at end of file diff --git a/code/game/mecha/combat/gygax.dm b/code/game/mecha/combat/gygax.dm index f0dc628e711..9f71c3e26fd 100644 --- a/code/game/mecha/combat/gygax.dm +++ b/code/game/mecha/combat/gygax.dm @@ -32,7 +32,7 @@ else overload = 1 step_in = min(1, round(step_in/2)) - src.occupant_message(" You enable leg actuators overload.") + src.occupant_message("You enable leg actuators overload.") return diff --git a/code/game/mecha/combat/marauder.dm b/code/game/mecha/combat/marauder.dm index d89f60129ed..5a765c4fce9 100644 --- a/code/game/mecha/combat/marauder.dm +++ b/code/game/mecha/combat/marauder.dm @@ -103,13 +103,15 @@ src.occupant_message("\blue Zoom mode [zoom?"en":"dis"]abled.") if(zoom) src.occupant.client.view = 12 + src.occupant << sound('imag_enh.ogg',volume=50) else src.occupant.client.view = world.view//world.view - default mob view size return /obj/mecha/combat/marauder/go_out() - src.occupant.client.view = world.view + if(src.occupant && src.occupant.client) + src.occupant.client.view = world.view ..() return diff --git a/code/game/mecha/combat/weapons/weapons.dm b/code/game/mecha/combat/weapons/weapons.dm index f4e55438089..647f7ccad16 100644 --- a/code/game/mecha/combat/weapons/weapons.dm +++ b/code/game/mecha/combat/weapons/weapons.dm @@ -39,7 +39,7 @@ -/datum/mecha_weapon/missile_rack +/datum/mecha_weapon/missile_rack //TODO: move missile racks to ballistic class name = "SRM-8 Missile Rack" var/missiles = 8 var/missile_speed = 2 @@ -137,8 +137,7 @@ A.yo = targloc.y - curloc.y A.xo = targloc.x - curloc.x chassis.cell.use(energy_drain) - spawn() - A.process() + A.process() spawn(weapon_cooldown) weapon_ready = 1 chassis.log_message("Fired from [src.name], targeting [target].") @@ -148,7 +147,7 @@ /datum/mecha_weapon/pulse weapon_cooldown = 30 name = "eZ-13 mk2 Heavy pulse rifle" - energy_drain = 60 + energy_drain = 120 fire(target) if(!fire_checks(target)) return @@ -167,8 +166,7 @@ A.xo = targloc.x - curloc.x weapon_ready = 0 chassis.cell.use(energy_drain) - spawn() - A.process() + A.process() spawn(weapon_cooldown) weapon_ready = 1 chassis.log_message("Fired from [src.name], targeting [target].") @@ -303,32 +301,102 @@ return -/* -/datum/mecha_weapon/scattershot - name = "Scuttershot" - var/missiles = 8 - var/missile_speed = 2 - var/missile_range = 30 - var/missile_energy_cost = 1000 - weapon_cooldown = 60 - fire(target) - if(!..() || missiles <=0) return - var/obj/item/missile/M = new /obj/item/missile(chassis.loc) - M.primed = 1 - M.throw_at(target, missile_range, missile_speed) - weapon_ready = 0 - missiles-- - spawn(weapon_cooldown) - weapon_ready = 1 - return +/datum/mecha_weapon/ballistic + name = "General Ballisic Weapon" + var/projectiles + var/projectile_energy_cost + + get_weapon_info() + return "[src.name]\[[src.projectiles]\][(src.projectiles < initial(src.projectiles))?" - Rearm":null]" proc/rearm() - if(missiles < initial(missiles)) - var/missiles_to_add = initial(missiles) - missiles - while(chassis.cell.charge >= missile_energy_cost && missiles_to_add) - missiles++ - missiles_to_add-- - chassis.cell.charge -= missile_energy_cost + if(projectiles < initial(projectiles)) + var/projectiles_to_add = initial(projectiles) - projectiles + while(chassis.cell.charge >= projectile_energy_cost && projectiles_to_add) + projectiles++ + projectiles_to_add-- + chassis.cell.charge -= projectile_energy_cost + chassis.log_message("Rearmed [src.name].") return -*/ + + Topic(href, href_list) + if (href_list["rearm"]) + src.rearm() + return + + +/datum/mecha_weapon/ballistic/scattershot + name = "LBX AC 10 \"Scattershot\"" + weapon_cooldown = 20 + projectiles = 100 + projectile_energy_cost = 25 + var/projectiles_per_shot = 4 + var/deviation = 0.7 + + fire(atom/target) + if(!fire_checks(target) || projectiles <=0) return + var/turf/curloc = get_turf(chassis) + var/turf/targloc = get_turf(target) + if(!curloc || !targloc) return + var/target_x = targloc.x + var/target_y = targloc.y + var/target_z = targloc.z + targloc = null + target = null + for(var/i=1 to min(projectiles, projectiles_per_shot)) + targloc = locate(target_x+GaussRandRound(deviation,1),target_y+GaussRandRound(deviation,1),target_z) + if(!targloc || targloc == curloc) + break + playsound(chassis, 'Gunshot.ogg', 80, 1) + var/obj/bullet/A = new /obj/bullet(curloc) + src.projectiles-- + A.current = curloc + A.yo = targloc.y - curloc.y + A.xo = targloc.x - curloc.x + weapon_ready = 0 + A.process() + spawn(weapon_cooldown) + weapon_ready = 1 + chassis.log_message("Fired from [src.name], targeting [target].") + return + + + +/datum/mecha_weapon/ballistic/lmg + name = "Ultra AC 2" + weapon_cooldown = 10 + projectiles = 300 + projectile_energy_cost = 20 + var/projectiles_per_shot = 3 + var/deviation = 0.3 + + fire(atom/target) + if(!fire_checks(target) || projectiles <=0) return + var/turf/targloc = get_turf(target) + var/target_x = targloc.x + var/target_y = targloc.y + var/target_z = targloc.z + targloc = null + target = null + spawn for(var/i=1 to min(projectiles, projectiles_per_shot)) + if(!chassis) break + var/turf/curloc = get_turf(chassis) + targloc = locate(target_x+GaussRandRound(deviation,1),target_y+GaussRandRound(deviation,1),target_z) + if (!targloc || !curloc) + continue + if (targloc == curloc) + continue + playsound(chassis, 'Gunshot.ogg', 50, 1) + var/obj/bullet/weakbullet/A = new /obj/bullet/weakbullet(curloc) + src.projectiles-- + A.current = curloc + A.yo = targloc.y - curloc.y + A.xo = targloc.x - curloc.x + A.process() + sleep(2) + weapon_ready = 0 + spawn(weapon_cooldown) + weapon_ready = 1 + chassis.log_message("Fired from [src.name], targeting [target].") + return \ No newline at end of file diff --git a/code/game/mecha/construction_datum.dm b/code/game/mecha/construction_datum.dm index a115e306dec..0008c177334 100644 --- a/code/game/mecha/construction_datum.dm +++ b/code/game/mecha/construction_datum.dm @@ -58,11 +58,3 @@ while(null in L) L -= null return - - - - - - - - diff --git a/code/game/mecha/global_iterator.dm b/code/game/mecha/global_iterator.dm index c1f02f376ed..4355e9bc731 100644 --- a/code/game/mecha/global_iterator.dm +++ b/code/game/mecha/global_iterator.dm @@ -80,7 +80,7 @@ Data storage vars: if(!set_process_args(arguments)) return 0 control_switch = 1 - spawn(-1) + spawn() src.main() return 1 diff --git a/code/game/mecha/mech_fabricator.dm b/code/game/mecha/mech_fabricator.dm index b36903b9597..0924b432f5b 100644 --- a/code/game/mecha/mech_fabricator.dm +++ b/code/game/mecha/mech_fabricator.dm @@ -81,13 +81,13 @@ proc/sanity_check() for(var/p in resources) var/index = resources.Find(p) - index = resources.Find(p, index) + index = resources.Find(p, ++index) if(index) //duplicate resource world << "Duplicate resource definition for [src](\ref[src])" return 0 for(var/set_name in part_sets) var/index = part_sets.Find(set_name) - index = part_sets.Find(set_name, index) + index = part_sets.Find(set_name, ++index) if(index) //duplicate part set world << "Duplicate part set definition for [src](\ref[src])" return 0 @@ -245,7 +245,6 @@ src.resources[material] += W.vars[amnt] W.use(1) count++ - flick("mechfab2", src) user << "You insert [count] [name] into the fabricator." src.updateUsrDialog() diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 32064cfb13d..666d48effb4 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -304,7 +304,7 @@ /obj/mecha/bullet_act(flag) var/dam_type - switch(dam_type) + switch(flag) if(PROJECTILE_PULSE) dam_type = "Pulse" if(PROJECTILE_LASER) @@ -329,23 +329,31 @@ damage = 20 if(PROJECTILE_TASER) src.cell.use(500) - else + if(PROJECTILE_WEAKBULLET) + damage = 8 + if(PROJECTILE_BULLET) damage = 10 + if(PROJECTILE_BOLT) + damage = 5 + if(PROJECTILE_DART) + damage = 5 + else + return src.take_damage(damage) src.check_for_internal_damage(list(MECHA_INT_FIRE,MECHA_INT_TEMP_CONTROL,MECHA_INT_TANK_BREACH,MECHA_INT_CONTROL_LOST),ignore_threshold) return /obj/mecha/proc/destroy() var/obj/mecha/mecha = src + var/mob/M = src.occupant + var/turf/T = src.loc + var/wreckage = src.wreckage src = null - var/mob/M - spawn() - if(mecha.occupant) - M = mecha.occupant - explosion(mecha.loc, 0, 0, 1, 3) - if(mecha.wreckage) - new mecha.wreckage(get_turf(mecha)) - del(mecha) + del(mecha) + explosion(T, 0, 0, 1, 3) + spawn(0) + if(wreckage) + new wreckage(T) if(M) if(prob(20)) M.bruteloss += rand(10,20) @@ -354,10 +362,6 @@ M.gib() return -/obj/mecha/emp_act(severity) - cell.charge = 0 - health -= 100 / severity - update_health() /obj/mecha/ex_act(severity) src.log_message("Affected by explosion of severity: [severity].",1) if(prob(src.deflect_chance)) @@ -380,14 +384,17 @@ src.check_for_internal_damage(list(MECHA_INT_FIRE, MECHA_INT_TEMP_CONTROL,MECHA_INT_TANK_BREACH,MECHA_INT_CONTROL_LOST),1) return +//TODO /obj/mecha/blob_act() return /obj/mecha/meteorhit() return ex_act(rand(1,3))//should do for now -/obj/mecha/emp_act() - cell.use(rand(cell.maxcharge/2, cell.maxcharge)) +/obj/mecha/emp_act(severity) + cell.charge -= min(cell.charge, cell.maxcharge/severity) + health -= 100 / severity + update_health() src.check_for_internal_damage(list(MECHA_INT_FIRE,MECHA_INT_TEMP_CONTROL,MECHA_INT_CONTROL_LOST),1) return @@ -567,6 +574,8 @@ src.log_append_to_last("[H] moved in as pilot.") src.icon_state = initial(icon_state) playsound(src, 'windowdoor.ogg', 50, 1) + if(!internal_damage) + src.occupant << sound('nominal.ogg',volume=50) return 1 else return 0 @@ -969,7 +978,7 @@ mecha.internal_damage &= ~MECHA_INT_FIRE mecha.occupant_message("Internal fire extinquished.") if(mecha.air_contents && mecha.air_contents.volume > 0) //heat the air_contents - mecha.air_contents.temperature = min(1500+T0C, mecha.air_contents.temperature+rand(10,15)) + mecha.air_contents.temperature = min(6000+T0C, mecha.air_contents.temperature+rand(10,15)) if(mecha.air_contents.temperature>mecha.max_temperature/2) mecha.take_damage(1,"fire") if(mecha.internal_damage & MECHA_INT_TEMP_CONTROL) //stop the mecha_preserve_temp loop datum diff --git a/code/game/mecha/mecha_construction.dm b/code/game/mecha/mecha_construction.dm index dd8d4e64899..bde336ac004 100644 --- a/code/game/mecha/mecha_construction.dm +++ b/code/game/mecha/mecha_construction.dm @@ -570,11 +570,11 @@
  • Install the central control module (Not included. Use supplied datadisk to create one).
  • Secure the mainboard with a screwdriver.
  • Install the peripherals control module (Not included. Use supplied datadisk to create one).
  • -
  • Secure the mainboard with a screwdriver
  • -
  • Install the internal armor plating (Not included due to Nanotrasen regulations.)
  • +
  • Secure the peripherals control module with a screwdriver
  • +
  • Install the internal armor plating (Not included due to Nanotrasen regulations. Can be made using 5 metal sheets.)
  • Secure the internal armor plating with a wrench
  • Weld the internal armor plating to the chassis
  • -
  • Install the external reinforced armor plating (Not included due to Nanotrasen regulations.)
  • +
  • Install the external reinforced armor plating (Not included due to Nanotrasen regulations. Can be made using 5 reinforced metal sheets.)
  • Secure the external reinforced armor plating with a wrench
  • Weld the external reinforced armor plating to the chassis
  • diff --git a/code/game/mecha/working/working.dm b/code/game/mecha/working/working.dm index d4c75b12f78..a46a856cf47 100644 --- a/code/game/mecha/working/working.dm +++ b/code/game/mecha/working/working.dm @@ -4,8 +4,9 @@ req_access = access_heads var/datum/mecha_tool/selected_tool var/list/tools = new - operation_req_access = list(access_engine) - internals_req_access = list(access_engine) + operation_req_access = list(access_engine,access_robotics) + internals_req_access = list(access_engine,access_robotics) + var/add_req_access = 1 internal_damage_threshold = 70 @@ -25,6 +26,18 @@ var/tool = locate(href_list["select_tool"]) if(tool) src.selected_tool = tool + if (href_list["add_req_access"]) + if(!add_req_access) return + var/access = text2num(href_list["add_req_access"]) + operation_req_access += access + output_access_dialog(locate(href_list["id_card"]),locate(href_list["user"])) + if (href_list["del_req_access"]) + operation_req_access -= text2num(href_list["del_req_access"]) + output_access_dialog(locate(href_list["id_card"]),locate(href_list["user"])) + if (href_list["finish_req_access"]) + add_req_access = 0 + var/mob/user = locate(href_list["user"]) + user << browse(null,"window=exosuit_add_access") return /obj/mecha/working/get_stats_part() @@ -39,9 +52,9 @@ return output -/obj/mecha/working/check_for_internal_damage(var/list/possible_int_damage) - ..(possible_int_damage) - if(prob(5) && (src.health*100/initial(src.health))The [destr_tool] is destroyed!") src.log_append_to_last("[destr_tool] is destroyed.") - return \ No newline at end of file + src.occupant << sound('critdestr.ogg',volume=50) + return + + +/obj/mecha/working/attackby(obj/item/weapon/W as obj, mob/user as mob) + if(add_req_access && (istype(W, /obj/item/weapon/card/id)||istype(W, /obj/item/device/pda))) + var/obj/item/weapon/card/id/id_card + if(istype(W, /obj/item/weapon/card/id)) + id_card = W + else + var/obj/item/device/pda/pda = W + id_card = pda.id + output_access_dialog(id_card, user) + else + return ..() + + +/obj/mecha/working/proc/output_access_dialog(obj/item/weapon/card/id/id_card, mob/user) + if(!id_card || !user) return + var/output = "Following keycodes are present in this system:
    " + for(var/a in operation_req_access) + output += "[get_access_desc(a)] - Delete
    " + output += "
    Following keycodes were detected on portable device:
    " + for(var/a in id_card.access) + if(a in operation_req_access) continue + var/a_name = get_access_desc(a) + if(!a_name) continue + output += "[a_name] - Add
    " + output += "
    Finish" + output += "" + user << browse(output, "window=exosuit_add_access") + onclose(user, "exosuit_add_access") + return diff --git a/code/game/objects/explosion.dm b/code/game/objects/explosion.dm index cd27984e45f..9b314e6b12c 100644 --- a/code/game/objects/explosion.dm +++ b/code/game/objects/explosion.dm @@ -1,14 +1,13 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impact_range, flash_range) if(!epicenter) return spawn(0) - message_admins("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range]) in area [epicenter.loc.name] ") - defer_powernet_rebuild = 1 if (!istype(epicenter, /turf)) epicenter = epicenter.loc return explosion(epicenter, devastation_range, heavy_impact_range, light_impact_range, flash_range) playsound(epicenter.loc, 'explosionfar.ogg', 100, 1, round(devastation_range*2,1) ) playsound(epicenter.loc, "explosion", 100, 1, round(devastation_range,1) ) + message_admins("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range]) in area [epicenter.loc.name] ") if(heavy_impact_range > 1) var/datum/effects/system/explosion/E = new/datum/effects/system/explosion() diff --git a/code/game/objects/weapons.dm b/code/game/objects/weapons.dm index c7a77289300..5b4ef47cbd2 100644 --- a/code/game/objects/weapons.dm +++ b/code/game/objects/weapons.dm @@ -1046,19 +1046,18 @@ return /obj/bullet/proc/process() - if ((!( src.current ) || src.loc == src.current)) - src.current = locate(min(max(src.x + src.xo, 1), world.maxx), min(max(src.y + src.yo, 1), world.maxy), src.z) - if ((src.x == 1 || src.x == world.maxx || src.y == 1 || src.y == world.maxy)) - //SN src = null - del(src) - return - step_towards(src, src.current) - spawn( 1 ) - process() - return + spawn while(src) + if ((!( src.current ) || src.loc == src.current)) + src.current = locate(min(max(src.x + src.xo, 1), world.maxx), min(max(src.y + src.yo, 1), world.maxy), src.z) + if ((src.x == 1 || src.x == world.maxx || src.y == 1 || src.y == world.maxy)) + //SN src = null + del(src) + return + step_towards(src, src.current) + sleep( 1 ) return -/obj/beam/a_laser/Bump(atom/A as mob|obj|turf|area) +/obj/beam/a_laser/Bump(atom/A as mob|obj|turf) spawn(0) if(A) A.bullet_act(PROJECTILE_LASER, src) diff --git a/icons/changelog.html b/icons/changelog.html index cee395058ad..ee066626e61 100644 --- a/icons/changelog.html +++ b/icons/changelog.html @@ -44,6 +44,19 @@ Thanks to: CDK Station devs, GoonStation devs, the original SpaceStation developers and Erikat for the new title image

    Changelog

    +
    12.02.2011, 01.00 GMT, r1021
    + +
    11.02.2011, r1001-1020