Cleaned up environment_smash vars with bitflag defines (#2515)

This commit is contained in:
CitadelStationBot
2017-08-27 07:55:07 -05:00
committed by kevinz000
parent 718940042a
commit 94429bdccc
7 changed files with 11 additions and 13 deletions
+4 -6
View File
@@ -97,13 +97,11 @@
#define AI_IDLE 2
#define AI_OFF 3
//determines if a mob can smash through it
#define ENVIRONMENT_SMASH_NONE 0
#define ENVIRONMENT_SMASH_STRUCTURES 1
#define ENVIRONMENT_SMASH_WALLS 2
#define ENVIRONMENT_SMASH_RWALLS 3
#define ENVIRONMENT_SMASH_STRUCTURES 1 //crates, lockers, ect
#define ENVIRONMENT_SMASH_WALLS 2 //walls
#define ENVIRONMENT_SMASH_RWALLS 4 //rwalls
//SNPCs
+1 -1
View File
@@ -87,7 +87,7 @@
playsound(src, 'sound/effects/break_stone.ogg', 50, 1) //beautiful destruction
/turf/closed/mineral/attack_animal(mob/living/simple_animal/user)
if(user.environment_smash >= 2)
if((user.environment_smash & ENVIRONMENT_SMASH_WALLS) || (user.environment_smash & ENVIRONMENT_SMASH_RWALLS))
gets_drilled()
..()
@@ -40,7 +40,7 @@
M.do_attack_animation(src)
if(!M.environment_smash)
return
if(M.environment_smash == 3)
if(M.environment_smash & ENVIRONMENT_SMASH_RWALLS)
dismantle_wall(1)
playsound(src, 'sound/effects/meteorimpact.ogg', 100, 1)
else
+1 -1
View File
@@ -116,7 +116,7 @@
/turf/closed/wall/attack_animal(mob/living/simple_animal/M)
M.changeNext_move(CLICK_CD_MELEE)
M.do_attack_animation(src)
if(M.environment_smash >= 2)
if((M.environment_smash & ENVIRONMENT_SMASH_WALLS) || (M.environment_smash & ENVIRONMENT_SMASH_RWALLS))
playsound(src, 'sound/effects/meteorimpact.ogg', 100, 1)
dismantle_wall(1)
return
@@ -2,7 +2,7 @@
faction = list("hostile")
stop_automated_movement_when_pulled = 0
obj_damage = 40
environment_smash = ENVIRONMENT_SMASH_STRUCTURES //Set to 1 to break closets,tables,racks, etc; 2 for walls; 3 for rwalls
environment_smash = ENVIRONMENT_SMASH_STRUCTURES //Bitflags. Set to ENVIRONMENT_SMASH_STRUCTURES to break closets,tables,racks, etc; ENVIRONMENT_SMASH_WALLS for walls; ENVIRONMENT_SMASH_RWALLS for rwalls
var/atom/target
var/ranged = 0
var/rapid = 0
@@ -253,7 +253,7 @@
if(target.loc != null && get_dist(targets_from, target.loc) <= vision_range) //We can't see our target, but he's in our vision range still
if(ranged_ignores_vision && ranged_cooldown <= world.time) //we can't see our target... but we can fire at them!
OpenFire(target)
if(environment_smash >= 2) //If we're capable of smashing through walls, forget about vision completely after finding our target
if((environment_smash & ENVIRONMENT_SMASH_WALLS) || (environment_smash & ENVIRONMENT_SMASH_RWALLS)) //If we're capable of smashing through walls, forget about vision completely after finding our target
Goto(target,move_to_delay,minimum_distance)
FindHidden()
return 1
@@ -122,6 +122,6 @@
A.melee_damage_lower = max((A.melee_damage_lower * 2), 10)
A.melee_damage_upper = max((A.melee_damage_upper * 2), 10)
A.transform *= 2
A.environment_smash += 2
A.environment_smash |= ENVIRONMENT_SMASH_STRUCTURES | ENVIRONMENT_SMASH_RWALLS
to_chat(user, "<span class='info'>You increase the size of [A], giving it a surge of strength!</span>")
qdel(src)
@@ -128,7 +128,7 @@ field_generator power level display
return ..()
/obj/machinery/field/generator/attack_animal(mob/living/simple_animal/M)
if(M.environment_smash >= 3 && active == FG_OFFLINE && state != FG_UNSECURED)
if(M.environment_smash & ENVIRONMENT_SMASH_RWALLS && active == FG_OFFLINE && state != FG_UNSECURED)
state = FG_UNSECURED
anchored = FALSE
M.visible_message("<span class='warning'>[M] rips [src] free from its moorings!</span>")