Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:NebulaSS13/Nebula into fork/crux
Browse files Browse the repository at this point in the history
  • Loading branch information
MistakeNot4892 committed Jul 10, 2024
2 parents 12aaa4b + 8106884 commit cfb8eab
Show file tree
Hide file tree
Showing 592 changed files with 53,044 additions and 6,073 deletions.
22 changes: 22 additions & 0 deletions code/__defines/ai.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// TODO: FSM/decl based stances
#define STANCE_NONE /decl/mob_controller_stance/none
#define STANCE_IDLE /decl/mob_controller_stance/idle
#define STANCE_ALERT /decl/mob_controller_stance/alert
#define STANCE_ATTACK /decl/mob_controller_stance/attack
#define STANCE_ATTACKING /decl/mob_controller_stance/attacking
#define STANCE_TIRED /decl/mob_controller_stance/tired
#define STANCE_CONTAINED /decl/mob_controller_stance/contained
//basically 'do nothing'
#define STANCE_COMMANDED_STOP /decl/mob_controller_stance/commanded/stop
//follows a target
#define STANCE_COMMANDED_FOLLOW /decl/mob_controller_stance/commanded/follow
//catch all state for misc commands that need one.
#define STANCE_COMMANDED_MISC /decl/mob_controller_stance/commanded/misc
//we got healing powers yo
#define STANCE_COMMANDED_HEAL /decl/mob_controller_stance/commanded/heal
#define STANCE_COMMANDED_HEALING /decl/mob_controller_stance/commanded/healing

#define AI_ACTIVITY_IDLE 0
#define AI_ACTIVITY_MOVING_TO_TARGET 1
#define AI_ACTIVITY_BUILDING 2
#define AI_ACTIVITY_REPRODUCING 3
18 changes: 17 additions & 1 deletion code/__defines/directions.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#define N_NORTHEAST 32
#define N_NORTHWEST 512
#define N_SOUTHEAST 64
#define N_SOUTHWEST 1024
#define N_SOUTHWEST 1024

#define CORNER_NONE 0
#define CORNER_COUNTERCLOCKWISE 1
Expand Down Expand Up @@ -43,6 +43,22 @@

return ret

/proc/corner_states_to_dirs(list/corners)
if(!istype(corners)) return

var/list/ret = list(NORTHWEST, SOUTHEAST, NORTHEAST, SOUTHWEST)
. = list()

for(var/i = 1 to ret.len)
var/dir = ret[i]
var/corner = text2num(corners[i])
if(corner & CORNER_DIAGONAL)
. |= dir
if(corner & CORNER_COUNTERCLOCKWISE)
. |= turn(dir, 45)
if(corner & CORNER_CLOCKWISE)
. |= turn(dir, -45)

// Similar to dirs_to_corner_states(), but returns an *ordered* list, requiring (in order), dir=NORTH, SOUTH, EAST, WEST
// Note that this means this proc can be used as:

Expand Down
7 changes: 0 additions & 7 deletions code/__defines/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@
#define BORGXRAY BITFLAG(2)
#define BORGMATERIAL BITFLAG(3)

#define HOSTILE_STANCE_IDLE 1
#define HOSTILE_STANCE_ALERT 2
#define HOSTILE_STANCE_ATTACK 3
#define HOSTILE_STANCE_ATTACKING 4
#define HOSTILE_STANCE_TIRED 5
#define HOSTILE_STANCE_INSIDE 6

#define LEFT BITFLAG(0)
#define RIGHT BITFLAG(1)
#define UNDER BITFLAG(2)
Expand Down
2 changes: 1 addition & 1 deletion code/__defines/reactions.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
#define REACTION_TYPE_ALLOYING 2
#define REACTION_TYPE_COMPOUND 3
#define REACTION_TYPE_SYNTHESIS 4
#define REACTION_TYPE_RECIPE 5
#define REACTION_TYPE_RECIPE 5
3 changes: 2 additions & 1 deletion code/__defines/subsystem-priority.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
#define SS_PRIORITY_PLANTS 90 // Plant processing, slow ticks.
#define SS_PRIORITY_VINES 50 // Spreading vine effects.
#define SS_PRIORITY_PSYCHICS 45 // Psychic complexus processing.
#define SS_PRIORITY_AI 45 // Artificial Intelligence on mobs processing.
#define SS_PRIORITY_MOB_AI 45 // Mob AI logic; finding targets, attacking, etc.
#define SS_PRIORITY_AUTO_MOVE 42 // Automated atom movement, fires much more frequently than MOB_AI.
#define SS_PRIORITY_NANO 40 // Updates to nanoui uis.
#define SS_PRIORITY_TURF 30 // Radioactive walls/blob.
#define SS_PRIORITY_EVAC 30 // Processes the evac controller.
Expand Down
12 changes: 10 additions & 2 deletions code/_helpers/auxtools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,21 @@ var/global/auxtools_debug_server = world.GetConfig("env", "AUXTOOLS_DEBUG_DLL")
/proc/enable_debugging(mode, port)
CRASH("auxtools not loaded")

