mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Fixes Merge Errors
This commit is contained in:
@@ -1,141 +0,0 @@
|
||||
/*
|
||||
plot_vector is a helper datum for plotting a path in a straight line towards a target turf.
|
||||
This datum converts from world space (turf.x and turf.y) to pixel space, which the datum keeps track of itself. This
|
||||
should work with any size turfs (i.e. 32x32, 64x64) as it references world.icon_size (note: not actually tested with
|
||||
anything other than 32x32 turfs).
|
||||
|
||||
setup()
|
||||
This should be called after creating a new instance of a plot_vector datum.
|
||||
This does the initial setup and calculations. Since we are travelling in a straight line we only need to calculate
|
||||
the vector and x/y steps once. x/y steps are capped to 1 full turf, whichever is further. If we are travelling along
|
||||
the y axis each step will be +/- 1 y, and the x movement reduced based on the angle (tangent calculation). After
|
||||
this every subsequent step will be incremented based on these calculations.
|
||||
Inputs:
|
||||
source - the turf the object is starting from
|
||||
target - the target turf the object is travelling towards
|
||||
xo - starting pixel_x offset, typically won't be needed, but included in case someone has a need for it later
|
||||
yo - same as xo, but for the y_pixel offset
|
||||
|
||||
increment()
|
||||
Adds the offset to the current location - incrementing it by one step along the vector.
|
||||
|
||||
return_angle()
|
||||
Returns the direction (angle in degrees) the object is travelling in.
|
||||
|
||||
(N)
|
||||
90<39>
|
||||
^
|
||||
|
|
||||
(W) 180<38> <--+--> 0<> (E)
|
||||
|
|
||||
v
|
||||
-90<39>
|
||||
(S)
|
||||
|
||||
return_hypotenuse()
|
||||
Returns the distance of travel for each step of the vector, relative to each full step of movement. 1 is a full turf
|
||||
length. Currently used as a multiplier for scaling effects that should be contiguous, like laser beams.
|
||||
|
||||
return_location()
|
||||
Returns a vector_loc datum containing the current location data of the object (see /datum/vector_loc). This includes
|
||||
the turf it currently should be at, as well as the pixel offset from the centre of that turf. Typically increment()
|
||||
would be called before this if you are going to move an object based on it's vector data.
|
||||
*/
|
||||
|
||||
/datum/plot_vector
|
||||
var/turf/source
|
||||
var/turf/target
|
||||
var/angle = 0 // direction of travel in degrees
|
||||
var/loc_x = 0 // in pixels from the left edge of the map
|
||||
var/loc_y = 0 // in pixels from the bottom edge of the map
|
||||
var/loc_z = 0 // loc z is in world space coordinates (i.e. z level) - we don't care about measuring pixels for this
|
||||
var/offset_x = 0 // distance to increment each step
|
||||
var/offset_y = 0
|
||||
|
||||
/datum/plot_vector/proc/setup(var/turf/S, var/turf/T, var/xo = 0, var/yo = 0, var/angle_offset=0)
|
||||
source = S
|
||||
target = T
|
||||
|
||||
if(!istype(source))
|
||||
source = get_turf(source)
|
||||
if(!istype(target))
|
||||
target = get_turf(target)
|
||||
|
||||
if(!istype(source) || !istype(target))
|
||||
return
|
||||
|
||||
// convert coordinates to pixel space (default is 32px/turf, 8160px across for a size 255 map)
|
||||
loc_x = source.x * world.icon_size + xo
|
||||
loc_y = source.y * world.icon_size + yo
|
||||
loc_z = source.z
|
||||
|
||||
// calculate initial x and y difference
|
||||
var/dx = target.x - source.x
|
||||
var/dy = target.y - source.y
|
||||
|
||||
// if we aren't moving anywhere; quit now
|
||||
if(dx == 0 && dy == 0)
|
||||
return
|
||||
|
||||
// calculate the angle
|
||||
angle = ATAN2(dx, dy) + angle_offset
|
||||
|
||||
// and some rounding to stop the increments jumping whole turfs - because byond favours certain angles
|
||||
if(angle > -135 && angle < 45)
|
||||
angle = CEILING(angle, 1)
|
||||
else
|
||||
angle = FLOOR(angle, 1)
|
||||
|
||||
// calculate the offset per increment step
|
||||
if(abs(angle) in list(0, 45, 90, 135, 180)) // check if the angle is a cardinal
|
||||
if(abs(angle) in list(0, 45, 135, 180)) // if so we can skip the trigonometry and set these to absolutes as
|
||||
offset_x = sign(dx) // they will always be a full step in one or more directions
|
||||
if(abs(angle) in list(45, 90, 135))
|
||||
offset_y = sign(dy)
|
||||
else if(abs(dy) > abs(dx))
|
||||
offset_x = COT(abs(angle)) // otherwise set the offsets
|
||||
offset_y = sign(dy)
|
||||
else
|
||||
offset_x = sign(dx)
|
||||
offset_y = TAN(angle)
|
||||
if(dx < 0)
|
||||
offset_y = -offset_y
|
||||
|
||||
// multiply the offset by the turf pixel size
|
||||
offset_x *= world.icon_size
|
||||
offset_y *= world.icon_size
|
||||
|
||||
/datum/plot_vector/proc/increment()
|
||||
loc_x += offset_x
|
||||
loc_y += offset_y
|
||||
|
||||
/datum/plot_vector/proc/return_angle()
|
||||
return angle
|
||||
|
||||
/datum/plot_vector/proc/return_hypotenuse()
|
||||
return sqrt(((offset_x / 32) ** 2) + ((offset_y / 32) ** 2))
|
||||
|
||||
/datum/plot_vector/proc/return_location(var/datum/vector_loc/data)
|
||||
if(!data)
|
||||
data = new()
|
||||
data.loc = locate(round(loc_x / world.icon_size, 1), round(loc_y / world.icon_size, 1), loc_z)
|
||||
if(!data.loc)
|
||||
return
|
||||
data.pixel_x = loc_x - (data.loc.x * world.icon_size)
|
||||
data.pixel_y = loc_y - (data.loc.y * world.icon_size)
|
||||
return data
|
||||
|
||||
/*
|
||||
vector_loc is a helper datum for returning precise location data from plot_vector. It includes the turf the object is in
|
||||
as well as the pixel offsets.
|
||||
|
||||
return_turf()
|
||||
Returns the turf the object should be currently located in.
|
||||
*/
|
||||
/datum/vector_loc
|
||||
var/turf/loc
|
||||
var/pixel_x
|
||||
var/pixel_y
|
||||
|
||||
/datum/vector_loc/proc/return_turf()
|
||||
return loc
|
||||
@@ -44,6 +44,11 @@
|
||||
pulledby = null
|
||||
QDEL_NULL(riding_datum) //VOREStation Add
|
||||
|
||||
/atom/movable/vv_edit_var(var_name, var_value)
|
||||
if(GLOB.VVpixelmovement[var_name]) //Pixel movement is not yet implemented, changing this will break everything irreversibly.
|
||||
return FALSE
|
||||
return ..()
|
||||
|
||||
////////////////////////////////////////
|
||||
// Here's where we rewrite how byond handles movement except slightly different
|
||||
// To be removed on step_ conversion
|
||||
|
||||
@@ -1379,7 +1379,7 @@
|
||||
return 0
|
||||
|
||||
//Shoot a bullet at someone
|
||||
/mob/living/simple_mob/proc/Shoot(var/target, var/start, var/user, var/bullet = 0)
|
||||
/mob/living/simple_animal/proc/Shoot(atom/target, atom/start, mob/user, var/bullet = 0)
|
||||
if(target == start)
|
||||
return
|
||||
|
||||
|
||||
@@ -1,312 +0,0 @@
|
||||
/obj/effect/projectile
|
||||
icon = 'icons/effects/projectiles.dmi'
|
||||
icon_state = "bolt"
|
||||
plane = ABOVE_PLANE
|
||||
|
||||
/obj/effect/projectile/New(var/turf/location)
|
||||
if(istype(location))
|
||||
loc = location
|
||||
|
||||
/obj/effect/projectile/proc/set_transform(var/matrix/M)
|
||||
if(istype(M))
|
||||
transform = M
|
||||
|
||||
/obj/effect/projectile/proc/activate(var/kill_delay = 5)
|
||||
update_light()
|
||||
spawn(kill_delay)
|
||||
qdel(src) //see effect_system.dm - sets loc to null and lets GC handle removing these effects
|
||||
|
||||
return
|
||||
|
||||
//----------------------------
|
||||
// Laser beam
|
||||
//----------------------------
|
||||
/obj/effect/projectile/laser/tracer
|
||||
icon_state = "beam"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#FF0D00"
|
||||
|
||||
/obj/effect/projectile/laser/muzzle
|
||||
icon_state = "muzzle_laser"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#FF0D00"
|
||||
|
||||
/obj/effect/projectile/laser/impact
|
||||
icon_state = "impact_laser"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#FF0D00"
|
||||
|
||||
//----------------------------
|
||||
// Blue laser beam
|
||||
//----------------------------
|
||||
/obj/effect/projectile/laser_blue/tracer
|
||||
icon_state = "beam_blue"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#0066FF"
|
||||
|
||||
/obj/effect/projectile/laser_blue/muzzle
|
||||
icon_state = "muzzle_blue"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#0066FF"
|
||||
|
||||
/obj/effect/projectile/laser_blue/impact
|
||||
icon_state = "impact_blue"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#0066FF"
|
||||
|
||||
//----------------------------
|
||||
// Omni laser beam
|
||||
//----------------------------
|
||||
/obj/effect/projectile/laser_omni/tracer
|
||||
icon_state = "beam_omni"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#00C6FF"
|
||||
|
||||
/obj/effect/projectile/laser_omni/muzzle
|
||||
icon_state = "muzzle_omni"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#00C6FF"
|
||||
|
||||
/obj/effect/projectile/laser_omni/impact
|
||||
icon_state = "impact_omni"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#00C6FF"
|
||||
|
||||
//----------------------------
|
||||
// Xray laser beam
|
||||
//----------------------------
|
||||
/obj/effect/projectile/xray/tracer
|
||||
icon_state = "xray"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#00CC33"
|
||||
|
||||
/obj/effect/projectile/xray/muzzle
|
||||
icon_state = "muzzle_xray"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#00CC33"
|
||||
|
||||
/obj/effect/projectile/xray/impact
|
||||
icon_state = "impact_xray"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#00CC33"
|
||||
|
||||
//----------------------------
|
||||
// Heavy laser beam
|
||||
//----------------------------
|
||||
/obj/effect/projectile/laser_heavy/tracer
|
||||
icon_state = "beam_heavy"
|
||||
light_range = 3
|
||||
light_power = 1
|
||||
light_color = "#FF0D00"
|
||||
|
||||
/obj/effect/projectile/laser_heavy/muzzle
|
||||
icon_state = "muzzle_beam_heavy"
|
||||
light_range = 3
|
||||
light_power = 1
|
||||
light_color = "#FF0D00"
|
||||
|
||||
/obj/effect/projectile/laser_heavy/impact
|
||||
icon_state = "impact_beam_heavy"
|
||||
light_range = 3
|
||||
light_power = 1
|
||||
light_color = "#FF0D00"
|
||||
|
||||
//----------------------------
|
||||
// Pulse laser beam
|
||||
//----------------------------
|
||||
/obj/effect/projectile/laser_pulse/tracer
|
||||
icon_state = "u_laser"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#0066FF"
|
||||
|
||||
/obj/effect/projectile/laser_pulse/muzzle
|
||||
icon_state = "muzzle_u_laser"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#0066FF"
|
||||
|
||||
/obj/effect/projectile/laser_pulse/impact
|
||||
icon_state = "impact_u_laser"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#0066FF"
|
||||
|
||||
//----------------------------
|
||||
// Pulse muzzle effect only
|
||||
//----------------------------
|
||||
/obj/effect/projectile/pulse/muzzle
|
||||
icon_state = "muzzle_pulse"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#0066FF"
|
||||
|
||||
//----------------------------
|
||||
// Emitter beam
|
||||
//----------------------------
|
||||
/obj/effect/projectile/emitter/tracer
|
||||
icon_state = "emitter"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#00CC33"
|
||||
|
||||
/obj/effect/projectile/emitter/muzzle
|
||||
icon_state = "muzzle_emitter"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#00CC33"
|
||||
|
||||
/obj/effect/projectile/emitter/impact
|
||||
icon_state = "impact_emitter"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#00CC33"
|
||||
|
||||
//----------------------------
|
||||
// Stun beam
|
||||
//----------------------------
|
||||
/obj/effect/projectile/stun/tracer
|
||||
icon_state = "stun"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#FFFFFF"
|
||||
|
||||
/obj/effect/projectile/stun/muzzle
|
||||
icon_state = "muzzle_stun"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#FFFFFF"
|
||||
|
||||
/obj/effect/projectile/stun/impact
|
||||
icon_state = "impact_stun"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#FFFFFF"
|
||||
|
||||
//----------------------------
|
||||
// Bullet
|
||||
//----------------------------
|
||||
/obj/effect/projectile/bullet/muzzle
|
||||
icon_state = "muzzle_bullet"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#FFFFFF"
|
||||
|
||||
//----------------------------
|
||||
// Lightning beam
|
||||
//----------------------------
|
||||
/obj/effect/projectile/lightning/tracer
|
||||
icon_state = "lightning"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#00C6FF"
|
||||
|
||||
/obj/effect/projectile/lightning/muzzle
|
||||
icon_state = "muzzle_lightning"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#00C6FF"
|
||||
|
||||
/obj/effect/projectile/lightning/impact
|
||||
icon_state = "impact_lightning"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#00C6FF"
|
||||
|
||||
//----------------------------
|
||||
// Dark matter stun
|
||||
//----------------------------
|
||||
|
||||
/obj/effect/projectile/darkmatterstun/tracer
|
||||
icon_state = "darkt"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#8837A3"
|
||||
|
||||
/obj/effect/projectile/darkmatterstun/muzzle
|
||||
icon_state = "muzzle_darkt"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#8837A3"
|
||||
|
||||
/obj/effect/projectile/darkmatterstun/impact
|
||||
icon_state = "impact_darkt"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#8837A3"
|
||||
|
||||
//----------------------------
|
||||
// Dark matter
|
||||
//----------------------------
|
||||
|
||||
/obj/effect/projectile/darkmatter/tracer
|
||||
icon_state = "darkb"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#8837A3"
|
||||
|
||||
/obj/effect/projectile/darkmatter/muzzle
|
||||
icon_state = "muzzle_darkb"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#8837A3"
|
||||
|
||||
/obj/effect/projectile/darkmatter/impact
|
||||
icon_state = "impact_darkb"
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#8837A3"
|
||||
|
||||
//----------------------------
|
||||
// Inversion / Cult
|
||||
//----------------------------
|
||||
/obj/effect/projectile/inversion/tracer
|
||||
icon_state = "invert"
|
||||
light_range = 2
|
||||
light_power = -2
|
||||
light_color = "#FFFFFF"
|
||||
|
||||
/obj/effect/projectile/inversion/muzzle
|
||||
icon_state = "muzzle_invert"
|
||||
light_range = 2
|
||||
light_power = -2
|
||||
light_color = "#FFFFFF"
|
||||
|
||||
/obj/effect/projectile/inversion/impact
|
||||
icon_state = "impact_invert"
|
||||
light_range = 2
|
||||
light_power = -2
|
||||
light_color = "#FFFFFF"
|
||||
|
||||
//----------------------------
|
||||
// Magnetohydronamic Howitzer
|
||||
//----------------------------
|
||||
/obj/effect/projectile/tungsten/tracer
|
||||
icon_state = "mhd_laser"
|
||||
light_range = 4
|
||||
light_power = 3
|
||||
light_color = "#3300ff"
|
||||
|
||||
/obj/effect/projectile/tungsten/muzzle
|
||||
icon_state = "muzzle_mhd_laser"
|
||||
light_range = 4
|
||||
light_power = 3
|
||||
light_color = "#3300ff"
|
||||
|
||||
/obj/effect/projectile/tungsten/impact
|
||||
icon_state = "impact_mhd_laser"
|
||||
light_range = 4
|
||||
light_power = 3
|
||||
light_color = "#3300ff"
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 42 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 26 KiB |
Reference in New Issue
Block a user