mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 23:27:34 +01:00
Lazylists some /mob and /living stuff (#52750)
* lazy * Apply suggestions from code review Co-authored-by: Rohesie <rohesie@gmail.com> Co-authored-by: TiviPlus <TiviPlus> Co-authored-by: Rohesie <rohesie@gmail.com>
This commit is contained in:
co-authored by
Rohesie
TiviPlus <TiviPlus>
parent
923c0529eb
commit
8d72c64910
@@ -64,7 +64,7 @@
|
||||
break
|
||||
bitflag *= 2
|
||||
|
||||
M.actions += src
|
||||
LAZYADD(M.actions, src)
|
||||
if(M.client)
|
||||
M.client.screen += button
|
||||
button.locked = M.client.prefs.buttons_locked || button.id ? M.client.prefs.action_buttons_screen_locs["[name]_[button.id]"] : FALSE //even if it's not defaultly locked we should remember we locked it before
|
||||
@@ -77,7 +77,7 @@
|
||||
if(M)
|
||||
if(M.client)
|
||||
M.client.screen -= button
|
||||
M.actions -= src
|
||||
LAZYREMOVE(M.actions, src)
|
||||
M.update_action_buttons()
|
||||
owner = null
|
||||
button.moved = FALSE //so the button appears in its normal position when given to another owner.
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
//add the disease with no checks
|
||||
/datum/disease/proc/infect(var/mob/living/infectee, make_copy = TRUE)
|
||||
var/datum/disease/D = make_copy ? Copy() : src
|
||||
infectee.diseases += D
|
||||
LAZYADD(infectee.diseases, D)
|
||||
D.affected_mob = infectee
|
||||
SSdisease.active_diseases += D //Add it to the active diseases list, now that it's actually in a mob and being processed.
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
/datum/disease/proc/cure(add_resistance = TRUE)
|
||||
if(affected_mob)
|
||||
if(add_resistance && (disease_flags & CAN_RESIST))
|
||||
affected_mob.disease_resistances |= GetDiseaseID()
|
||||
LAZYOR(affected_mob.disease_resistances, GetDiseaseID())
|
||||
qdel(src)
|
||||
|
||||
/datum/disease/proc/IsSame(datum/disease/D)
|
||||
@@ -166,7 +166,7 @@
|
||||
return "[type]"
|
||||
|
||||
/datum/disease/proc/remove_disease()
|
||||
affected_mob.diseases -= src //remove the datum from the list
|
||||
LAZYREMOVE(affected_mob.diseases, src) //remove the datum from the list
|
||||
affected_mob.med_hud_set_status()
|
||||
affected_mob = null
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
if(prob(1))
|
||||
to_chat(affected_mob, "<span class='danger'>Mucous runs down the back of your throat.</span>")
|
||||
if(prob(1) && prob(50))
|
||||
if(!affected_mob.disease_resistances.Find(/datum/disease/flu))
|
||||
if(!LAZYFIND(affected_mob.disease_resistances, /datum/disease/flu))
|
||||
var/datum/disease/Flu = new /datum/disease/flu()
|
||||
affected_mob.ForceContractDisease(Flu, FALSE, TRUE)
|
||||
cure()
|
||||
|
||||
@@ -267,12 +267,12 @@
|
||||
/obj/item/borg/upgrade/lavaproof/action(mob/living/silicon/robot/R, user = usr)
|
||||
. = ..()
|
||||
if(.)
|
||||
R.weather_immunities += "lava"
|
||||
LAZYADD(R.weather_immunities, "lava")
|
||||
|
||||
/obj/item/borg/upgrade/lavaproof/deactivate(mob/living/silicon/robot/R, user = usr)
|
||||
. = ..()
|
||||
if (.)
|
||||
R.weather_immunities -= "lava"
|
||||
LAZYREMOVE(R.weather_immunities, "lava")
|
||||
|
||||
/obj/item/borg/upgrade/selfrepair
|
||||
name = "self-repair module"
|
||||
|
||||
@@ -932,7 +932,7 @@
|
||||
user.mind.AddSpell(D)
|
||||
if(4)
|
||||
to_chat(user, "<span class='danger'>You feel like you could walk straight through lava now.</span>")
|
||||
H.weather_immunities |= "lava"
|
||||
LAZYOR(H.weather_immunities, "lava")
|
||||
|
||||
playsound(user.loc,'sound/items/drink.ogg', rand(10,50), TRUE)
|
||||
qdel(src)
|
||||
|
||||
@@ -171,7 +171,7 @@
|
||||
blood_data["viruses"] += D.Copy()
|
||||
|
||||
blood_data["blood_DNA"] = dna.unique_enzymes
|
||||
if(disease_resistances && disease_resistances.len)
|
||||
if(LAZYLEN(disease_resistances))
|
||||
blood_data["resistances"] = disease_resistances.Copy()
|
||||
var/list/temp_chem = list()
|
||||
for(var/datum/reagent/R in reagents.reagent_list)
|
||||
|
||||
@@ -45,13 +45,13 @@
|
||||
|
||||
else //Maybe uses plasma in the future, although that wouldn't make any sense...
|
||||
leaping = 1
|
||||
weather_immunities += "lava"
|
||||
LAZYADD(weather_immunities,"lava")
|
||||
update_icons()
|
||||
throw_at(A, MAX_ALIEN_LEAP_DIST, 1, src, FALSE, TRUE, callback = CALLBACK(src, .proc/leap_end))
|
||||
|
||||
/mob/living/carbon/alien/humanoid/hunter/proc/leap_end()
|
||||
leaping = 0
|
||||
weather_immunities -= "lava"
|
||||
LAZYREMOVE(weather_immunities, "lava")
|
||||
update_icons()
|
||||
|
||||
/mob/living/carbon/alien/humanoid/hunter/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum)
|
||||
|
||||
@@ -223,11 +223,11 @@
|
||||
|
||||
/datum/species/golem/titanium/on_species_gain(mob/living/carbon/C, datum/species/old_species)
|
||||
. = ..()
|
||||
C.weather_immunities |= "ash"
|
||||
LAZYOR(C.weather_immunities, "ash")
|
||||
|
||||
/datum/species/golem/titanium/on_species_loss(mob/living/carbon/C)
|
||||
. = ..()
|
||||
C.weather_immunities -= "ash"
|
||||
LAZYREMOVE(C.weather_immunities, "ash")
|
||||
|
||||
//Immune to ash storms and lava
|
||||
/datum/species/golem/plastitanium
|
||||
@@ -242,13 +242,13 @@
|
||||
|
||||
/datum/species/golem/plastitanium/on_species_gain(mob/living/carbon/C, datum/species/old_species)
|
||||
. = ..()
|
||||
C.weather_immunities |= "lava"
|
||||
C.weather_immunities |= "ash"
|
||||
LAZYOR(C.weather_immunities, "lava")
|
||||
LAZYOR(C.weather_immunities, "ash")
|
||||
|
||||
/datum/species/golem/plastitanium/on_species_loss(mob/living/carbon/C)
|
||||
. = ..()
|
||||
C.weather_immunities -= "ash"
|
||||
C.weather_immunities -= "lava"
|
||||
LAZYREMOVE(C.weather_immunities, "ash")
|
||||
LAZYREMOVE(C.weather_immunities, "lava")
|
||||
|
||||
//Fast and regenerates... but can only speak like an abductor
|
||||
/datum/species/golem/alloy
|
||||
@@ -1034,7 +1034,7 @@
|
||||
|
||||
/datum/species/golem/snow/on_species_gain(mob/living/carbon/C, datum/species/old_species)
|
||||
. = ..()
|
||||
C.weather_immunities |= "snow"
|
||||
LAZYOR(C.weather_immunities, "snow")
|
||||
ball = new
|
||||
ball.charge_counter = 0
|
||||
C.AddSpell(ball)
|
||||
@@ -1044,7 +1044,7 @@
|
||||
|
||||
/datum/species/golem/snow/on_species_loss(mob/living/carbon/C)
|
||||
. = ..()
|
||||
C.weather_immunities -= "snow"
|
||||
LAZYREMOVE(C.weather_immunities, "snow")
|
||||
if(ball)
|
||||
C.RemoveSpell(ball)
|
||||
if(cryo)
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
|
||||
var/hellbound = 0 ///People who've signed infernal contracts are unrevivable.
|
||||
|
||||
var/list/weather_immunities = list()
|
||||
var/list/weather_immunities
|
||||
|
||||
var/stun_absorption = null ///converted to a list of stun absorption sources this mob has when one is added
|
||||
|
||||
@@ -120,8 +120,8 @@
|
||||
var/losebreath = 0
|
||||
|
||||
//List of active diseases
|
||||
var/list/diseases = list() /// list of all diseases in a mob
|
||||
var/list/disease_resistances = list()
|
||||
var/list/diseases /// list of all diseases in a mob
|
||||
var/list/disease_resistances
|
||||
|
||||
var/slowed_by_drag = TRUE ///Whether the mob is slowed down when dragging another prone mob
|
||||
|
||||
|
||||
+4
-4
@@ -246,7 +246,7 @@
|
||||
/obj/item/crusher_trophy/broodmother_tongue/on_mark_detonation(mob/living/target, mob/living/user)
|
||||
if(rand(1, 100) <= bonus_value && target.stat != DEAD)
|
||||
new /obj/effect/temp_visual/goliath_tentacle/broodmother/patch(get_turf(target), user)
|
||||
|
||||
|
||||
/obj/item/crusher_trophy/broodmother_tongue/attack_self(mob/user)
|
||||
if(!isliving(user))
|
||||
return
|
||||
@@ -257,10 +257,10 @@
|
||||
else if("lava" in living_user.weather_immunities)
|
||||
to_chat(living_user, "<b>You stare at the tongue. You don't think this is any use to you.</b>")
|
||||
return
|
||||
living_user.weather_immunities |= "lava"
|
||||
LAZYOR(living_user.weather_immunities, "lava")
|
||||
to_chat(living_user, "<b>You squeeze the tongue, and some transluscent liquid shoots out all over you.</b>")
|
||||
addtimer(CALLBACK(src, .proc/remove_lavaproofing, living_user), 10 SECONDS)
|
||||
use_time = world.time + 60 SECONDS
|
||||
|
||||
|
||||
/obj/item/crusher_trophy/broodmother_tongue/proc/remove_lavaproofing(mob/living/user)
|
||||
user.weather_immunities -= "lava"
|
||||
LAZYREMOVE(user.weather_immunities, "lava")
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
/mob/living/simple_animal/hostile/statue/Initialize(mapload, mob/living/creator)
|
||||
. = ..()
|
||||
// Give spells
|
||||
LAZYINITLIST(mob_spell_list)
|
||||
mob_spell_list += new /obj/effect/proc_holder/spell/aoe_turf/flicker_lights(src)
|
||||
mob_spell_list += new /obj/effect/proc_holder/spell/aoe_turf/blindness(src)
|
||||
mob_spell_list += new /obj/effect/proc_holder/spell/targeted/night_vision(src)
|
||||
|
||||
@@ -1000,7 +1000,7 @@
|
||||
|
||||
///Add a spell to the mobs spell list
|
||||
/mob/proc/AddSpell(obj/effect/proc_holder/spell/S)
|
||||
mob_spell_list += S
|
||||
LAZYADD(mob_spell_list, S)
|
||||
S.action.Grant(src)
|
||||
|
||||
///Remove a spell from the mobs spell list
|
||||
@@ -1010,7 +1010,7 @@
|
||||
for(var/X in mob_spell_list)
|
||||
var/obj/effect/proc_holder/spell/S = X
|
||||
if(istype(S, spell))
|
||||
mob_spell_list -= S
|
||||
LAZYREMOVE(mob_spell_list, S)
|
||||
qdel(S)
|
||||
|
||||
///Return any anti magic atom on this mob that matches the magic type
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
/// The calculated mob speed slowdown based on the modifiers list
|
||||
var/cached_multiplicative_slowdown
|
||||
/// List of action hud items the user has
|
||||
var/list/datum/action/actions = list()
|
||||
var/list/datum/action/actions
|
||||
/// A special action? No idea why this lives here
|
||||
var/list/datum/action/chameleon_item_actions
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
* Spells that do not transfer from one mob to another and can not be lost in mindswap.
|
||||
* obviously do not live in the mind
|
||||
*/
|
||||
var/list/mob_spell_list = list()
|
||||
var/list/mob_spell_list
|
||||
|
||||
|
||||
/// bitflags defining which status effects can be inflicted (replaces canknockdown, canstun, etc)
|
||||
|
||||
@@ -244,7 +244,7 @@
|
||||
//keep viruses?
|
||||
if (tr_flags & TR_KEEPVIRUS)
|
||||
O.diseases = diseases
|
||||
diseases = list()
|
||||
diseases = null //null the old diseases, bye bye!
|
||||
for(var/thing in O.diseases)
|
||||
var/datum/disease/D = thing
|
||||
D.affected_mob = O
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
var/datum/disease/D = thing
|
||||
if(D.GetDiseaseID() in data)
|
||||
D.cure()
|
||||
L.disease_resistances |= data
|
||||
LAZYOR(L.disease_resistances, data)
|
||||
|
||||
/datum/reagent/vaccine/on_merge(list/data)
|
||||
if(istype(data))
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
if(L.pulling && isliving(L.pulling))
|
||||
var/mob/living/M = L.pulling
|
||||
if(M.mob_spell_list.len != 0 || (M.mind && M.mind.spell_list.len != 0))
|
||||
if(LAZYLEN(M.mob_spell_list) || (LAZYLEN(M.mind?.spell_list)))
|
||||
for(var/obj/effect/proc_holder/spell/S in M.mob_spell_list)
|
||||
S.charge_counter = S.charge_max
|
||||
if(M.mind)
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/shapeshift/cast(list/targets,mob/user = usr)
|
||||
if(src in user.mob_spell_list)
|
||||
LAZYREMOVE(user.mob_spell_list, src)
|
||||
user.mob_spell_list.Remove(src)
|
||||
user.mind.AddSpell(src)
|
||||
if(user.buckled)
|
||||
|
||||
Reference in New Issue
Block a user