mirror of
https://github.com/fulpstation/fulpstation.git
synced 2025-12-10 01:57:01 +00:00
Replaces /atom.initialized and .admin_spawned with flags (#37981)
kill .initialized and .admin_spawned from /atom
This commit is contained in:
committed by
Tad Hardesty
parent
cb13207df6
commit
4f0b0b7ec1
@@ -25,7 +25,8 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
|
||||
#define PREVENT_CLICK_UNDER_1 (1<<11) //Prevent clicking things below it on the same turf eg. doors/ fulltile windows
|
||||
#define HOLOGRAM_1 (1<<12)
|
||||
#define TESLA_IGNORE_1 (1<<13) // TESLA_IGNORE grants immunity from being targeted by tesla-style electricity
|
||||
|
||||
#define INITIALIZED_1 (1<<14) //Whether /atom/Initialize() has already run for the object
|
||||
#define ADMIN_SPAWNED_1 (1<<15) //was this spawned by an admin? used for stat tracking stuff.
|
||||
|
||||
//turf-only flags
|
||||
#define NOJAUNT_1 (1<<0)
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
//type and all subtypes should always call Initialize in New()
|
||||
#define INITIALIZE_IMMEDIATE(X) ##X/New(loc, ...){\
|
||||
..();\
|
||||
if(!initialized) {\
|
||||
if(!(flags_1 & INITIALIZED_1)) {\
|
||||
args[1] = TRUE;\
|
||||
SSatoms.InitAtom(src, args);\
|
||||
}\
|
||||
|
||||
@@ -405,7 +405,8 @@ Proc for attack log creation, because really why not
|
||||
|
||||
for(var/j in 1 to amount)
|
||||
var/atom/X = new spawn_type(arglist(new_args))
|
||||
X.admin_spawned = admin_spawn
|
||||
if (admin_spawn)
|
||||
X.flags_1 |= ADMIN_SPAWNED_1
|
||||
|
||||
/proc/spawn_and_random_walk(spawn_type, target, amount, walk_chance=100, max_walk=3, always_max_walk=FALSE, admin_spawn=FALSE)
|
||||
var/turf/T = get_turf(target)
|
||||
@@ -415,7 +416,8 @@ Proc for attack log creation, because really why not
|
||||
|
||||
for(var/j in 1 to amount)
|
||||
var/atom/movable/X = new spawn_type(T)
|
||||
X.admin_spawned = admin_spawn
|
||||
if (admin_spawn)
|
||||
X.flags_1 |= ADMIN_SPAWNED_1
|
||||
|
||||
if(always_max_walk || prob(walk_chance))
|
||||
if(always_max_walk)
|
||||
|
||||
@@ -119,7 +119,9 @@ GLOBAL_LIST_INIT(bitfields, list(
|
||||
"NODECONSTRUCT_1" = NODECONSTRUCT_1,
|
||||
"OVERLAY_QUEUED_1" = OVERLAY_QUEUED_1,
|
||||
"HOLOGRAM_1" = HOLOGRAM_1,
|
||||
"TESLA_IGNORE_1" = TESLA_IGNORE_1
|
||||
"TESLA_IGNORE_1" = TESLA_IGNORE_1,
|
||||
"INITIALIZED_1" = INITIALIZED_1,
|
||||
"ADMIN_SPAWNED_1" = ADMIN_SPAWNED_1,
|
||||
),
|
||||
"clothing_flags" = list(
|
||||
"LAVAPROTECT" = LAVAPROTECT,
|
||||
|
||||
@@ -39,16 +39,16 @@
|
||||
Note that this proc can be overridden, and is in the case of screen objects.
|
||||
*/
|
||||
/atom/Click(location,control,params)
|
||||
if(initialized)
|
||||
if(flags_1 & INITIALIZED_1)
|
||||
SendSignal(COMSIG_CLICK, location, control, params)
|
||||
usr.ClickOn(src, params)
|
||||
|
||||
/atom/DblClick(location,control,params)
|
||||
if(initialized)
|
||||
if(flags_1 & INITIALIZED_1)
|
||||
usr.DblClickOn(src,params)
|
||||
|
||||
/atom/MouseWheel(delta_x,delta_y,location,control,params)
|
||||
if(initialized)
|
||||
if(flags_1 & INITIALIZED_1)
|
||||
usr.MouseWheelOn(src, delta_x, delta_y, params)
|
||||
|
||||
/*
|
||||
|
||||
@@ -263,7 +263,7 @@ SUBSYSTEM_DEF(air)
|
||||
currentrun |= T
|
||||
if(blockchanges && T.excited_group)
|
||||
T.excited_group.garbage_collect()
|
||||
else if(T.initialized)
|
||||
else if(T.flags_1 & INITIALIZED_1)
|
||||
for(var/turf/S in T.atmos_adjacent_turfs)
|
||||
add_to_active(S)
|
||||
else if(map_loading)
|
||||
|
||||
@@ -37,14 +37,14 @@ SUBSYSTEM_DEF(atoms)
|
||||
count = atoms.len
|
||||
for(var/I in atoms)
|
||||
var/atom/A = I
|
||||
if(!A.initialized)
|
||||
if(!(A.flags_1 & INITIALIZED_1))
|
||||
if(InitAtom(I, mapload_arg))
|
||||
atoms -= I
|
||||
CHECK_TICK
|
||||
else
|
||||
count = 0
|
||||
for(var/atom/A in world)
|
||||
if(!A.initialized)
|
||||
if(!(A.flags_1 & INITIALIZED_1))
|
||||
InitAtom(A, mapload_arg)
|
||||
++count
|
||||
CHECK_TICK
|
||||
@@ -95,7 +95,7 @@ SUBSYSTEM_DEF(atoms)
|
||||
|
||||
if(!A) //possible harddel
|
||||
qdeleted = TRUE
|
||||
else if(!A.initialized)
|
||||
else if(!(A.flags_1 & INITIALIZED_1))
|
||||
BadInitializeCalls[the_type] |= BAD_INIT_DIDNT_INIT
|
||||
|
||||
return qdeleted || QDELING(A)
|
||||
|
||||
@@ -212,7 +212,7 @@ SUBSYSTEM_DEF(persistence)
|
||||
continue
|
||||
var/list/savable_obj = list()
|
||||
for(var/obj/O in F)
|
||||
if(is_type_in_typecache(O, satchel_blacklist) || O.admin_spawned)
|
||||
if(is_type_in_typecache(O, satchel_blacklist) || (O.flags_1 & ADMIN_SPAWNED_1))
|
||||
continue
|
||||
if(O.persistence_replacement)
|
||||
savable_obj += O.persistence_replacement
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
var/flags_1 = NONE
|
||||
var/interaction_flags_atom = NONE
|
||||
var/container_type = NONE
|
||||
var/admin_spawned = 0 //was this spawned by an admin? used for stat tracking stuff.
|
||||
var/datum/reagents/reagents = null
|
||||
|
||||
//This atom's HUD (med/sec, etc) images. Associative list.
|
||||
@@ -19,7 +18,6 @@
|
||||
|
||||
var/list/atom_colours //used to store the different colors on an atom
|
||||
//its inherent color, the colored paint applied on it, special color effect etc...
|
||||
var/initialized = FALSE
|
||||
|
||||
var/list/our_overlays //our local copy of (non-priority) overlays without byond magic. Use procs in SSoverlays to manipulate
|
||||
var/list/priority_overlays //overlays that should remain on top and not normally removed when using cut_overlay functions, like c4.
|
||||
@@ -59,9 +57,9 @@
|
||||
// /turf/open/space/Initialize
|
||||
|
||||
/atom/proc/Initialize(mapload, ...)
|
||||
if(initialized)
|
||||
if(flags_1 & INITIALIZED_1)
|
||||
stack_trace("Warning: [src]([type]) initialized multiple times!")
|
||||
initialized = TRUE
|
||||
flags_1 |= INITIALIZED_1
|
||||
|
||||
//atom color stuff
|
||||
if(color)
|
||||
@@ -518,7 +516,7 @@
|
||||
|
||||
/atom/vv_edit_var(var_name, var_value)
|
||||
if(!GLOB.Debug2)
|
||||
admin_spawned = TRUE
|
||||
flags_1 |= ADMIN_SPAWNED_1
|
||||
. = ..()
|
||||
switch(var_name)
|
||||
if("color")
|
||||
|
||||
@@ -165,7 +165,7 @@ GLOBAL_LIST_INIT(meteorsC, list(/obj/effect/meteor/dust)) //for space dust event
|
||||
return
|
||||
|
||||
/obj/effect/meteor/examine(mob/user)
|
||||
if(!admin_spawned && isliving(user))
|
||||
if(!(flags_1 & ADMIN_SPAWNED_1) && isliving(user))
|
||||
SSmedals.UnlockMedal(MEDAL_METEOR, user.client)
|
||||
..()
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@
|
||||
use_power(power_used)
|
||||
|
||||
var/atom/A = new dispense_type(loc)
|
||||
A.admin_spawned = admin_spawned
|
||||
A.flags_1 |= (flags_1 & ADMIN_SPAWNED_1)
|
||||
|
||||
if(create_sound)
|
||||
playsound(src, create_sound, 50, 1)
|
||||
|
||||
@@ -159,7 +159,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
|
||||
/obj/item/clothing/mask/cigarette/proc/light(flavor_text = null)
|
||||
if(lit)
|
||||
return
|
||||
if(!initialized)
|
||||
if(!(flags_1 & INITIALIZED_1))
|
||||
icon_state = icon_on
|
||||
item_state = icon_on
|
||||
return
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
C.flash_act()
|
||||
|
||||
// Spawn some hostile syndicate critters and spread them out
|
||||
spawn_and_random_walk(spawner_type, T, deliveryamt, walk_chance=50, admin_spawn=admin_spawned)
|
||||
spawn_and_random_walk(spawner_type, T, deliveryamt, walk_chance=50, admin_spawn=((flags_1 & ADMIN_SPAWNED_1) ? TRUE : FALSE))
|
||||
|
||||
qdel(src)
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
loc.layer = LARGE_MOB_LAYER //NO HIDING BEHIND PLANTS FOR YOU, DICKWEED (HA GET IT, BECAUSE WEEDS ARE PLANTS)
|
||||
H.bleedsuppress = TRUE //AND WE WON'T BLEED OUT LIKE COWARDS
|
||||
else
|
||||
if(!admin_spawned)
|
||||
if(!(flags_1 & ADMIN_SPAWNED_1))
|
||||
qdel(src)
|
||||
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list(
|
||||
|
||||
var/turf/newT
|
||||
if(flags & CHANGETURF_SKIP) // We haven't been initialized
|
||||
if(initialized)
|
||||
if(flags_1 & INITIALIZED_1)
|
||||
stack_trace("CHANGETURF_SKIP was used in a PlaceOnTop call for a turf that's initialized. This is a mistake. [src]([type])")
|
||||
assemble_baseturfs()
|
||||
if(fake_turf_type)
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
icon_state = SPACE_ICON_STATE
|
||||
air = space_gas
|
||||
|
||||
if(initialized)
|
||||
if(flags_1 & INITIALIZED_1)
|
||||
stack_trace("Warning: [src]([type]) initialized multiple times!")
|
||||
initialized = TRUE
|
||||
flags_1 |= INITIALIZED_1
|
||||
|
||||
var/area/A = loc
|
||||
if(!IS_DYNAMIC_LIGHTING(src) && IS_DYNAMIC_LIGHTING(A))
|
||||
|
||||
@@ -40,9 +40,9 @@
|
||||
. = ..()
|
||||
|
||||
/turf/Initialize()
|
||||
if(initialized)
|
||||
if(flags_1 & INITIALIZED_1)
|
||||
stack_trace("Warning: [src]([type]) initialized multiple times!")
|
||||
initialized = TRUE
|
||||
flags_1 |= INITIALIZED_1
|
||||
|
||||
assemble_baseturfs()
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
SSair.remove_from_active(src)
|
||||
visibilityChanged()
|
||||
QDEL_LIST(blueprint_data)
|
||||
initialized = FALSE
|
||||
flags_1 &= ~INITIALIZED_1
|
||||
requires_activation = FALSE
|
||||
..()
|
||||
|
||||
@@ -245,19 +245,19 @@
|
||||
|
||||
/turf/proc/levelupdate()
|
||||
for(var/obj/O in src)
|
||||
if(O.level == 1 && O.initialized)
|
||||
if(O.level == 1 && (O.flags_1 & INITIALIZED_1))
|
||||
O.hide(src.intact)
|
||||
|
||||
// override for space turfs, since they should never hide anything
|
||||
/turf/open/space/levelupdate()
|
||||
for(var/obj/O in src)
|
||||
if(O.level == 1 && O.initialized)
|
||||
if(O.level == 1 && (O.flags_1 & INITIALIZED_1))
|
||||
O.hide(0)
|
||||
|
||||
// Removes all signs of lattice on the pos of the turf -Donkieyo
|
||||
/turf/proc/RemoveLattice()
|
||||
var/obj/structure/lattice/L = locate(/obj/structure/lattice, src)
|
||||
if(L && L.initialized)
|
||||
if(L && (L.flags_1 & INITIALIZED_1))
|
||||
qdel(L)
|
||||
|
||||
/turf/proc/phase_damage_creatures(damage,mob/U = null)//>Ninja Code. Hurts and knocks out creatures on this turf //NINJACODE
|
||||
|
||||
@@ -643,7 +643,7 @@
|
||||
T.ChangeTurf(chosen)
|
||||
else
|
||||
var/atom/A = new chosen(usr.loc)
|
||||
A.admin_spawned = TRUE
|
||||
A.flags_1 |= ADMIN_SPAWNED_1
|
||||
|
||||
log_admin("[key_name(usr)] spawned [chosen] at ([usr.x],[usr.y],[usr.z])")
|
||||
SSblackbox.record_feedback("tally", "admin_verb", 1, "Spawn Atom") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
@@ -2059,7 +2059,7 @@
|
||||
else
|
||||
var/atom/O = new path(target)
|
||||
if(O)
|
||||
O.admin_spawned = TRUE
|
||||
O.flags_1 |= ADMIN_SPAWNED_1
|
||||
O.setDir(obj_dir)
|
||||
if(obj_name)
|
||||
O.name = obj_name
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
|
||||
sword = new(H)
|
||||
if(!GLOB.highlander)
|
||||
sword.admin_spawned = TRUE //To prevent announcing
|
||||
sword.flags_1 |= ADMIN_SPAWNED_1 //To prevent announcing
|
||||
sword.pickup(H) //For the stun shielding
|
||||
H.put_in_hands(sword)
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
if (admin_spawned)
|
||||
for(var/item in contains)
|
||||
var/atom/A = new item(C)
|
||||
A.admin_spawned = TRUE
|
||||
A.flags_1 |= ADMIN_SPAWNED_1
|
||||
else
|
||||
for(var/item in contains)
|
||||
new item(C)
|
||||
|
||||
@@ -6,9 +6,9 @@ INITIALIZE_IMMEDIATE(/mob/dead)
|
||||
sight = SEE_TURFS | SEE_MOBS | SEE_OBJS | SEE_SELF
|
||||
|
||||
/mob/dead/Initialize()
|
||||
if(initialized)
|
||||
if(flags_1 & INITIALIZED_1)
|
||||
stack_trace("Warning: [src]([type]) initialized multiple times!")
|
||||
initialized = TRUE
|
||||
flags_1 |= INITIALIZED_1
|
||||
tag = "mob_[next_mob_id++]"
|
||||
GLOB.mob_list += src
|
||||
|
||||
|
||||
@@ -60,6 +60,6 @@
|
||||
var/hat_type = pick(possible_seasonal_hats)
|
||||
var/obj/item/new_hat = new hat_type(D)
|
||||
D.equip_to_slot_or_del(new_hat, SLOT_HEAD)
|
||||
D.admin_spawned = admin_spawned
|
||||
D.flags_1 |= (flags_1 & ADMIN_SPAWNED_1)
|
||||
D.key = user.key
|
||||
qdel(src)
|
||||
|
||||
@@ -671,7 +671,7 @@ Difficulty: Very Hard
|
||||
for(var/i in T)
|
||||
if(isitem(i) && !is_type_in_typecache(i, banned_items_typecache))
|
||||
var/obj/item/W = i
|
||||
if(!W.admin_spawned && !(W.flags_1 & HOLOGRAM_1) && !(W.flags_1 & ABSTRACT_1))
|
||||
if(!(W.flags_1 & ADMIN_SPAWNED_1) && !(W.flags_1 & HOLOGRAM_1) && !(W.flags_1 & ABSTRACT_1))
|
||||
L += W
|
||||
if(L.len)
|
||||
var/obj/item/CHOSEN = pick(L)
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
if(C && crusher_loot && C.total_damage >= maxHealth * 0.6)
|
||||
spawn_crusher_loot()
|
||||
crusher_kill = TRUE
|
||||
if(!admin_spawned)
|
||||
if(!(flags_1 & ADMIN_SPAWNED_1))
|
||||
var/tab = "megafauna_kills"
|
||||
if(crusher_kill)
|
||||
tab = "megafauna_kills_crusher"
|
||||
@@ -111,7 +111,7 @@
|
||||
recovery_time = world.time + buffer_time
|
||||
|
||||
/mob/living/simple_animal/hostile/megafauna/proc/grant_achievement(medaltype, scoretype, crusher_kill)
|
||||
if(!medal_type || admin_spawned || !SSmedals.hub_enabled) //Don't award medals if the medal type isn't set
|
||||
if(!medal_type || (flags_1 & ADMIN_SPAWNED_1) || !SSmedals.hub_enabled) //Don't award medals if the medal type isn't set
|
||||
return FALSE
|
||||
|
||||
for(var/mob/living/L in view(7,src))
|
||||
|
||||
@@ -36,7 +36,8 @@
|
||||
/mob/living/simple_animal/hostile/asteroid/hivelord/OpenFire(the_target)
|
||||
if(world.time >= ranged_cooldown)
|
||||
var/mob/living/simple_animal/hostile/asteroid/hivelordbrood/A = new brood_type(src.loc)
|
||||
A.admin_spawned = admin_spawned
|
||||
|
||||
A.flags_1 |= (flags_1 & ADMIN_SPAWNED_1)
|
||||
A.GiveTarget(target)
|
||||
A.friends = friends
|
||||
A.faction = faction.Copy()
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
if(other != src)
|
||||
last_tendril = FALSE
|
||||
break
|
||||
if(last_tendril && !admin_spawned)
|
||||
if(last_tendril && !(flags_1 & ADMIN_SPAWNED_1))
|
||||
if(SSmedals.hub_enabled)
|
||||
for(var/mob/living/L in view(7,src))
|
||||
if(L.stat || !L.client)
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
spawn_delay = world.time + spawn_time
|
||||
var/chosen_mob_type = pick(mob_types)
|
||||
var/mob/living/simple_animal/L = new chosen_mob_type(src.loc)
|
||||
L.admin_spawned = admin_spawned //If we were admin spawned, lets have our children count as that as well.
|
||||
L.flags_1 |= (flags_1 & ADMIN_SPAWNED_1) //If we were admin spawned, lets have our children count as that as well.
|
||||
spawned_mobs += L
|
||||
L.nest = src
|
||||
L.faction = src.faction
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
for(var/varName in newVars)
|
||||
if(varName in newVars)
|
||||
summoned_object.vv_edit_var(varName, newVars[varName])
|
||||
summoned_object.admin_spawned = TRUE
|
||||
summoned_object.flags_1 |= ADMIN_SPAWNED_1
|
||||
if(summon_lifespan)
|
||||
QDEL_IN(summoned_object, summon_lifespan)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user