Skip to content

Commit

Permalink
fixing powers.dm
Browse files Browse the repository at this point in the history
  • Loading branch information
Venuska1117 committed Jan 5, 2025
1 parent 1366e76 commit c9ee1f3
Showing 1 changed file with 62 additions and 53 deletions.
115 changes: 62 additions & 53 deletions code/modules/mob/living/carbon/xenomorph/Powers.dm
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
/mob/living/carbon/xenomorph/proc/build_resin(atom/A, thick = FALSE, message = TRUE, use_plasma = TRUE, add_build_mod = 1)
/mob/living/carbon/xenomorph/proc/build_resin(atom/target, thick = FALSE, message = TRUE, use_plasma = TRUE, add_build_mod = 1)
if(!selected_resin)
return SECRETE_RESIN_FAIL

var/datum/resin_construction/RC = GLOB.resin_constructions_list[selected_resin]
var/datum/resin_construction/resin_construct = GLOB.resin_constructions_list[selected_resin]

var/total_resin_cost = XENO_RESIN_BASE_COST + RC.cost // Live, diet, shit code, repeat
var/total_resin_cost = XENO_RESIN_BASE_COST + resin_construct.cost // Live, diet, shit code, repeat

if(resin_construct.scaling_cost && use_plasma)
var/area/target_area = get_area(target)
if(target_area && target_area.openable_turf_count)
var/density_ratio = target_area.current_resin_count / target_area.openable_turf_count
if(density_ratio > 0.4)
total_resin_cost = ceil(total_resin_cost * (density_ratio + 0.35) * 2)
if(total_resin_cost > plasma_max && (XENO_RESIN_BASE_COST + resin_construct.cost) < plasma_max)
total_resin_cost = plasma_max

if(action_busy && !can_stack_builds)
return SECRETE_RESIN_FAIL
Expand All @@ -16,99 +25,99 @@
to_chat(src, SPAN_XENOWARNING("It's too tight in here to build."))
return SECRETE_RESIN_FAIL

if(RC.max_per_xeno != RESIN_CONSTRUCTION_NO_MAX)
var/current_amount = length(built_structures[RC.build_path])
if(current_amount >= RC.max_per_xeno)
if(resin_construct.max_per_xeno != RESIN_CONSTRUCTION_NO_MAX)
var/current_amount = length(built_structures[resin_construct.build_path])
if(current_amount >= resin_construct.max_per_xeno)
to_chat(src, SPAN_XENOWARNING("We've already built the maximum possible structures we can!"))
return SECRETE_RESIN_FAIL

var/turf/current_turf = get_turf(A)
var/turf/current_turf = get_turf(target)

if(extra_build_dist != IGNORE_BUILD_DISTANCE && get_dist(src, A) > src.caste.max_build_dist + extra_build_dist) // Hivelords and eggsac carriers have max_build_dist of 1, drones and queens 0
if(extra_build_dist != IGNORE_BUILD_DISTANCE && get_dist(src, target) > src.caste.max_build_dist + extra_build_dist) // Hivelords and eggsac carriers have max_build_dist of 1, drones and queens 0
to_chat(src, SPAN_XENOWARNING("We can't build from that far!"))
return SECRETE_RESIN_FAIL
else if(thick) //hivelords can thicken existing resin structures.
var/thickened = FALSE
if(istype(A, /turf/closed/wall/resin))
var/turf/closed/wall/resin/WR = A
if(istype(target, /turf/closed/wall/resin))
var/turf/closed/wall/resin/wall = target

if(istype(A, /turf/closed/wall/resin/weak))
to_chat(src, SPAN_XENOWARNING("[WR] is too flimsy to be reinforced."))
if(istype(target, /turf/closed/wall/resin/weak))
to_chat(src, SPAN_XENOWARNING("[wall] is too flimsy to be reinforced."))
return SECRETE_RESIN_FAIL

for(var/datum/effects/xeno_structure_reinforcement/sf in WR.effects_list)
to_chat(src, SPAN_XENOWARNING("The extra resin is preventing us from reinforcing [WR]. Wait until it elapse."))
for(var/datum/effects/xeno_structure_reinforcement/sf in wall.effects_list)
to_chat(src, SPAN_XENOWARNING("The extra resin is preventing us from reinforcing [wall]. Wait until it elapse."))
return SECRETE_RESIN_FAIL