/hook/startup/proc/auxtools_init()
/world/New()
auxtools_init()
return ..()

/world/proc/auxtools_init()
if (global.auxtools_debug_server)
call_ext(global.auxtools_debug_server, "auxtools_init")()
enable_debugging()
return TRUE

/hook/shutdown/proc/auxtools_shutdown()
/world/Del()
auxtools_shutdown()
return ..()

/world/proc/auxtools_shutdown()
if (global.auxtools_debug_server)
call_ext(global.auxtools_debug_server, "auxtools_shutdown")()
return TRUE
15 changes: 3 additions & 12 deletions code/_helpers/emissive.dm
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
/proc/emissive_overlay(var/icon, var/icon_state, var/loc, var/dir, var/color)
var/image/emissive/I = new(icon, icon_state)
if(!isnull(loc))
I.loc = loc
if(!isnull(dir))
I.dir = dir
if(!isnull(color))
I.color = color
var/image/I = image(icon, loc, icon_state, EMISSIVE_LAYER, dir)
I.plane = EMISSIVE_PLANE
I.color = color
return I

/image/emissive/New()
..()
layer = EMISSIVE_LAYER
plane = EMISSIVE_PLANE
2 changes: 1 addition & 1 deletion code/_helpers/logging.dm
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ var/global/log_end= world.system_type == UNIX ? ascii2text(13) : ""

if(key)
if(include_link && C)
. += "<a href='?priv_msg=\ref[C];ticket=\ref[ticket]'>"
. += "<a href='byond://?priv_msg=\ref[C];ticket=\ref[ticket]'>"

. += key

Expand Down
2 changes: 1 addition & 1 deletion code/_helpers/time.dm
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ var/global/round_start_time = 0
return last_round_duration

var/mills = round_duration_in_ticks // 1/10 of a second, not real milliseconds but whatever
//var/secs = ((mills % 36000) % 600) / 10 //Not really needed, but I'll leave it here for refrence.. or something
//var/secs = ((mills % 36000) % 600) / 10 //Not really needed, but I'll leave it here for reference or something
var/mins = round((mills % 36000) / 600)
var/hours = round(mills / 36000)

Expand Down
3 changes: 2 additions & 1 deletion code/_helpers/turfs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@
if(ignore_background && (source.turf_flags & TURF_FLAG_BACKGROUND))
continue
var/old_turf = source.prev_type || base_turf || get_base_turf_by_area(source)
source.ChangeTurf(old_turf, keep_air = !translate_air)
var/turf/changed = source.ChangeTurf(old_turf, keep_air = !translate_air)
changed.prev_type = null

//Transports a turf from a source turf to a target turf, moving all of the turf's contents and making the target a copy of the source.
//If ignore_background is set to true, turfs with TURF_FLAG_BACKGROUND set will only translate anchored contents.
Expand Down
3 changes: 2 additions & 1 deletion code/_macros.dm
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@

/proc/place_meta_charset(content)
if(istext(content))
content = "<meta charset=\"utf-8\">" + content
content = "<!DOCTYPE html><meta charset=\"utf-8\">" + content
return content

