Merge branch 'master' of https://github.com/Citadel-Station-13/Citadel-Station-13 into proc-define-shit

This commit is contained in:
SandPoot
2024-03-08 19:10:22 -03:00
810 changed files with 140372 additions and 5523 deletions
@@ -19,7 +19,7 @@
user.DelayNextAction(considered_action = TRUE, immediate = FALSE)
user.newtonian_move(get_dir(target, user))
update_icon()
return 1
return TRUE
/obj/item/ammo_casing/proc/ready_proj(atom/target, mob/living/user, quiet, zone_override = "", fired_from)
if (!BB)
@@ -52,7 +52,7 @@
/obj/item/ammo_casing/proc/throw_proj(atom/target, turf/targloc, mob/living/user, params, spread)
var/turf/curloc = get_turf(user)
if (!istype(targloc) || !istype(curloc) || !BB)
return 0
return FALSE
var/firing_dir
if(BB.firer)
@@ -68,7 +68,7 @@
BB.preparePixelProjectile(target, user, params, spread)
BB.fire(null, direct_target)
BB = null
return 1
return TRUE
/obj/item/ammo_casing/proc/spread(turf/target, turf/current, distro)
var/dx = abs(target.x - current.x)
@@ -51,12 +51,12 @@
/obj/item/ammo_box/proc/give_round(obj/item/ammo_casing/R, replace_spent = 0)
// Boxes don't have a caliber type, magazines do. Not sure if it's intended or not, but if we fail to find a caliber, then we fall back to ammo_type.
if(!R || (caliber && R.caliber != caliber) || (!caliber && R.type != ammo_type))
return 0
return FALSE
if (stored_ammo.len < max_ammo)
stored_ammo += R
R.forceMove(src)
return 1
return TRUE
//for accessibles magazines (e.g internal ones) when full, start replacing spent ammo
else if(replace_spent)
@@ -67,12 +67,12 @@
stored_ammo += R
R.forceMove(src)
return 1
return TRUE
return 0
return FALSE
/obj/item/ammo_box/proc/can_load(mob/user)
return 1
return TRUE
/obj/item/ammo_box/attackby(obj/item/A, mob/user, params, silent = FALSE, replace_spent = 0)
var/num_loaded = 0
+6 -6
View File
@@ -137,12 +137,12 @@
burst_size = 1
sortList(fire_select_modes, GLOBAL_PROC_REF(cmp_numeric_asc))
sort_list(fire_select_modes, GLOBAL_PROC_REF(cmp_numeric_asc))
if(fire_select_modes.len > 1)
firemode_action = new(src)
firemode_action.button_icon_state = "fireselect_[fire_select]"
firemode_action.UpdateButtonIcon()
firemode_action.UpdateButtons()
/obj/item/gun/ComponentInitialize()
. = ..()
@@ -219,7 +219,7 @@
playsound(user, 'sound/weapons/empty.ogg', 100, TRUE)
update_appearance()
firemode_action.button_icon_state = "fireselect_[fire_select]"
firemode_action.UpdateButtonIcon()
firemode_action.UpdateButtons()
return TRUE
/obj/item/gun/equipped(mob/living/user, slot)
@@ -670,7 +670,7 @@
update_icon()
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
A.UpdateButtons()
/obj/item/gun/update_overlays()
. = ..()
@@ -756,7 +756,7 @@
/datum/action/item_action/toggle_scope_zoom/IsAvailable(silent = FALSE)
. = ..()
if(!.)
if(!. && owner)
var/obj/item/gun/G = target
G.zoom(owner, owner.dir, FALSE)
@@ -807,7 +807,7 @@
return ..()
/obj/item/gun/proc/getinaccuracy(mob/living/user, bonus_spread, stamloss)
return 0 // Replacement TBD: Exponential curved aim instability system.
return FALSE // Replacement TBD: Exponential curved aim instability system.
/*
if(inaccuracy_modifier == 0)
+5 -5
View File
@@ -48,8 +48,8 @@
/obj/item/gun/ballistic/can_shoot()
if(!magazine || !magazine.ammo_count(0))
return 0
return 1
return FALSE
return TRUE
/obj/item/gun/ballistic/attackby(obj/item/A, mob/user, params)
..()
@@ -68,7 +68,7 @@
playsound(src, "gun_insert_empty_magazine", 70, 1)
A.update_icon()
update_icon()
return 1
return TRUE
else
to_chat(user, "<span class='warning'>You cannot seem to get \the [src] out of your hands!</span>")
return
@@ -89,7 +89,7 @@
to_chat(user, "<span class='notice'>You screw [S] onto [src].</span>")
install_suppressor(A)
return
return 0
return FALSE
/obj/item/gun/ballistic/proc/install_suppressor(obj/item/suppressor/S)
// this proc assumes that the suppressor is already inside src
@@ -205,7 +205,7 @@
slot_flags |= ITEM_SLOT_BELT //but you can wear it on your belt (poorly concealed under a trenchcoat, ideally)
sawn_off = TRUE
update_icon()
return 1
return TRUE
/// is something supposed to happen here?
/obj/item/gun/ballistic/proc/on_sawoff(mob/user)
@@ -52,7 +52,7 @@
chamber_round()
A.update_icon()
update_icon()
return 1
return TRUE
else
to_chat(user, "<span class='warning'>You cannot seem to get \the [src] out of your hands!</span>")
@@ -37,13 +37,13 @@
/obj/item/gun/ballistic/automatic/magrifle/can_shoot()
if(QDELETED(cell))
return 0
return FALSE
var/obj/item/ammo_casing/caseless/magnetic/shot = chambered
if(!shot)
return 0
return FALSE
if(cell.charge < shot.energy_cost * burst_size)
return 0
return FALSE
. = ..()
/obj/item/gun/ballistic/automatic/magrifle/shoot_live_shot(mob/living/user, pointblank = FALSE, mob/pbtarget, message = 1, stam_cost = 0)
@@ -37,7 +37,7 @@
/obj/item/gun/ballistic/shotgun/can_shoot()
if(!chambered)
return 0
return FALSE
return (chambered.BB ? 1 : 0)
/obj/item/gun/ballistic/shotgun/attack_self(mob/living/user)
@@ -67,7 +67,7 @@
pump_unload(M)
pump_reload(M)
update_icon() //I.E. fix the desc
return 1
return TRUE
/obj/item/gun/ballistic/shotgun/proc/pump_unload(mob/M)
if(chambered)//We have a shell in the chamber
@@ -77,7 +77,7 @@
/obj/item/gun/ballistic/shotgun/proc/pump_reload(mob/M)
if(!magazine.ammo_count())
return 0
return FALSE
var/obj/item/ammo_casing/AC = magazine.get_round() //load next casing.
chambered = AC
@@ -147,7 +147,7 @@
pump_unload(M)
bolt_open = !bolt_open
update_icon() //I.E. fix the desc
return 1
return TRUE
/obj/item/gun/ballistic/shotgun/boltaction/attackby(obj/item/A, mob/user, params)
if(!bolt_open)
@@ -57,25 +57,24 @@
. = ..()
if(max_mod_capacity)
. += "<b>[get_remaining_mod_capacity()]%</b> mod capacity remaining."
for(var/A in get_modkits())
var/obj/item/borg/upgrade/modkit/M = A
for(var/obj/item/borg/upgrade/modkit/M in modkits)
. += "<span class='notice'>There is \a [M] installed, using <b>[M.cost]%</b> capacity.</span>"
/obj/item/gun/energy/kinetic_accelerator/crowbar_act(mob/living/user, obj/item/I)
. = TRUE
if(modkits.len)
to_chat(user, "<span class='notice'>You pry the modifications out.</span>")
to_chat(user, span_notice("You pry all the modifications out."))
I.play_tool_sound(src, 100)
for(var/obj/item/borg/upgrade/modkit/M in modkits)
M.uninstall(src)
M.forceMove(drop_location()) //uninstallation handled in Exited(), or /mob/living/silicon/robot/remove_from_upgrades() for borgs
else
to_chat(user, "<span class='notice'>There are no modifications currently installed.</span>")
to_chat(user, span_notice("There are no modifications currently installed."))
/obj/item/gun/energy/kinetic_accelerator/Exited(atom/movable/AM)
. = ..()
if((AM in modkits) && istype(AM, /obj/item/borg/upgrade/modkit))
var/obj/item/borg/upgrade/modkit/M = AM
M.uninstall(src, FALSE)
/obj/item/gun/energy/kinetic_accelerator/Exited(atom/movable/gone)
if(gone in modkits)
var/obj/item/borg/upgrade/modkit/MK = gone
MK.uninstall(src)
return ..()
/obj/item/gun/energy/kinetic_accelerator/attackby(obj/item/I, mob/user)
if(istype(I, /obj/item/borg/upgrade/modkit))
@@ -86,20 +85,13 @@
/obj/item/gun/energy/kinetic_accelerator/proc/get_remaining_mod_capacity()
var/current_capacity_used = 0
for(var/A in get_modkits())
var/obj/item/borg/upgrade/modkit/M = A
for(var/obj/item/borg/upgrade/modkit/M in modkits)
current_capacity_used += M.cost
return max_mod_capacity - current_capacity_used
/obj/item/gun/energy/kinetic_accelerator/proc/get_modkits()
. = list()
for(var/A in modkits)
. += A
/obj/item/gun/energy/kinetic_accelerator/proc/modify_projectile(obj/item/projectile/kinetic/K)
K.kinetic_gun = src //do something special on-hit, easy!
for(var/A in get_modkits())
var/obj/item/borg/upgrade/modkit/M = A
for(var/obj/item/borg/upgrade/modkit/M in modkits)
M.modify_projectile(K)
/obj/item/gun/energy/kinetic_accelerator/cyborg
@@ -211,7 +203,7 @@
/obj/item/gun/energy/kinetic_accelerator/getstamcost(mob/living/carbon/user)
if(user && !lavaland_equipment_pressure_check(get_turf(user)))
return 0
return FALSE
else
return ..()
@@ -259,7 +251,7 @@
if(!target_turf)
target_turf = get_turf(src)
if(kinetic_gun) //hopefully whoever shot this was not very, very unfortunate.
var/list/mods = kinetic_gun.get_modkits()
var/list/mods = kinetic_gun.modkits
for(var/obj/item/borg/upgrade/modkit/M in mods)
M.projectile_strike_predamage(src, target_turf, target, kinetic_gun)
for(var/obj/item/borg/upgrade/modkit/M in mods)
@@ -278,7 +270,7 @@
icon = 'icons/obj/objects.dmi'
icon_state = "modkit"
w_class = WEIGHT_CLASS_SMALL
require_module = 1
require_module = TRUE
module_type = list(/obj/item/robot_module/miner)
module_flags = BORG_MODULE_MINER
var/denied_type = null
@@ -298,26 +290,24 @@
else
..()
/obj/item/borg/upgrade/modkit/afterInstall(mob/living/silicon/robot/R)
for(var/obj/item/gun/energy/kinetic_accelerator/H in R.module.modules)
if(install(H, R)) //It worked
return
to_chat(R, "<span class='alert'>Upgrade error - Aborting Kinetic Accelerator linking.</span>") //No applicable KA found, insufficient capacity, or some other problem.
/obj/item/borg/upgrade/modkit/action(mob/living/silicon/robot/R)
. = ..()
if (.)
for(var/obj/item/gun/energy/kinetic_accelerator/H in R.module.modules)
return install(H, usr, FALSE)
/obj/item/borg/upgrade/modkit/proc/install(obj/item/gun/energy/kinetic_accelerator/KA, mob/user)
/obj/item/borg/upgrade/modkit/proc/install(obj/item/gun/energy/kinetic_accelerator/KA, mob/user, transfer_to_loc = TRUE)
. = TRUE
if(src in KA.modkits) // Sanity check to prevent installing the same modkit twice thanks to occasional click/lag delays.
return FALSE
if(minebot_upgrade)
if(minebot_exclusive && !istype(KA.loc, /mob/living/simple_animal/hostile/mining_drone))
to_chat(user, "<span class='notice'>The modkit you're trying to install is only rated for minebot use.</span>")
to_chat(user, span_notice("The modkit you're trying to install is only rated for minebot use."))
return FALSE
else if(istype(KA.loc, /mob/living/simple_animal/hostile/mining_drone))
to_chat(user, "<span class='notice'>The modkit you're trying to install is not rated for minebot use.</span>")
to_chat(user, span_notice("The modkit you're trying to install is not rated for minebot use."))
return FALSE
if(denied_type)
var/number_of_denied = 0
for(var/A in KA.get_modkits())
for(var/A in KA.modkits)
var/obj/item/borg/upgrade/modkit/M = A
if(istype(M, denied_type))
number_of_denied++
@@ -326,21 +316,25 @@
break
if(KA.get_remaining_mod_capacity() >= cost)
if(.)
if(!user.transferItemToLoc(src, KA))
return FALSE
to_chat(user, "<span class='notice'>You install the modkit.</span>")
playsound(loc, 'sound/items/screwdriver.ogg', 100, 1)
if(transfer_to_loc && !user.transferItemToLoc(src, KA))
return
to_chat(user, span_notice("You install the modkit."))
playsound(loc, 'sound/items/screwdriver.ogg', 100, TRUE)
KA.modkits += src
else
to_chat(user, "<span class='notice'>The modkit you're trying to install would conflict with an already installed modkit. Use a crowbar to remove existing modkits.</span>")
to_chat(user, span_notice("The modkit you're trying to install would conflict with an already installed modkit. Use a crowbar to remove existing modkits."))
else
to_chat(user, "<span class='notice'>You don't have room(<b>[KA.get_remaining_mod_capacity()]%</b> remaining, [cost]% needed) to install this modkit. Use a crowbar to remove existing modkits.</span>")
to_chat(user, span_notice("You don't have room(<b>[KA.get_remaining_mod_capacity()]%</b> remaining, [cost]% needed) to install this modkit. Use a crowbar to remove existing modkits."))
. = FALSE
/obj/item/borg/upgrade/modkit/proc/uninstall(obj/item/gun/energy/kinetic_accelerator/KA, forcemove = TRUE)
/obj/item/borg/upgrade/modkit/deactivate(mob/living/silicon/robot/R, user = usr)
. = ..()
if (.)
for(var/obj/item/gun/energy/kinetic_accelerator/KA in R.module.modules)
uninstall(KA)
/obj/item/borg/upgrade/modkit/proc/uninstall(obj/item/gun/energy/kinetic_accelerator/KA)
KA.modkits -= src
if(forcemove)
forceMove(get_turf(KA))
/obj/item/borg/upgrade/modkit/proc/modify_projectile(obj/item/projectile/kinetic/K)
@@ -467,6 +461,7 @@
/obj/item/borg/upgrade/modkit/minebot_passthrough
name = "minebot passthrough"
desc = "Causes kinetic accelerator shots to pass through minebots."
denied_type = /obj/item/borg/upgrade/modkit/minebot_passthrough // If you have something cost zero, you can keep adding forever, why
cost = 0
//Tendril-unique modules
+2 -2
View File
@@ -66,12 +66,12 @@
/obj/item/gun/magic/process()
charge_tick++
if(charge_tick < recharge_rate || charges >= max_charges)
return 0
return FALSE
charge_tick = 0
charges++
if(charges == 1)
recharge_newshot()
return 1
return TRUE
/obj/item/gun/magic/shoot_with_empty_chamber(mob/living/user as mob|obj)
to_chat(user, "<span class='warning'>The [name] whizzles quietly.</span>")
@@ -200,7 +200,9 @@
else
P.color = rgb(0, 255, 0)
var/turf/curloc = get_turf(src)
var/turf/targloc = get_turf(current_user.client.mouseObject)
var/atom/target_atom = current_user.client.mouse_object_ref?.resolve()
var/turf/targloc = get_turf(target_atom)
if(!istype(targloc))
if(!istype(curloc))
return
@@ -293,7 +295,9 @@
process_aim()
if(fire_check() && can_trigger_gun(M))
sync_ammo()
do_fire(M.client.mouseObject, M, FALSE, M.client.mouseParams, M.zone_selected)
var/atom/target = M.client.mouse_object_ref?.resolve()
if(target)
afterattack(target, M, FALSE, M.client.mouseParams)
stop_aiming()
QDEL_LIST(current_tracers)
return ..()
@@ -469,7 +473,7 @@
return 0.5
if(istype(target, /obj/structure/blob))
return 0.65 //CIT CHANGE.
return 1
return TRUE
/obj/item/projectile/beam/beam_rifle/proc/handle_impact(atom/target)
if(isobj(target))
@@ -72,20 +72,20 @@
//returns the third value of a bomb blast
/obj/item/gun/blastcannon/proc/calculate_bomb()
if(!istype(bomb) || !istype(bomb.tank_one) || !istype(bomb.tank_two))
return 0
return FALSE
var/datum/gas_mixture/temp = new(max(reaction_volume_mod, 0))
bomb.merge_gases(temp)
if(prereaction)
temp.react(src)
var/prereaction_pressure = temp.return_pressure()
if(prereaction_pressure < TANK_FRAGMENT_PRESSURE)
return 0
return FALSE
for(var/i in 1 to reaction_cycles)
temp.react(src)
var/pressure = temp.return_pressure()
qdel(temp)
if(pressure < TANK_FRAGMENT_PRESSURE)
return 0
return FALSE
return ((pressure - TANK_FRAGMENT_PRESSURE) / TANK_FRAGMENT_SCALE)
/obj/item/gun/blastcannon/afterattack(atom/target, mob/user, flag, params)
@@ -87,7 +87,7 @@
if(mounted)
user_turf = get_turf(user)
else if(!istype(user_turf))
return 0
return FALSE
var/obj/dummy = new(user_turf)
dummy.pass_flags |= PASSTABLE|PASSGLASS|PASSGRILLE //Grille/Glass so it can be used through common windows
for(var/turf/turf in getline(user_turf,target))
@@ -95,18 +95,18 @@
continue //Mechs are dense and thus fail the check
if(turf.density)
qdel(dummy)
return 0
return FALSE
for(var/atom/movable/AM in turf)
if(!AM.CanPass(dummy,turf,1))
qdel(dummy)
return 0
return FALSE
for(var/obj/effect/ebeam/medical/B in turf)// Don't cross the str-beams!
if(B.owner.origin != current_beam.origin)
explosion(B.loc,0,3,5,8)
qdel(dummy)
return 0
return FALSE
qdel(dummy)
return 1
return TRUE
/obj/item/gun/medbeam/proc/on_beam_hit(var/mob/living/target)
return
@@ -38,18 +38,18 @@
/obj/item/gun/syringe/attack_self(mob/living/user)
if(!syringes.len)
to_chat(user, "<span class='warning'>[src] is empty!</span>")
return 0
return FALSE
var/obj/item/reagent_containers/syringe/S = syringes[syringes.len]
if(!S)
return 0
return FALSE
S.forceMove(user.loc)
syringes.Remove(S)
to_chat(user, "<span class='notice'>You unload [S] from \the [src].</span>")
return 1
return TRUE
/obj/item/gun/syringe/attackby(obj/item/A, mob/user, params, show_msg = TRUE)
if(istype(A, /obj/item/reagent_containers/syringe))
+3 -5
View File
@@ -939,12 +939,10 @@
var/y = text2num(screen_loc_Y[1]) * 32 + text2num(screen_loc_Y[2]) - 32
//Calculate the "resolution" of screen based on client's view and world's icon size. This will work if the user can view more tiles than average.
var/list/screenview = getviewsize(user.client.view)
var/screenviewX = screenview[1] * world.icon_size
var/screenviewY = screenview[2] * world.icon_size
var/list/screenview = view_to_pixels(user.client.view)
var/ox = round(screenviewX/2) - user.client.pixel_x //"origin" x
var/oy = round(screenviewY/2) - user.client.pixel_y //"origin" y
var/ox = round(screenview[1] / 2) - user.client.pixel_x //"origin" x
var/oy = round(screenview[2] / 2) - user.client.pixel_y //"origin" y
angle = arctan(y - oy, x - ox)
return list(angle, p_x, p_y)