if (WR.hivenumber != hivenumber)
to_chat(src, SPAN_XENOWARNING("[WR] doesn't belong to your hive!"))
if (wall.hivenumber != hivenumber)
to_chat(src, SPAN_XENOWARNING("[wall] doesn't belong to your hive!"))
return SECRETE_RESIN_FAIL

if(WR.type == /turf/closed/wall/resin)
WR.ChangeTurf(/turf/closed/wall/resin/thick)
if(wall.type == /turf/closed/wall/resin)
wall.ChangeTurf(/turf/closed/wall/resin/thick)
total_resin_cost = XENO_THICKEN_WALL_COST
else if(WR.type == /turf/closed/wall/resin/membrane)
WR.ChangeTurf(/turf/closed/wall/resin/membrane/thick)
else if(wall.type == /turf/closed/wall/resin/membrane)
wall.ChangeTurf(/turf/closed/wall/resin/membrane/thick)
total_resin_cost = XENO_THICKEN_MEMBRANE_COST
else
to_chat(src, SPAN_XENOWARNING("[WR] can't be made thicker."))
to_chat(src, SPAN_XENOWARNING("[wall] can't be made thicker."))
return SECRETE_RESIN_FAIL
thickened = TRUE

else if(istype(A, /obj/structure/mineral_door/resin))
var/obj/structure/mineral_door/resin/DR = A
if (DR.hivenumber != hivenumber)
to_chat(src, SPAN_XENOWARNING("[DR] doesn't belong to your hive!"))
else if(istype(target, /obj/structure/mineral_door/resin))
var/obj/structure/mineral_door/resin/door = target
if (door.hivenumber != hivenumber)
to_chat(src, SPAN_XENOWARNING("[door] doesn't belong to your hive!"))
return SECRETE_RESIN_FAIL

for(var/datum/effects/xeno_structure_reinforcement/sf in DR.effects_list)
to_chat(src, SPAN_XENOWARNING("The extra resin is preventing us from reinforcing [DR]. Wait until it elapse."))
for(var/datum/effects/xeno_structure_reinforcement/sf in door.effects_list)
to_chat(src, SPAN_XENOWARNING("The extra resin is preventing us from reinforcing [door]. Wait until it elapse."))
return SECRETE_RESIN_FAIL

if(DR.hardness == 1.5) //non thickened
var/oldloc = DR.loc
qdel(DR)
new /obj/structure/mineral_door/resin/thick (oldloc, DR.hivenumber)
if(door.hardness == 1.5) //non thickened
var/oldloc = door.loc
qdel(door)
new /obj/structure/mineral_door/resin/thick (oldloc, door.hivenumber)
total_resin_cost = XENO_THICKEN_DOOR_COST
else
to_chat(src, SPAN_XENOWARNING("[DR] can't be made thicker."))
to_chat(src, SPAN_XENOWARNING("[door] can't be made thicker."))
return SECRETE_RESIN_FAIL
thickened = TRUE

if(thickened)
if(message)
visible_message(SPAN_XENONOTICE("[src] regurgitates a thick substance and thickens [A]."), \
SPAN_XENONOTICE("We regurgitate some resin and thicken [A], using [total_resin_cost] plasma."), null, 5)
visible_message(SPAN_XENONOTICE("[src] regurgitates a thick substance and thickens [target]."), \
SPAN_XENONOTICE("We regurgitate some resin and thicken [target], using [total_resin_cost] plasma."), null, 5)
if(use_plasma)
use_plasma(total_resin_cost)
playsound(loc, "alien_resin_build", 25)
A.add_hiddenprint(src) //so admins know who thickened the walls
target.add_hiddenprint(src) //so admins know who thickened the walls
return TRUE

if (!RC.can_build_here(current_turf, src))
if(!resin_construct.can_build_here(current_turf, src))
return SECRETE_RESIN_FAIL

var/wait_time = RC.build_time * caste.build_time_mult * add_build_mod
var/wait_time = resin_construct.build_time * caste.build_time_mult * add_build_mod

var/obj/effect/alien/weeds/alien_weeds = current_turf.weeds
if(!alien_weeds || alien_weeds.secreting)
return SECRETE_RESIN_FAIL

if(istype(A, /obj/effect/alien/weeds/node/designer/speed))
if(istype(target, /obj/effect/alien/weeds/node/designer/speed))
if(!(caste_type in blacklist_caste))
wait_time -= ((RC.build_time * caste.build_time_mult) / 2)
wait_time -= ((resin_construct.build_time * caste.build_time_mult) / 2)