#define to_chat(target, message) target << (message)
Expand Down Expand Up @@ -169,6 +169,7 @@
#define SPAN_PINK(X) SPAN_CLASS("font_pink", X)
#define SPAN_PALEPINK(X) SPAN_CLASS("font_palepink", X)
#define SPAN_SINISTER(X) SPAN_CLASS("sinister", X)
#define SPAN_MODERATE(X) SPAN_CLASS("moderate", X)
// placeholders
#define SPAN_GOOD(X) SPAN_GREEN(X)
#define SPAN_NEUTRAL(X) SPAN_BLUE(X)
Expand Down
10 changes: 4 additions & 6 deletions code/_onclick/click.dm
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,13 @@
//Atoms on your person
// A is your location but is not a turf; or is on you (backpack); or is on something on you (box in backpack); sdepth is needed here because contents depth does not equate inventory storage depth.
var/sdepth = A.storage_depth(src)
var/check_dexterity_val = A.storage ? DEXTERITY_NONE : (istype(holding) ? holding.needs_attack_dexterity : DEXTERITY_WIELD_ITEM)
var/can_wield_item = holding && (!check_dexterity_val || check_dexterity(check_dexterity_val))
if((!isturf(A) && A == loc) || (sdepth != -1 && sdepth <= 1))
if(can_wield_item)
if(holding)
var/resolved = holding.resolve_attackby(A, src, params)
if(!resolved && A && holding)
holding.afterattack(A, src, 1, params) // 1 indicates adjacency
setClickCooldown(DEFAULT_QUICK_COOLDOWN)
else if(!holding)
else
if(ismob(A)) // No instant mob attacking
setClickCooldown(DEFAULT_QUICK_COOLDOWN)
UnarmedAttack(A, TRUE)
Expand All @@ -138,13 +136,13 @@
sdepth = A.storage_depth_turf()
if(isturf(A) || isturf(A.loc) || (sdepth != -1 && sdepth <= 1))
if(A.Adjacent(src)) // see adjacent.dm
if(can_wield_item)
if(holding)
// Return 1 in attackby() to prevent afterattack() effects (when safely moving items for example)
var/resolved = holding.resolve_attackby(A,src, params)
if(!resolved && A && holding)
holding.afterattack(A, src, 1, params) // 1: clicking something Adjacent
setClickCooldown(DEFAULT_QUICK_COOLDOWN)
else if(!holding)
else
if(ismob(A)) // No instant mob attacking
setClickCooldown(DEFAULT_QUICK_COOLDOWN)
UnarmedAttack(A, TRUE)
Expand Down
5 changes: 0 additions & 5 deletions code/_onclick/cyborg.dm
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@
holding.attack_self(src)
return

var/check_dexterity_val = A.storage ? DEXTERITY_NONE : (istype(holding) ? holding.needs_attack_dexterity : DEXTERITY_WIELD_ITEM)
var/can_wield_item = (!check_dexterity_val || check_dexterity(check_dexterity_val))
if(!can_wield_item)
return

if(A == loc || (A in loc) || (A in contents))
// No adjacency checks
var/resolved = holding.resolve_attackby(A, src, params)
Expand Down
3 changes: 1 addition & 2 deletions code/_onclick/drag_drop.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
// Receive a mouse drop.
// Returns false if the atom is valid for dropping further up the chain, true if the drop has been handled.
/atom/proc/receive_mouse_drop(atom/dropping, mob/user, params)
var/mob/living/H = user
if(istype(H) && !H.anchored && can_climb(H) && dropping == user)
if(isliving(user) && !user.anchored && can_climb(user) && dropping == user)
do_climb(dropping)
return TRUE
return FALSE
11 changes: 9 additions & 2 deletions code/_onclick/hud/animal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
hud_used = /datum/hud/animal

/datum/hud/animal/FinalizeInstantiation()
action_intent = new(null, mymob, get_ui_style_data(), get_ui_color(), get_ui_alpha(), UI_ICON_INTENT)

var/ui_style = get_ui_style_data()
var/ui_color = get_ui_color()
var/ui_alpha = get_ui_alpha()

move_intent = new(null, mymob, ui_style, ui_color, ui_alpha, UI_ICON_MOVEMENT)
move_intent.icon_state = mymob.move_intent.hud_icon_state
adding += move_intent
action_intent = new(null, mymob, ui_style, ui_color, ui_alpha, UI_ICON_INTENT)
adding += action_intent
..()

