mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 19:47:22 +01:00
Changes all .len to length() where applicable (#25174)
* Globals work
* Double access works
* All other things
* Revert "All other things"
This reverts commit 6574442eb6.
* More changes that compile and work
* IT WORKS AAAAAA
* Changes even more .len to length()
* Apply suggestions from code review
* Update code/datums/mind.dm
* Update code/__HELPERS/sorts/InsertSort.dm
Co-authored-by: Deniz <66401072+Oyu07@users.noreply.github.com>
* Update code/__HELPERS/sanitize_values.dm
Co-authored-by: Deniz <66401072+Oyu07@users.noreply.github.com>
---------
Co-authored-by: FunnyMan3595 (Charlie Nolan) <funnyman@google.com>
Co-authored-by: Deniz <66401072+Oyu07@users.noreply.github.com>
This commit is contained in:
co-authored by
Deniz
FunnyMan3595
parent
bdd417ada0
commit
bad8b31afa
@@ -210,7 +210,7 @@
|
||||
/obj/item/gun/proc/can_trigger_gun(mob/living/user)
|
||||
if(!user.can_use_guns(src))
|
||||
return 0
|
||||
if(restricted_species && restricted_species.len && !is_type_in_list(user.dna.species, restricted_species))
|
||||
if(restricted_species && length(restricted_species) && !is_type_in_list(user.dna.species, restricted_species))
|
||||
to_chat(user, "<span class='danger'>[src] is incompatible with your biology!</span>")
|
||||
return 0
|
||||
return 1
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
. = TRUE
|
||||
if(!max_mod_capacity)
|
||||
return
|
||||
if(!modkits.len)
|
||||
if(!length(modkits))
|
||||
to_chat(user, "<span class='notice'>There are no modifications currently installed.</span>")
|
||||
return
|
||||
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
/obj/item/gun/energy/proc/update_ammo_types()
|
||||
var/obj/item/ammo_casing/energy/shot
|
||||
select = clamp(select, 1, length(ammo_type)) // If we decrease ammo types while selecting a removed one, we want to make sure it doesnt try to select an out of bounds index
|
||||
for(var/i = 1, i <= ammo_type.len, i++)
|
||||
for(var/i = 1, i <= length(ammo_type), i++)
|
||||
var/shottype = ammo_type[i]
|
||||
shot = new shottype(src)
|
||||
ammo_type[i] = shot
|
||||
@@ -90,7 +90,7 @@
|
||||
newshot()
|
||||
|
||||
/obj/item/gun/energy/attack_self(mob/living/user as mob)
|
||||
if(ammo_type.len > 1)
|
||||
if(length(ammo_type) > 1)
|
||||
select_fire(user)
|
||||
update_icon()
|
||||
if(ishuman(user)) //This has to be here or else if you toggle modes by clicking the gun in hand
|
||||
@@ -127,7 +127,7 @@
|
||||
|
||||
/obj/item/gun/energy/proc/select_fire(mob/living/user)
|
||||
select++
|
||||
if(select > ammo_type.len)
|
||||
if(select > length(ammo_type))
|
||||
select = 1
|
||||
var/obj/item/ammo_casing/energy/shot = ammo_type[select]
|
||||
fire_sound = shot.fire_sound
|
||||
|
||||
@@ -16,17 +16,17 @@
|
||||
/obj/item/gun/grenadelauncher/examine(mob/user)
|
||||
. = ..()
|
||||
if(get_dist(user, src) <= 2)
|
||||
. += "<span class='notice'>[grenades.len] / [max_grenades] grenades.</span>"
|
||||
. += "<span class='notice'>[length(grenades)] / [max_grenades] grenades.</span>"
|
||||
|
||||
/obj/item/gun/grenadelauncher/attackby(obj/item/I as obj, mob/user as mob, params)
|
||||
if((istype(I, /obj/item/grenade)))
|
||||
if(grenades.len < max_grenades)
|
||||
if(length(grenades) < max_grenades)
|
||||
if(!user.unEquip(I))
|
||||
return
|
||||
I.loc = src
|
||||
grenades += I
|
||||
to_chat(user, "<span class='notice'>You put the grenade in [src].</span>")
|
||||
to_chat(user, "<span class='notice'>[grenades.len] / [max_grenades] grenades.</span>")
|
||||
to_chat(user, "<span class='notice'>[length(grenades)] / [max_grenades] grenades.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>The grenade launcher cannot hold more grenades.</span>")
|
||||
else
|
||||
@@ -36,7 +36,7 @@
|
||||
if(target == user)
|
||||
return
|
||||
|
||||
if(grenades.len)
|
||||
if(length(grenades))
|
||||
fire_grenade(target,user)
|
||||
else
|
||||
to_chat(user, "<span class='danger'>The grenade launcher is empty.</span>")
|
||||
|
||||
@@ -357,7 +357,7 @@
|
||||
return ..()
|
||||
|
||||
/obj/item/gun/projectile/shotgun/automatic/dual_tube/attack_self(mob/living/user)
|
||||
if(!chambered && magazine.contents.len)
|
||||
if(!chambered && length(magazine.contents))
|
||||
pump()
|
||||
else
|
||||
toggle_tube(user)
|
||||
|
||||
@@ -192,7 +192,7 @@
|
||||
/obj/item/ammo_box/magazine/toy/sniper_rounds/update_overlays()
|
||||
. = ..()
|
||||
var/ammo = ammo_count()
|
||||
if(ammo && istype(contents[contents.len], /obj/item/ammo_casing/caseless/foam_dart/sniper/riot))
|
||||
if(ammo && istype(contents[length(contents)], /obj/item/ammo_casing/caseless/foam_dart/sniper/riot))
|
||||
. += ".50mag-r"
|
||||
else if(ammo)
|
||||
. += ".50mag-f"
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
/obj/item/gun/syringe/examine(mob/user)
|
||||
. = ..()
|
||||
var/num_syringes = syringes.len + (chambered.BB ? 1 : 0)
|
||||
var/num_syringes = length(syringes) + (chambered.BB ? 1 : 0)
|
||||
. += "Can hold [max_syringes] syringe\s. Has [num_syringes] syringe\s remaining."
|
||||
|
||||
/obj/item/gun/syringe/attack_self(mob/living/user)
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
return
|
||||
|
||||
/obj/item/gun/throw/proc/get_ammocount(include_loaded = 1)
|
||||
var/count = loaded_projectiles.len
|
||||
var/count = length(loaded_projectiles)
|
||||
if(include_loaded && to_launch)
|
||||
count++
|
||||
return count
|
||||
@@ -63,7 +63,7 @@
|
||||
to_chat(user, "<span class='warning'>You cannot load [I] into [src]!</span>")
|
||||
|
||||
/obj/item/gun/throw/process_chamber()
|
||||
if(!to_launch && loaded_projectiles.len)
|
||||
if(!to_launch && length(loaded_projectiles))
|
||||
to_launch = loaded_projectiles[1]
|
||||
loaded_projectiles -= to_launch
|
||||
return
|
||||
|
||||
@@ -295,7 +295,7 @@
|
||||
var/list/mobs_list = list()
|
||||
for(var/mob/living/L in target_turf)
|
||||
mobs_list += L
|
||||
if(mobs_list.len)
|
||||
if(length(mobs_list))
|
||||
var/mob/living/picked_mob = pick(mobs_list)
|
||||
prehit(picked_mob)
|
||||
picked_mob.bullet_act(src, def_zone)
|
||||
@@ -529,7 +529,7 @@
|
||||
thing.set_light(muzzle_flash_range, muzzle_flash_intensity, muzzle_flash_color_override? muzzle_flash_color_override : color)
|
||||
QDEL_IN(thing, duration)
|
||||
if(impacting && impact_type && duration > 0)
|
||||
var/datum/point_precise/p = beam_segments[beam_segments[beam_segments.len]]
|
||||
var/datum/point_precise/p = beam_segments[beam_segments[length(beam_segments)]]
|
||||
var/atom/movable/thing = new impact_type
|
||||
p.move_atom_to_src(thing)
|
||||
var/matrix/matrix = new
|
||||
|
||||
Reference in New Issue
Block a user