Code optimizations + clean-up (#45)

This commit is contained in:
SandPoot
2020-08-14 02:01:54 -03:00
committed by GitHub
parent 88a63bfa03
commit fe8119c18c
21 changed files with 90 additions and 601 deletions
+2 -2
View File
@@ -18,5 +18,5 @@
key = "blep"
key_third_person = "bleps"
message = "bleps!"
emote_type = EMOTE_AUDIBLE | EMOTE_VISIBLE
mob_type_allowed_typecache = list(/mob/living/carbon)
emote_type = EMOTE_VISIBLE
mob_type_allowed_typecache = list(/mob/living)
@@ -10,4 +10,6 @@
actions_types = list()
icon = 'sandcode/icons/obj/guns/projectile.dmi'
spawnwithmagazine = FALSE
var/can_supress = FALSE
var/can_supress = FALSE
//Note for the future, i didn't know this gun already existed in the code, may be deleted eventually.
@@ -5,8 +5,13 @@
/obj/item/organ/cyberimp/arm/toolset/advanced
name = "advanced integrated toolset implant"
desc = "A very advanced version of the regular toolset implant, has alien stuff!"
contents = newlist(/obj/item/screwdriver/abductor, /obj/item/wrench/abductor, /obj/item/weldingtool/abductor,
/obj/item/crowbar/abductor, /obj/item/wirecutters/abductor, /obj/item/multitool/abductor, /obj/item/analyzer)
contents = newlist(/obj/item/screwdriver/abductor,
/obj/item/wrench/abductor,
/obj/item/weldingtool/abductor,
/obj/item/crowbar/abductor,
/obj/item/wirecutters/abductor,
/obj/item/multitool/abductor,
/obj/item/analyzer/ranged)
/obj/item/organ/cyberimp/arm/toolset/advanced/emag_act()
. = ..()
@@ -18,9 +23,15 @@
return TRUE
/obj/item/organ/cyberimp/arm/surgery/advanced
name = "advanced surgical toolset implant"
name = "advanced integrated surgical implant"
desc = "A very advanced version of the regular surgical implant, has alien stuff!"
contents = newlist(/obj/item/retractor/alien, /obj/item/hemostat/alien, /obj/item/cautery/alien, /obj/item/surgicaldrill/alien, /obj/item/scalpel/alien, /obj/item/circular_saw/alien, /obj/item/surgical_drapes)
contents = newlist(/obj/item/retractor/alien,
/obj/item/hemostat/alien,
/obj/item/cautery/alien,
/obj/item/surgicaldrill/alien,
/obj/item/scalpel/alien,
/obj/item/circular_saw/alien,
/obj/item/surgical_drapes)
/obj/item/organ/cyberimp/arm/surgery/emag_act()
. = ..()
+2 -2
View File
@@ -30,7 +30,7 @@
var/distance = time * power_x
var/dest_x = src_x + distance*sin(rotation); //You can never accurately predict where it lands, at all.
var/dest_y = src_y + distance*cos(rotation); //Telethievery has now been killed, thank me later.
var/dest_x = src_x + distance*sin(rotation);
var/dest_y = src_y + distance*cos(rotation);
return new /datum/projectile_data(src_x, src_y, time, distance, power_x, power_y, dest_x, dest_y)
@@ -14,9 +14,7 @@
var/z_co = 1
var/power_off
var/rotation_off
var/angle_off
var/offsety
var/offsetx
//var/angle_off
var/last_target
var/in_use
@@ -45,8 +43,8 @@
return ..()
/obj/machinery/computer/telescience/examine(mob/user)
..()
to_chat(user, "There are [crystals.len ? crystals.len : "no"] bluespace crystal\s in the crystal slots.")
. = ..()
. += "<span class='notice'>There are [crystals.len ? crystals.len : "no"] bluespace crystal\s in the crystal slots.</span>"
/obj/machinery/computer/telescience/Initialize(mapload)
. = ..()
@@ -163,15 +161,13 @@
var/truePower = clamp(power + power_off, 1, 1000)
var/trueRotation = rotation + rotation_off
var/trueAngle = clamp(angle + angle_off, 1, 90)
var/trueoffsetx = offsetx + rand(-1,1) // Where will you land?
var/trueoffsety = offsety + rand(-1,1) // You never TRULY know. There are 9 possibilities, IF you calculated the offsetx and offsety.
var/trueAngle = clamp(angle, 1, 90)
var/datum/projectile_data/proj_data = projectile_trajectory(telepad.x, telepad.y, trueRotation, trueAngle, truePower)
last_tele_data = proj_data
var/trueX = clamp(round(proj_data.dest_x + trueoffsetx, 1), 1, world.maxx)
var/trueY = clamp(round(proj_data.dest_y + trueoffsety, 1), 1, world.maxy)
var/trueX = clamp(round(proj_data.dest_x, 1), 1, world.maxx)
var/trueY = clamp(round(proj_data.dest_y, 1), 1, world.maxy)
var/spawn_time = round(proj_data.time) * 10
var/turf/target = locate(trueX, trueY, z_co)
@@ -353,9 +349,7 @@
updateDialog()
/obj/machinery/computer/telescience/proc/recalibrate()
teles_left = rand(10, 30)
angle_off = rand(-15, 15)
teles_left = rand(30, 40)
//angle_off = rand(-25, 25)
power_off = rand(-4, 0)
rotation_off = rand(-10, 10)
offsetx = rand(0, 7)
offsety = rand(0, 7)