SS13 construct (#593)

<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request

<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

<!-- Please make sure to actually test your PRs. If you have not tested
your PR mention it. -->

This PR, will add to the game a new test map SS13 construct, a port of
the famous map from Garys Mod, by ocean_fish. Also, a number of tools
from the same game - namely:

Physgun, tools to manipulate the gravity of objects.
Phystool, or toolgun with five modes of operation.
Fly, Noclip. 


![ss13_construct_full](https://github.com/Bubberstation/Bubberstation/assets/126053988/c5a99d33-8ffc-4203-9ef2-3217ade3ca04)
https://youtu.be/lGXmsiecvfo
## Why It's Good For The Game

<!-- Argue for the merits of your changes and how they benefit the game,
especially if they are controversial and/or far reaching. If you can't
actually explain WHY what you are doing will improve the game, then it
probably isn't good for the game in the first place. -->
New, user-friendly test tools.

## Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
mark your PRs to prevent unnecessary GBP loss. You can read up on GBP
and it's effects on PRs in the tgstation guides for contributors. Please
note that maintainers freely reserve the right to remove and add tags
should they deem it appropriate. You can attempt to finagle the system
all you want, but it's best to shoot for clear communication right off
the bat. -->

🆑
add: Added new map SS13 Construct
add: Added new new debug tool: physgun, phystool
add: Added new abilites: noclip, fly
sound: added phystools sounds
config: added SS13 constuct to avaible maps
/🆑

<!-- Both 🆑's are required for the changelog to work! You can put
your name to the right of the first 🆑 if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->

---------

Co-authored-by: Resomi Enjoer <fenyshaarmagedon.gmai.com>
Co-authored-by: OceanFish1 <65843722+OceanFish1@users.noreply.github.com>
Co-authored-by: nevimer <77420409+nevimer@users.noreply.github.com>
This commit is contained in:
Fenysha
2023-11-06 21:32:36 -05:00
committed by GitHub
co-authored by Resomi Enjoer <fenyshaarmagedon.gmai.com> OceanFish1 nevimer
parent 6a35918b1f
commit 8a31efc1ff
29 changed files with 66071 additions and 1 deletions
@@ -0,0 +1,50 @@
/datum/action/cooldown/fly
name = "Toggle fly"
desc = "Grand you ability to move freely and cross the space."
button_icon = 'icons/effects/effects.dmi'
button_icon_state = "lintel"
var/enabled = FALSE
/datum/action/cooldown/fly/IsAvailable(feedback)
. = ..()
if(owner.stat & DEAD)
return
/datum/action/cooldown/fly/Activate(atom/target)
. = ..()
if(enabled)
disable_fly()
return TRUE
enable_fly()
return TRUE
/datum/action/cooldown/fly/proc/enable_fly()
owner.movement_type = FLYING
owner.plane += 2
enabled = TRUE
owner.visible_message(span_notice("[owner.name], takes off over the ground."), span_notice("You going fly."))
playsound(owner, 'sound/effects/gravhit.ogg', 25)
ADD_TRAIT(owner, TRAIT_FORCED_GRAVITY, REF(src))
animate(owner, 5 SECONDS, alpha = 100)
RegisterSignal(owner, COMSIG_LIVING_DEATH, PROC_REF(owner_dead), TRUE)
DO_FLOATING_ANIM(owner)
/datum/action/cooldown/fly/proc/disable_fly()
owner.movement_type = initial(owner.movement_type)
owner.plane = initial(owner.plane)
enabled = FALSE
owner.visible_message(span_notice("[owner.name], has landed on the ground."), span_notice("You land on the ground."))
playsound(owner, 'sound/effects/gravhit.ogg', 25)
REMOVE_TRAIT(owner, TRAIT_FORCED_GRAVITY, REF(src))
owner.alpha = initial(owner.alpha)
UnregisterSignal(owner, COMSIG_LIVING_DEATH)
STOP_FLOATING_ANIM(owner)
/datum/action/cooldown/fly/proc/owner_dead()
SIGNAL_HANDLER
if(enabled)
disable_fly()
@@ -0,0 +1,54 @@
/datum/action/cooldown/noclip
name = "Toggle noclip"
desc = "Grand you ability move through solid objects like turfs and mobs. This also renders you unclickable by other players."
cooldown_time = 1 SECONDS
button_icon = 'icons/effects/effects.dmi'
button_icon_state = "the_freezer"
var/enabled = FALSE
/datum/action/cooldown/noclip/IsAvailable(feedback)
. = ..()
if(owner.stat & DEAD)
return
if(owner.incapacitated(IGNORE_GRAB))
return
/datum/action/cooldown/noclip/Activate(atom/target)
. = ..()
if(enabled)
disable_noclip()
return TRUE
enable_noclip()
return TRUE
/datum/action/cooldown/noclip/proc/enable_noclip()
owner.pass_flags |= PASSCLOSEDTURF | PASSTABLE | PASSDOORS | PASSBLOB | PASSGLASS | PASSGRILLE | PASSMOB | PASSSTRUCTURE | PASSVEHICLE
owner.mouse_opacity = MOUSE_OPACITY_TRANSPARENT
owner.density = FALSE
owner.add_movespeed_modifier(/datum/movespeed_modifier/noclip)
owner.visible_message(span_notice("[owner.name], dissolves in air. Becoming non-physical."), span_notice("You going noclip."))
RegisterSignal(owner, COMSIG_LIVING_DEATH, PROC_REF(owner_dead), TRUE)
enabled = TRUE
/datum/action/cooldown/noclip/proc/disable_noclip()
owner.pass_flags = initial(owner.pass_flags)
owner.mouse_opacity = initial(owner.mouse_opacity)
owner.density = initial(owner.density)
owner.remove_movespeed_modifier(/datum/movespeed_modifier/noclip)
owner.visible_message(span_notice("[owner.name], becomes physical again."), span_notice("You back to normal again."))
UnregisterSignal(owner, COMSIG_LIVING_DEATH)
enabled = FALSE
/datum/action/cooldown/noclip/proc/owner_dead()
SIGNAL_HANDLER
if(enabled)
disable_noclip()
StartCooldown()
/datum/movespeed_modifier/noclip
id = "noclip"
movetypes = GROUND | FLYING
multiplicative_slowdown = -2
@@ -0,0 +1,12 @@
/obj/item/clothing/glasses/debug/architector_glasses
name = "Architector glasses"
desc = "High-tech glasses with many of special abilites."
icon_state = "sun"
inhand_icon_state = "sunglasses"
resistance_flags = INDESTRUCTIBLE
actions_types = list(
/datum/action/cooldown/fly,
/datum/action/cooldown/noclip,
/datum/action/item_action/chameleon/change/glasses/no_preset
)
@@ -0,0 +1,23 @@
/obj/machinery/vending/tool/super
name = "You (best) tool"
desc = "Architector tools for free!"
max_integrity = 99999
products = list(
/obj/item/crowbar/freeman/ultimate = 999,
/obj/item/clothing/suit/space/hev_suit = 999,
/obj/item/clothing/head/helmet/space/hev_suit = 999,
/obj/item/gun/ballistic/automatic/pistol = 999,
/obj/item/gun/ballistic/shotgun/automatic/combat/compact = 999,
/obj/item/gun/ballistic/revolver = 999,
)
premium = list(
/obj/item/clothing/glasses/debug/architector_glasses = 999,
/obj/item/physic_manipulation_tool/advanced = 999,
/obj/item/phystool = 999,
)
extra_price = PAYCHECK_ZERO
default_price = PAYCHECK_ZERO
resistance_flags = INDESTRUCTIBLE
/obj/machinery/vending/tool/super/screwdriver_act(mob/living/user, obj/item/attack_item)
return FALSE
@@ -0,0 +1,339 @@
#define TRAIT_PHYSGUN_PAUSE "physgun_pause"
#define PHYSGUN_EFFECTS "physgun_effects"
/obj/item/physic_manipulation_tool
name = "physic gun"
desc = "A tool for manipulating physics of objects."
icon = 'modular_zubbers/icons/obj/equipment/architector_items.dmi'
icon_state = "physgun_grayscale"
inhand_icon_state = "physgun_grayscale"
worn_icon_state = "physgun_grayscale"
belt_icon_state = "physgun_grayscale"
worn_icon = 'modular_zubbers/icons/mob/inhands/architector_items_belt.dmi'
lefthand_file = 'modular_zubbers/icons/mob/inhands/architector_items_lefthand.dmi'
righthand_file = 'modular_zubbers/icons/mob/inhands/architector_items_righthand.dmi'
slot_flags = ITEM_SLOT_BELT
demolition_mod = 0.5
w_class = WEIGHT_CLASS_NORMAL
throwforce = 0
throw_speed = 1
throw_range = 1
drop_sound = 'sound/items/handling/screwdriver_drop.ogg'
pickup_sound = 'modular_zubbers/sound/phystools/physgun_pickup.ogg'
//The dragged object.
var/atom/movable/handlet_atom
//The creature that is using the physgun.
var/mob/living/physgun_user
//Datum of the beam between the user and the dragged object.
var/datum/beam/physgun_beam
//Color of the physgun.
var/effects_color = COLOR_CARP_BLUE
//The effect that is tracking the cursor.
var/atom/movable/screen/fullscreen/cursor_catcher/physgun_catcher
//If the physgun is empowered?
var/force_grab = FALSE
//Can the physgun use advanced settings?
var/advanced = FALSE
var/use_cooldown = 3 SECONDS
COOLDOWN_DECLARE(grab_cooldown)
var/datum/looping_sound/gravgen/kinesis/phys_gun/loop_sound
/obj/item/physic_manipulation_tool/Initialize(mapload)
. = ..()
loop_sound = new(src)
/obj/item/physic_manipulation_tool/Destroy(force)
. = ..()
if(handlet_atom)
release_atom()
qdel(loop_sound)
/**
* The control of the dragging.
*/
/obj/item/physic_manipulation_tool/afterattack(atom/target, mob/user, proximity_flag, click_parameters)
. = ..()
if(istype(target))
if(!can_catch(target, user))
playsound(user, 'modular_zubbers/sound/phystools/physgun_cant_grab.ogg', 100, TRUE)
return
if(!COOLDOWN_FINISHED(src, grab_cooldown) && !handlet_atom)
user.balloon_alert(user, "On cooldown!")
return
if(!range_check(target, user) && !handlet_atom)
user.balloon_alert(user, "Too far!")
return
catch_atom(target, user)
COOLDOWN_START(src, grab_cooldown, use_cooldown)
return
/obj/item/physic_manipulation_tool/afterattack_secondary(atom/target, mob/user, proximity_flag, click_parameters)
. = ..()
/obj/item/physic_manipulation_tool/dropped(mob/user, silent)
. = ..()
if(handlet_atom)
release_atom()
/obj/item/physic_manipulation_tool/AltClick(mob/user)
. = ..()
var/choised_color = input(usr, "Pick new effects color", "Physgun color") as color|null
effects_color = choised_color
color = choised_color
update_appearance()
/obj/item/physic_manipulation_tool/examine(mob/user)
. = ..()
. += span_notice("Express manual:")
. += span_notice("Use ALT + LMB on the device to pick color.")
. += span_notice("Use LMB on the object to drag the object.")
. += span_green("Use RMB while dragging to freeze the object.")
. += span_red("Use LMB while dragging to release the object.")
. += span_notice("Use CTRL + LMB while dragging to throw the object.")
. += span_notice("Use ALT + LMB while dragging to rotate object.")
/**
* The movement of the dragged object.
*/
/obj/item/physic_manipulation_tool/process(seconds_per_tick)
if(!physgun_user)
release_atom()
return
if(!range_check(handlet_atom, physgun_user))
release_atom()
return
if(physgun_catcher.mouse_params)
physgun_catcher.calculate_params()
if(!physgun_catcher.given_turf)
return
physgun_user.setDir(get_dir(physgun_user, handlet_atom))
if(handlet_atom.loc == physgun_catcher.given_turf)
if(handlet_atom.pixel_x == physgun_catcher.given_x - world.icon_size/2 && handlet_atom.pixel_y == physgun_catcher.given_y - world.icon_size/2)
return
animate(handlet_atom, 0.2 SECONDS, pixel_x = handlet_atom.base_pixel_x + physgun_catcher.given_x - world.icon_size/2, pixel_y = handlet_atom.base_pixel_y + physgun_catcher.given_y - world.icon_size/2)
physgun_beam.redrawing()
return
animate(handlet_atom, 0.2 SECONDS, pixel_x = handlet_atom.base_pixel_x + physgun_catcher.given_x - world.icon_size/2, pixel_y = handlet_atom.base_pixel_y + physgun_catcher.given_y - world.icon_size/2)
physgun_beam.redrawing()
var/turf/turf_to_move = get_step_towards(handlet_atom, physgun_catcher.given_turf)
handlet_atom.Move(turf_to_move, get_dir(handlet_atom, turf_to_move), 8)
var/pixel_x_change = 0
var/pixel_y_change = 0
var/direction = get_dir(handlet_atom, turf_to_move)
if(direction & NORTH)
pixel_y_change = world.icon_size/2
else if(direction & SOUTH)
pixel_y_change = -world.icon_size/2
if(direction & EAST)
pixel_x_change = world.icon_size/2
else if(direction & WEST)
pixel_x_change = -world.icon_size/2
animate(handlet_atom, 0.2 SECONDS, pixel_x = handlet_atom.base_pixel_x + pixel_x_change, pixel_y = handlet_atom.base_pixel_y + pixel_y_change)
/obj/item/physic_manipulation_tool/proc/can_catch(atom/target, mob/user)
if(target == user)
return FALSE
if(!ismovable(target))
return FALSE
var/atom/movable/movable_target = target
if(iseffect(movable_target))
return FALSE
if(movable_target.anchored && !HAS_TRAIT(movable_target, TRAIT_PHYSGUN_PAUSE))
if(!advanced)
return FALSE
movable_target.set_anchored(FALSE)
if(ismob(movable_target))
if(!isliving(movable_target))
return FALSE
var/mob/living/living_target = movable_target
if(living_target.buckled)
return FALSE
if(living_target.client && !advanced)
return FALSE
return TRUE
/obj/item/physic_manipulation_tool/proc/range_check(atom/target, mob/user)
if(!isturf(user.loc))
return FALSE
if(!can_see(user, target, 4))
return FALSE
return TRUE
/**
* Signal controller.
*/
/obj/item/physic_manipulation_tool/proc/on_clicked(atom/source, location, control, params, user)
SIGNAL_HANDLER
if(!handlet_atom || !physgun_user)
return
var/list/modifiers = params2list(params)
if(LAZYACCESS(modifiers, RIGHT_CLICK))
if(!advanced)
physgun_user.balloon_alert(physgun_user, "Not enjoy power!")
return
pause_atom(handlet_atom)
return
else if(LAZYACCESS(modifiers, CTRL_CLICK))
repulse(handlet_atom, physgun_user)
return
else if(LAZYACCESS(modifiers, ALT_CLICK))
rotate_object(handlet_atom)
return
release_atom()
/obj/item/physic_manipulation_tool/proc/on_living_resist(mob/living)
SIGNAL_HANDLER
if(force_grab)
handlet_atom.balloon_alert(handlet_atom, "Never escape!")
return
if(handlet_atom)
release_atom()
/**
* Grabbing atom.
*/
/obj/item/physic_manipulation_tool/proc/catch_atom(atom/movable/target, mob/user)
if(isliving(target))
var/mob/living/L = target
if(force_grab)
L.SetParalyzed(INFINITY, TRUE)
if(L.has_status_effect(/datum/status_effect/physgun_pause))
L.remove_status_effect(/datum/status_effect/physgun_pause)
target.add_traits(list(TRAIT_HANDS_BLOCKED), REF(src))
RegisterSignal(target, COMSIG_LIVING_RESIST, PROC_REF(on_living_resist), TRUE)
target.movement_type = FLYING
target.add_filter("physgun", 3, list("type" = "outline", "color" = effects_color, "size" = 2))
physgun_beam = user.Beam(target, "light_beam")
physgun_beam.beam_color = effects_color
physgun_catcher = user.overlay_fullscreen("physgun_effect", /atom/movable/screen/fullscreen/cursor_catcher, 0)
physgun_catcher.assign_to_mob(user)
handlet_atom = target
handlet_atom.plane = handlet_atom.plane + 1
handlet_atom.set_density(FALSE)
physgun_user = user
loop_sound.start()
RegisterSignal(physgun_catcher, COMSIG_CLICK, PROC_REF(on_clicked), TRUE)
START_PROCESSING(SSfastprocess, src)
/**
* Releasing atom.
*/
/obj/item/physic_manipulation_tool/proc/release_atom()
if(isliving(handlet_atom))
var/mob/living/L = handlet_atom
if(force_grab)
L.SetParalyzed(0)
if(L.has_status_effect(/datum/status_effect/physgun_pause))
L.remove_status_effect(/datum/status_effect/physgun_pause)
handlet_atom.remove_traits(list(TRAIT_HANDS_BLOCKED), REF(src))
UnregisterSignal(handlet_atom, COMSIG_LIVING_RESIST)
if(HAS_TRAIT(handlet_atom, TRAIT_PHYSGUN_PAUSE))
REMOVE_TRAIT(handlet_atom, TRAIT_PHYSGUN_PAUSE, PHYSGUN_EFFECTS)
handlet_atom.movement_type = initial(movement_type)
STOP_PROCESSING(SSfastprocess, src)
handlet_atom.remove_filter("physgun")
UnregisterSignal(physgun_catcher, COMSIG_CLICK)
physgun_catcher = null
physgun_user.clear_fullscreen("physgun_effect")
handlet_atom.pixel_x = initial(handlet_atom.pixel_x)
handlet_atom.pixel_y = initial(handlet_atom.pixel_y)
handlet_atom.anchored = initial(handlet_atom.anchored)
handlet_atom.density = initial(handlet_atom.density)
handlet_atom.plane = initial(handlet_atom.plane)
qdel(physgun_beam)
physgun_user = null
handlet_atom = null
loop_sound.stop()
/**
* Rotating atom.
*/
/obj/item/physic_manipulation_tool/proc/rotate_object(atom/movable/target)
target.setDir(turn(target.dir,-90))
/**
* Freezing atom.
* Freezes the atom in air, blocking any movement.
*/
/obj/item/physic_manipulation_tool/proc/pause_atom(atom/movable/target)
if(isliving(handlet_atom))
var/mob/living/L = target
if(force_grab)
L.apply_status_effect(/datum/status_effect/physgun_pause/admin)
else
L.apply_status_effect(/datum/status_effect/physgun_pause)
REMOVE_TRAIT(L, TRAIT_HANDS_BLOCKED, REF(src))
ADD_TRAIT(handlet_atom, TRAIT_PHYSGUN_PAUSE, PHYSGUN_EFFECTS)
handlet_atom.set_anchored(TRUE)
STOP_PROCESSING(SSfastprocess, src)
UnregisterSignal(physgun_catcher, list(COMSIG_CLICK, COMSIG_CLICK_ALT, COMSIG_CLICK_CTRL))
physgun_catcher = null
physgun_user.clear_fullscreen("physgun_effect")
qdel(physgun_beam)
physgun_user = null
handlet_atom = null
loop_sound.stop()
/obj/item/physic_manipulation_tool/proc/repulse(atom/movable/target, mob/user)
release_atom()
var/turf/target_turf = get_turf_in_angle(get_angle(user, target), get_turf(user), 10)
target.throw_at(target_turf, range = 9, speed = target.density ? 3 : 4, thrower = user, spin = isitem(target))
playsound(user, 'modular_zubbers/sound/phystools/physgun_repulse.ogg', 100, TRUE)
/obj/item/physic_manipulation_tool/advanced
advanced = TRUE
use_cooldown = 1 SECONDS
/obj/item/physic_manipulation_tool/advanced/admin
force_grab = TRUE
/datum/looping_sound/gravgen/kinesis/phys_gun
mid_sounds = list('modular_zubbers/sound/phystools/physgun_hold_loop.ogg' = 1)
/datum/status_effect/physgun_pause
id = "physgun_pause"
var/force = FALSE
/datum/status_effect/physgun_pause/on_apply()
. = ..()
RegisterSignal(owner, COMSIG_LIVING_RESIST, PROC_REF(on_resist), TRUE)
ADD_TRAIT(owner, TRAIT_IMMOBILIZED, REF(src))
ADD_TRAIT(owner, TRAIT_HANDS_BLOCKED, REF(src))
/datum/status_effect/physgun_pause/on_remove()
. = ..()
UnregisterSignal(owner, COMSIG_LIVING_RESIST)
REMOVE_TRAIT(owner, TRAIT_IMMOBILIZED, REF(src))
REMOVE_TRAIT(owner, TRAIT_HANDS_BLOCKED, REF(src))
/datum/status_effect/physgun_pause/proc/on_resist()
SIGNAL_HANDLER
if(force)
owner.balloon_alert("Can't escape!")
return
if(!HAS_TRAIT(owner, TRAIT_PHYSGUN_PAUSE))
return
REMOVE_TRAIT(owner, TRAIT_PHYSGUN_PAUSE, PHYSGUN_EFFECTS)
owner.pixel_x = initial(owner.pixel_x)
owner.pixel_y = initial(owner.pixel_y)
owner.anchored = initial(owner.anchored)
owner.density = initial(owner.density)
owner.movement_type = initial(owner.movement_type)
owner.remove_status_effect(src)
owner.remove_filter("physgun")
owner.plane = initial(owner.plane)
/datum/status_effect/physgun_pause/admin
id = "physgun_pause_admin"
force = TRUE
@@ -0,0 +1,83 @@
/obj/item/phystool
name = "Toolgun"
desc = "Some kind of a revolver with a bluespace power cell and an anomaly core attached together."
icon = 'modular_zubbers/icons/obj/equipment/architector_items.dmi'
icon_state = "toolgun"
inhand_icon_state = "toolgun"
worn_icon_state = "toolgun"
worn_icon = 'modular_zubbers/icons/mob/inhands/architector_items_belt.dmi'
lefthand_file = 'modular_zubbers/icons/mob/inhands/architector_items_lefthand.dmi'
righthand_file = 'modular_zubbers/icons/mob/inhands/architector_items_righthand.dmi'
demolition_mod = 0.5
w_class = WEIGHT_CLASS_SMALL
throwforce = 0
throw_speed = 1
throw_range = 1
drop_sound = 'sound/items/handling/screwdriver_drop.ogg'
pickup_sound = 'modular_zubbers/sound/phystools/toolgun_select.ogg'
resistance_flags = INDESTRUCTIBLE
//The mode that is chosen at the moment.
var/datum/phystool_mode/selected_mode
//Available modes.
var/list/datum/phystool_mode/avaible_modes = list(
/datum/phystool_mode/build_mode,
/datum/phystool_mode/spawn_mode,
/datum/phystool_mode/remove_mode,
/datum/phystool_mode/color_mode,
/datum/phystool_mode/size_mode,
)
//The datum of the beam.
var/datum/beam/work_beam
/obj/item/phystool/examine(mob/user)
. = ..()
. += span_notice("Use ALT + LMB on the device to choose the mode.")
if(!selected_mode)
. += span_notice("No selected mode!")
return
. += span_notice(selected_mode.desc)
/obj/item/phystool/AltClick(mob/user)
. = ..()
if(selected_mode)
qdel(selected_mode)
var/datum/phystool_mode/mode_to_select = tgui_input_list(user, "Select work mode:", "Phystool mode", avaible_modes)
if(!mode_to_select)
return
selected_mode = new mode_to_select
selected_mode.on_selected(user)
playsound(user, 'modular_zubbers/sound/phystools/toolgun_select.ogg', 100, TRUE)
/obj/item/phystool/attack_self(mob/user)
. = ..()
if(!selected_mode)
return
selected_mode.use_act(user)
/obj/item/phystool/afterattack(atom/target, mob/user, proximity_flag, click_parameters)
. = ..()
if(!selected_mode)
return
if(!selected_mode.main_act(target, user))
playsound(user, 'modular_zubbers/sound/phystools/toolgun_error.ogg', 100, TRUE)
return
do_work_effect(target, user)
playsound(user, 'modular_zubbers/sound/phystools/toolgun_shot1.ogg', 100, TRUE)
/obj/item/phystool/afterattack_secondary(atom/target, mob/user, proximity_flag, click_parameters)
. = ..()
if(!selected_mode)
return
if(!selected_mode.secondnary_act(target, user))
playsound(user, 'modular_zubbers/sound/phystools/toolgun_error.ogg', 100, TRUE)
return
do_work_effect(target, user)
playsound(user, 'modular_zubbers/sound/phystools/toolgun_shot1.ogg', 100, TRUE)
return SECONDARY_ATTACK_CONTINUE_CHAIN
/obj/item/phystool/proc/do_work_effect(atom/target, mob/user)
if(!target)
return
work_beam = user.Beam(target, "light_beam", time = 3)
@@ -0,0 +1,14 @@
/datum/phystool_mode
var/name = "Defualt mode"
var/desc = "Coder button."
var/obj/item/phystool/our_tool
/datum/phystool_mode/proc/on_selected(mob/user)
to_chat(user, span_notice(desc))
/datum/phystool_mode/proc/main_act(atom/target, mob/user)
/datum/phystool_mode/proc/secondnary_act(atom/target, mob/user)
/datum/phystool_mode/proc/use_act(mob/user)
@@ -0,0 +1,59 @@
/datum/phystool_mode/build_mode
name = "Build mode"
desc = "Use LMB for build mode, RMB for remover and in hands to choose between structures."
var/atom/selected_atom
/datum/phystool_mode/build_mode/use_act(mob/user)
. = ..()
var/list/choise = list(
"Wall mode" = image(icon = 'icons/turf/walls.dmi', icon_state = "wall3"),
"Turf mode" = image(icon = 'icons/turf/walls.dmi', icon_state = "floor"),
"Structure mode" = image(icon = 'icons/obj/doors/airlocks/external/external.dmi', icon_state = "closed")
)
var/choised_mode = show_radial_menu(user, user, choise, require_near = TRUE)
if(!choised_mode)
user.balloon_alert(user, "Select one!")
return FALSE
var/list/pick = list()
if(choised_mode == "Wall mode")
pick = init_paths(/turf/closed/wall)
if(choised_mode == "Turf mode")
pick = init_paths(/turf/open)
for(var/turf/open/space/T in pick)
pick -= T
if(choised_mode == "Structure mode")
pick = init_paths(/obj/machinery/door)
selected_atom = tgui_input_list(user, "Selected object:", "Toolgun work", pick)
return TRUE
/datum/phystool_mode/build_mode/secondnary_act(atom/target, mob/user)
. = ..()
if(iswallturf(target))
var/turf/T = target
T.ScrapeAway(flags = CHANGETURF_INHERIT_AIR)
return TRUE
else if(istype(target, /obj/machinery/door))
qdel(target)
return TRUE
/datum/phystool_mode/build_mode/main_act(atom/target, mob/user)
. = ..()
if(!selected_atom)
user.balloon_alert(user, "Select atom first!")
return FALSE
if(!isopenturf(target))
user.balloon_alert(user, "Blocked!")
return FALSE
var/turf/T = target
if(T.is_blocked_turf())
user.balloon_alert(user, "Blocked!")
return FALSE
if(!isturf(selected_atom))
T.PlaceOnTop(selected_atom)
return TRUE
T.TerraformTurf(selected_atom, selected_atom, flags = CHANGETURF_INHERIT_AIR)
return TRUE
@@ -0,0 +1,26 @@
/datum/phystool_mode/color_mode
name = "Color mode"
desc = "Use LMB to color an object. Use RMB to set default color. Use in hands to choose color."
var/selected_color
/datum/phystool_mode/color_mode/use_act(mob/user)
. = ..()
selected_color = input(user, "Pick new effects color", "Physgun color") as color|null
/datum/phystool_mode/color_mode/main_act(atom/target, mob/user)
. = ..()
if(isliving(target))
var/mob/living/L = target
if(L.client)
user.balloon_alert(user, "Can't color!")
return FALSE
if(!selected_color)
selected_color = COLOR_WHITE
target.color = selected_color
return TRUE
/datum/phystool_mode/color_mode/secondnary_act(atom/target, mob/user)
. = ..()
target.color = initial(target.color)
return TRUE
@@ -0,0 +1,19 @@
/datum/phystool_mode/remove_mode
name = "Remove tool"
desc = "Use LMB to delete object from world."
/datum/phystool_mode/remove_mode/main_act(atom/target, mob/user)
. = ..()
if(isliving(target))
var/mob/living/living_target = target
if(living_target.client)
user.balloon_alert(user, "Client inside!")
return FALSE
//Is there is somthing inside target.
if(target.contents.len)
for(var/atom/movable/important_thing in target.contents)
if(!istype(important_thing))
continue
important_thing.forceMove(get_turf(target))
qdel(target)
return TRUE
@@ -0,0 +1,33 @@
/datum/phystool_mode/size_mode
name = "Size tool"
desc = "Use LMB to increase the size of an object. Use RMB to decrease the size of an object."
/datum/phystool_mode/size_mode/main_act(atom/target, mob/user)
. = ..()
if(isturf(target))
return FALSE
change_size(target, 2)
return TRUE
/datum/phystool_mode/size_mode/secondnary_act(atom/target, mob/user)
. = ..()
if(isturf(target))
return FALSE
change_size(target, 0.5)
return TRUE
/datum/phystool_mode/size_mode/proc/change_size(atom/target, value)
if(isliving(target))
var/mob/living/living_target = target
if(living_target.client)
return
var/translate_x = value * ( target.transform.b / value )
var/translate_y = value * ( target.transform.e / value )
if(((translate_x || translate_y) >= 8) || ((translate_x || translate_y) <= 0.125))
translate_x = target.transform.b
translate_y = target.transform.e
target.transform = target.transform.Translate(translate_x, translate_y)
target.pixel_x *= value
target.pixel_y *= value
target.transform = target.transform.Scale(value)
target.maptext_height = 32 * value
@@ -0,0 +1,59 @@
#define SPAWN_MODE_MOB_COOLDOWN 5 SECONDS
#define SPAWN_MODE_MEGAFAUNA_COOLDOWN 30 SECONDS
/datum/phystool_mode/spawn_mode
name = "Spawn mode"
desc = "Use LMB to spawn, use in hands to choose spawn type."
var/atom/selected_object
var/list/atom/black_list = list(
/obj/narsie,
/obj/cascade_portal,
/obj/singularity,
/obj/effect,
/mob/living/basic/supermatter_spider,
/area,
/turf
)
COOLDOWN_DECLARE(spawn_cooldown)
/datum/phystool_mode/spawn_mode/use_act(mob/user)
. = ..()
var/text_path = tgui_input_text(user, "Enter object path:", "Spawn tool", "none", 256, FALSE)
if(!text_path)
user.balloon_alert(user, "Enter path!")
return FALSE
selected_object = text2path(text_path)
if(!ispath(selected_object))
selected_object = pick_closest_path(text_path)
for(var/black_list_item in black_list)
if(ispath(selected_object, black_list_item))
selected_object = null
user.balloon_alert(user, "Spawn blocked!")
return FALSE
user.balloon_alert(user, "Selected!")
to_chat(user, span_notice("Current spawn type [selected_object]."))
/datum/phystool_mode/spawn_mode/main_act(atom/target, mob/user)
. = ..()
if(!selected_object)
user.balloon_alert(user, "Select type first!")
return FALSE
if(!COOLDOWN_FINISHED(src, spawn_cooldown))
user.balloon_alert(user, "Wait!")
return FALSE
var/target_cooldown
if(ispath(selected_object, /mob/living/simple_animal/hostile/megafauna))
target_cooldown = SPAWN_MODE_MEGAFAUNA_COOLDOWN
if(ispath(selected_object, /mob/living))
target_cooldown = SPAWN_MODE_MOB_COOLDOWN
if(target_cooldown)
COOLDOWN_START(src, spawn_cooldown, target_cooldown)
new selected_object(get_turf(target))
return TRUE
#undef SPAWN_MODE_MOB_COOLDOWN
#undef SPAWN_MODE_MEGAFAUNA_COOLDOWN