2 changes: 1 addition & 1 deletion code/_onclick/hud/screen/screen_holomap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
/obj/screen/holomap_legend/Initialize(mapload, mob/_owner, ui_style, ui_color, ui_alpha, map_color, text)
. = ..()
saved_color = map_color
maptext = "<a href='?src=\ref[src]' style=\"font-family: 'Small Fonts'; color: [map_color]; -dm-text-outline: 1 [COLOR_BLACK]; font-size: 6px\">[text]</a>"
maptext = "<a href='byond://?src=\ref[src]' style=\"font-family: 'Small Fonts'; color: [map_color]; -dm-text-outline: 1 [COLOR_BLACK]; font-size: 6px\">[text]</a>"
alpha = 255

/obj/screen/holomap_legend/handle_click(mob/user, params)
Expand Down
24 changes: 17 additions & 7 deletions code/_onclick/item_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,27 @@ avoid code duplication. This includes items that may sometimes act as a standard
if(!.)
return bash(W,user)

/atom/movable/proc/bash(obj/item/W, mob/user)
/atom/movable/proc/bash(obj/item/weapon, mob/user)
if(isliving(user) && user.a_intent == I_HELP)
return FALSE
if(W.item_flags & ITEM_FLAG_NO_BLUDGEON)
if(!weapon.user_can_wield(user))
return FALSE
visible_message("<span class='danger'>[src] has been hit by [user] with [W].</span>")
if(weapon.item_flags & ITEM_FLAG_NO_BLUDGEON)
return FALSE
visible_message(SPAN_DANGER("[src] has been hit by [user] with [weapon]."))
return TRUE

/mob/living/attackby(obj/item/I, mob/user)
/mob/living/attackby(obj/item/used_item, mob/user)
if(!ismob(user))
return TRUE
if(can_operate(src,user) != OPERATE_DENY && I.do_surgery(src,user)) //Surgery
if(can_operate(src, user) != OPERATE_DENY && used_item.do_surgery(src,user)) //Surgery
return TRUE
if(try_butcher_in_place(user, I))
if(try_butcher_in_place(user, used_item))
return TRUE
return I.use_on_mob(src, user)
var/oldhealth = current_health
. = used_item.use_on_mob(src, user)
if(used_item.force && istype(ai) && current_health < oldhealth)
ai.retaliate(user)

/mob/living/human/attackby(obj/item/I, mob/user)

Expand Down Expand Up @@ -96,6 +101,11 @@ avoid code duplication. This includes items that may sometimes act as a standard
//I would prefer to rename this attack_as_weapon(), but that would involve touching hundreds of files.
/obj/item/proc/use_on_mob(mob/living/target, mob/living/user, animate = TRUE)

// TODO: revisit if this should be a silent failure/parent call instead, for mob-level storage interactions?
// like a horse with a saddlebag or something
if(!user_can_wield(user))
return TRUE // skip other interactions

if(squash_item())
return TRUE

Expand Down
10 changes: 6 additions & 4 deletions code/_onclick/other_mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,24 @@
var/decl/pronouns/G = get_pronouns()
face_atom(A)
if(attack_delay)
walk_to(src, 0) // Cancel any baked-in movement.
stop_automove() // Cancel any baked-in movement.
do_windup_animation(A, attack_delay, no_reset = TRUE)
if(!do_after(src, attack_delay, A) || !Adjacent(A))
visible_message(SPAN_NOTICE("\The [src] misses [G.his] attack on \the [A]!"))
animate(src, pixel_x = default_pixel_x, pixel_y = default_pixel_y, time = 2) // reset wherever the attack animation got us to.
MoveToTarget(TRUE) // Restart hostile mob tracking.
ai?.move_to_target(TRUE) // Restart hostile mob tracking.
return TRUE
MoveToTarget(TRUE) // Restart hostile mob tracking.
ai?.move_to_target(TRUE) // Restart hostile mob tracking.

if(ismob(A)) // Clientless mobs are too dum to move away, so they can be missed.
var/mob/mob = A
if(!mob.ckey && !prob(get_melee_accuracy()))
visible_message(SPAN_NOTICE("\The [src] misses [G.his] attack on \the [A]!"))
return TRUE

return A.attackby(attacking_with, src)
. = A.attackby(attacking_with, src)
if(isliving(A))
apply_attack_effects(A)

// Attack hand but for simple animals
/atom/proc/attack_animal(mob/user)
Expand Down
Loading

0 comments on commit cfb8eab

Please sign in to comment.