if(istype(A, /obj/effect/alien/weeds/node/designer/cost))
if(locate(RC.type) in whitelist_build)
if(istype(target, /obj/effect/alien/weeds/node/designer/cost))
if(locate(resin_construct.type) in whitelist_build)
total_resin_cost -= (total_resin_cost / 2)

var/obj/warning
var/succeeded = TRUE
if(RC.build_overlay_icon)
warning = new RC.build_overlay_icon(current_turf)
if(resin_construct.build_overlay_icon)
warning = new resin_construct.build_overlay_icon(current_turf)

if(RC.build_animation_effect)
warning = new RC.build_animation_effect(current_turf)
if(resin_construct.build_animation_effect)
warning = new resin_construct.build_animation_effect(current_turf)

switch(wait_time)
if(1 SECONDS)
Expand All @@ -133,19 +142,19 @@
if(!succeeded)
return SECRETE_RESIN_INTERRUPT

if (!RC.can_build_here(current_turf, src))
if (!resin_construct.can_build_here(current_turf, src))
return SECRETE_RESIN_FAIL

if(use_plasma)
use_plasma(total_resin_cost)
if(message)
visible_message(SPAN_XENONOTICE("[src] regurgitates a thick substance and shapes it into \a [RC.construction_name]!"), \
SPAN_XENONOTICE("We regurgitate some resin and shape it into \a [RC.construction_name][use_plasma ? " at the cost of a total [total_resin_cost] plasma" : ""]."), null, 5)
visible_message(SPAN_XENONOTICE("[src] regurgitates a thick substance and shapes it into \a [resin_construct.construction_name]!"), \
SPAN_XENONOTICE("We regurgitate some resin and shape it into \a [resin_construct.construction_name][use_plasma ? " at the cost of a total [total_resin_cost] plasma" : ""]."), null, 5)
playsound(loc, "alien_resin_build", 25)

var/atom/new_resin = RC.build(current_turf, hivenumber, src)
if(RC.max_per_xeno != RESIN_CONSTRUCTION_NO_MAX)
LAZYADD(built_structures[RC.build_path], new_resin)
var/atom/new_resin = resin_construct.build(current_turf, hivenumber, src)
if(resin_construct.max_per_xeno != RESIN_CONSTRUCTION_NO_MAX)
LAZYADD(built_structures[resin_construct.build_path], new_resin)
RegisterSignal(new_resin, COMSIG_PARENT_QDELETING, PROC_REF(remove_built_structure))

new_resin.add_hiddenprint(src) //so admins know who placed it
Expand All @@ -156,7 +165,7 @@

if(istype(new_resin, /turf/closed))
for(var/mob/living/carbon/human/enclosed_human in new_resin.contents)
if(enclosed_human.stat == DEAD)
if(enclosed_human.stat == DEAD && enclosed_human.is_revivable(TRUE))
msg_admin_niche("[src.ckey]/([src]) has built a closed resin structure, [new_resin.name], on top of a dead human, [enclosed_human.ckey]/([enclosed_human]), at [new_resin.x],[new_resin.y],[new_resin.z] [ADMIN_JMP(new_resin)]")

return SECRETE_RESIN_SUCCESS
Expand Down Expand Up @@ -219,6 +228,6 @@
var/current_area_name = get_area_name(target_turf)

for(var/mob/living/carbon/xenomorph/X in hive.totalXenos)
to_chat(X, SPAN_XENOANNOUNCE("[src.name] has declared: [NM.mark_meaning.desc] in [sanitize_area(current_area_name)]! (<a href='?src=\ref[X];overwatch=1;target=\ref[NM]'>Watch</a>) (<a href='?src=\ref[X];track=1;target=\ref[NM]'>Track</a>)"))
to_chat(X, SPAN_XENOANNOUNCE("[src.name] has declared: [NM.mark_meaning.desc] in [sanitize_area(current_area_name)]! (<a href='byond://?src=\ref[X];overwatch=1;target=\ref[NM]'>Watch</a>) (<a href='byond://?src=\ref[X];track=1;target=\ref[NM]'>Track</a>)"))
//this is killing the tgui chat and I dont know why
return TRUE

0 comments on commit c9ee1f3

Please sign in to comment.